From dafcd821f5b3e44a8585884ee4c4bbbdc46b1c70 Mon Sep 17 00:00:00 2001 From: Anthony Ramine Date: Tue, 26 Sep 2017 00:05:23 +0200 Subject: [PATCH 1/9] Fix some messages in the tidy script It's MutJS, not MutJS>. --- python/tidy/servo_tidy/tidy.py | 6 +++--- python/tidy/servo_tidy_tests/ban-domrefcell.rs | 2 +- python/tidy/servo_tidy_tests/test_tidy.py | 2 +- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/python/tidy/servo_tidy/tidy.py b/python/tidy/servo_tidy/tidy.py index e88f4dc14586..74c9bf7b36f4 100644 --- a/python/tidy/servo_tidy/tidy.py +++ b/python/tidy/servo_tidy/tidy.py @@ -576,9 +576,9 @@ def check_rust(file_name, lines): # There should be any use of banned types: # Cell, Cell>, DOMRefCell>, DOMRefCell> (r"(\s|:)+Cell", "Banned type Cell detected. Use MutJS instead", no_filter), - (r"(\s|:)+Cell>", "Banned type Cell> detected. Use MutJS> instead", no_filter), - (r"DOMRefCell>", "Banned type DOMRefCell> detected. Use MutJS> instead", no_filter), - (r"DOMRefCell>", "Banned type DOMRefCell> detected. Use MutJS> instead", no_filter), + (r"(\s|:)+Cell>", "Banned type Cell> detected. Use MutJS instead", no_filter), + (r"DOMRefCell>", "Banned type DOMRefCell> detected. Use MutJS instead", no_filter), + (r"DOMRefCell>", "Banned type DOMRefCell> detected. Use MutJS instead", no_filter), # No benefit to using &Root (r": &Root<", "use &T instead of &Root", no_filter), (r"^&&", "operators should go at the end of the first line", no_filter), diff --git a/python/tidy/servo_tidy_tests/ban-domrefcell.rs b/python/tidy/servo_tidy_tests/ban-domrefcell.rs index a5953590d694..9cd8a74ca8c8 100644 --- a/python/tidy/servo_tidy_tests/ban-domrefcell.rs +++ b/python/tidy/servo_tidy_tests/ban-domrefcell.rs @@ -13,7 +13,7 @@ use script::test::Node; struct Foo { bar: DOMRefCell> - //~^ ERROR Banned type DOMRefCell> detected. Use MutJS> instead + //~^ ERROR Banned type DOMRefCell> detected. Use MutJS instead } fn main() {} diff --git a/python/tidy/servo_tidy_tests/test_tidy.py b/python/tidy/servo_tidy_tests/test_tidy.py index 4631d20ded78..6a45fd42062a 100644 --- a/python/tidy/servo_tidy_tests/test_tidy.py +++ b/python/tidy/servo_tidy_tests/test_tidy.py @@ -151,7 +151,7 @@ def test_rust(self): self.assertNoMoreErrors(ban_errors) ban_errors = tidy.collect_errors_for_files(iterFile('ban-domrefcell.rs'), [], [tidy.check_rust], print_text=False) - self.assertEqual('Banned type DOMRefCell> detected. Use MutJS> instead', ban_errors.next()[2]) + self.assertEqual('Banned type DOMRefCell> detected. Use MutJS instead', ban_errors.next()[2]) self.assertNoMoreErrors(ban_errors) def test_spec_link(self): From 0e3c54c1911ba2c3bf305ee04f04fcd9bf2fc2fe Mon Sep 17 00:00:00 2001 From: Anthony Ramine Date: Mon, 25 Sep 2017 23:30:24 +0200 Subject: [PATCH 2/9] Rename dom::bindings::js to dom::bindings::root --- components/script/body.rs | 2 +- components/script/devtools.rs | 2 +- components/script/docs/JS-Servos-only-GC.md | 10 +++++----- components/script/document_loader.rs | 2 +- components/script/dom/attr.rs | 2 +- components/script/dom/beforeunloadevent.rs | 2 +- components/script/dom/bindings/callback.rs | 2 +- .../script/dom/bindings/codegen/CodegenRust.py | 12 ++++++------ components/script/dom/bindings/conversions.rs | 2 +- components/script/dom/bindings/interface.rs | 2 +- components/script/dom/bindings/iterable.rs | 2 +- components/script/dom/bindings/mod.rs | 2 +- components/script/dom/bindings/refcounted.rs | 2 +- components/script/dom/bindings/reflector.rs | 2 +- components/script/dom/bindings/{js.rs => root.rs} | 0 components/script/dom/bindings/settings_stack.rs | 2 +- components/script/dom/bindings/structuredclone.rs | 2 +- components/script/dom/bindings/trace.rs | 2 +- components/script/dom/bindings/weakref.rs | 2 +- components/script/dom/blob.rs | 2 +- components/script/dom/bluetooth.rs | 2 +- components/script/dom/bluetoothadvertisingevent.rs | 2 +- .../script/dom/bluetoothcharacteristicproperties.rs | 2 +- components/script/dom/bluetoothdevice.rs | 2 +- components/script/dom/bluetoothpermissionresult.rs | 2 +- .../script/dom/bluetoothremotegattcharacteristic.rs | 2 +- .../script/dom/bluetoothremotegattdescriptor.rs | 2 +- components/script/dom/bluetoothremotegattserver.rs | 2 +- components/script/dom/bluetoothremotegattservice.rs | 2 +- components/script/dom/canvasgradient.rs | 2 +- components/script/dom/canvaspattern.rs | 2 +- components/script/dom/canvasrenderingcontext2d.rs | 2 +- components/script/dom/characterdata.rs | 2 +- components/script/dom/client.rs | 2 +- components/script/dom/closeevent.rs | 2 +- components/script/dom/comment.rs | 2 +- components/script/dom/compositionevent.rs | 2 +- components/script/dom/create.rs | 2 +- components/script/dom/crypto.rs | 2 +- components/script/dom/cssfontfacerule.rs | 2 +- components/script/dom/cssgroupingrule.rs | 2 +- components/script/dom/cssimportrule.rs | 2 +- components/script/dom/csskeyframerule.rs | 2 +- components/script/dom/csskeyframesrule.rs | 2 +- components/script/dom/cssmediarule.rs | 2 +- components/script/dom/cssnamespacerule.rs | 2 +- components/script/dom/cssrule.rs | 2 +- components/script/dom/cssrulelist.rs | 2 +- components/script/dom/cssstyledeclaration.rs | 2 +- components/script/dom/cssstylerule.rs | 2 +- components/script/dom/cssstylesheet.rs | 2 +- components/script/dom/cssstylevalue.rs | 2 +- components/script/dom/csssupportsrule.rs | 2 +- components/script/dom/cssviewportrule.rs | 2 +- components/script/dom/customelementregistry.rs | 2 +- components/script/dom/customevent.rs | 2 +- components/script/dom/dedicatedworkerglobalscope.rs | 2 +- components/script/dom/dissimilaroriginlocation.rs | 2 +- components/script/dom/dissimilaroriginwindow.rs | 2 +- components/script/dom/document.rs | 3 +-- components/script/dom/documentfragment.rs | 2 +- components/script/dom/documenttype.rs | 2 +- components/script/dom/domexception.rs | 2 +- components/script/dom/domimplementation.rs | 2 +- components/script/dom/dommatrix.rs | 2 +- components/script/dom/dommatrixreadonly.rs | 2 +- components/script/dom/domparser.rs | 2 +- components/script/dom/dompoint.rs | 2 +- components/script/dom/dompointreadonly.rs | 2 +- components/script/dom/domquad.rs | 2 +- components/script/dom/domrect.rs | 2 +- components/script/dom/domrectreadonly.rs | 2 +- components/script/dom/domstringmap.rs | 2 +- components/script/dom/domtokenlist.rs | 2 +- components/script/dom/element.rs | 3 +-- components/script/dom/errorevent.rs | 2 +- components/script/dom/event.rs | 2 +- components/script/dom/eventsource.rs | 2 +- components/script/dom/eventtarget.rs | 2 +- components/script/dom/extendableevent.rs | 2 +- components/script/dom/extendablemessageevent.rs | 2 +- components/script/dom/file.rs | 2 +- components/script/dom/filelist.rs | 2 +- components/script/dom/filereader.rs | 2 +- components/script/dom/filereadersync.rs | 2 +- components/script/dom/focusevent.rs | 2 +- components/script/dom/forcetouchevent.rs | 2 +- components/script/dom/formdata.rs | 2 +- components/script/dom/gamepad.rs | 2 +- components/script/dom/gamepadbutton.rs | 2 +- components/script/dom/gamepadbuttonlist.rs | 2 +- components/script/dom/gamepadevent.rs | 2 +- components/script/dom/gamepadlist.rs | 2 +- components/script/dom/globalscope.rs | 2 +- components/script/dom/hashchangeevent.rs | 2 +- components/script/dom/headers.rs | 2 +- components/script/dom/history.rs | 2 +- components/script/dom/htmlanchorelement.rs | 2 +- components/script/dom/htmlappletelement.rs | 2 +- components/script/dom/htmlareaelement.rs | 2 +- components/script/dom/htmlaudioelement.rs | 2 +- components/script/dom/htmlbaseelement.rs | 2 +- components/script/dom/htmlbodyelement.rs | 2 +- components/script/dom/htmlbrelement.rs | 2 +- components/script/dom/htmlbuttonelement.rs | 2 +- components/script/dom/htmlcanvaselement.rs | 2 +- components/script/dom/htmlcollection.rs | 2 +- components/script/dom/htmldataelement.rs | 2 +- components/script/dom/htmldatalistelement.rs | 2 +- components/script/dom/htmldetailselement.rs | 2 +- components/script/dom/htmldialogelement.rs | 2 +- components/script/dom/htmldirectoryelement.rs | 2 +- components/script/dom/htmldivelement.rs | 2 +- components/script/dom/htmldlistelement.rs | 2 +- components/script/dom/htmlelement.rs | 2 +- components/script/dom/htmlembedelement.rs | 2 +- components/script/dom/htmlfieldsetelement.rs | 2 +- components/script/dom/htmlfontelement.rs | 2 +- components/script/dom/htmlformcontrolscollection.rs | 2 +- components/script/dom/htmlformelement.rs | 2 +- components/script/dom/htmlframeelement.rs | 2 +- components/script/dom/htmlframesetelement.rs | 2 +- components/script/dom/htmlheadelement.rs | 2 +- components/script/dom/htmlheadingelement.rs | 2 +- components/script/dom/htmlhrelement.rs | 2 +- components/script/dom/htmlhtmlelement.rs | 2 +- components/script/dom/htmliframeelement.rs | 2 +- components/script/dom/htmlimageelement.rs | 2 +- components/script/dom/htmlinputelement.rs | 2 +- components/script/dom/htmllabelelement.rs | 2 +- components/script/dom/htmllegendelement.rs | 2 +- components/script/dom/htmllielement.rs | 2 +- components/script/dom/htmllinkelement.rs | 2 +- components/script/dom/htmlmapelement.rs | 2 +- components/script/dom/htmlmediaelement.rs | 2 +- components/script/dom/htmlmetaelement.rs | 2 +- components/script/dom/htmlmeterelement.rs | 2 +- components/script/dom/htmlmodelement.rs | 2 +- components/script/dom/htmlobjectelement.rs | 2 +- components/script/dom/htmlolistelement.rs | 2 +- components/script/dom/htmloptgroupelement.rs | 2 +- components/script/dom/htmloptionelement.rs | 2 +- components/script/dom/htmloptionscollection.rs | 2 +- components/script/dom/htmloutputelement.rs | 2 +- components/script/dom/htmlparagraphelement.rs | 2 +- components/script/dom/htmlparamelement.rs | 2 +- components/script/dom/htmlpreelement.rs | 2 +- components/script/dom/htmlprogresselement.rs | 2 +- components/script/dom/htmlquoteelement.rs | 2 +- components/script/dom/htmlscriptelement.rs | 3 +-- components/script/dom/htmlselectelement.rs | 2 +- components/script/dom/htmlsourceelement.rs | 2 +- components/script/dom/htmlspanelement.rs | 2 +- components/script/dom/htmlstyleelement.rs | 2 +- components/script/dom/htmltablecaptionelement.rs | 2 +- components/script/dom/htmltablecellelement.rs | 2 +- components/script/dom/htmltablecolelement.rs | 2 +- components/script/dom/htmltabledatacellelement.rs | 2 +- components/script/dom/htmltableelement.rs | 2 +- components/script/dom/htmltableheadercellelement.rs | 2 +- components/script/dom/htmltablerowelement.rs | 2 +- components/script/dom/htmltablesectionelement.rs | 2 +- components/script/dom/htmltemplateelement.rs | 2 +- components/script/dom/htmltextareaelement.rs | 2 +- components/script/dom/htmltimeelement.rs | 2 +- components/script/dom/htmltitleelement.rs | 2 +- components/script/dom/htmltrackelement.rs | 2 +- components/script/dom/htmlulistelement.rs | 2 +- components/script/dom/htmlunknownelement.rs | 2 +- components/script/dom/htmlvideoelement.rs | 2 +- components/script/dom/imagedata.rs | 2 +- components/script/dom/inputevent.rs | 2 +- components/script/dom/keyboardevent.rs | 2 +- components/script/dom/location.rs | 2 +- components/script/dom/macros.rs | 2 +- components/script/dom/mediaerror.rs | 2 +- components/script/dom/medialist.rs | 2 +- components/script/dom/mediaquerylist.rs | 2 +- components/script/dom/mediaquerylistevent.rs | 2 +- components/script/dom/messageevent.rs | 2 +- components/script/dom/mimetype.rs | 2 +- components/script/dom/mimetypearray.rs | 2 +- components/script/dom/mod.rs | 10 +++++----- components/script/dom/mouseevent.rs | 2 +- components/script/dom/mutationobserver.rs | 2 +- components/script/dom/mutationrecord.rs | 2 +- components/script/dom/namednodemap.rs | 2 +- components/script/dom/navigator.rs | 2 +- components/script/dom/node.rs | 4 +--- components/script/dom/nodeiterator.rs | 2 +- components/script/dom/nodelist.rs | 2 +- components/script/dom/pagetransitionevent.rs | 2 +- components/script/dom/paintrenderingcontext2d.rs | 2 +- components/script/dom/paintsize.rs | 2 +- components/script/dom/paintworkletglobalscope.rs | 3 +-- components/script/dom/performance.rs | 2 +- components/script/dom/performanceentry.rs | 2 +- components/script/dom/performanceobserver.rs | 2 +- .../script/dom/performanceobserverentrylist.rs | 2 +- components/script/dom/performancepainttiming.rs | 2 +- components/script/dom/performancetiming.rs | 2 +- components/script/dom/permissions.rs | 2 +- components/script/dom/permissionstatus.rs | 2 +- components/script/dom/plugin.rs | 2 +- components/script/dom/pluginarray.rs | 2 +- components/script/dom/popstateevent.rs | 2 +- components/script/dom/processinginstruction.rs | 2 +- components/script/dom/progressevent.rs | 2 +- components/script/dom/promisenativehandler.rs | 2 +- components/script/dom/radionodelist.rs | 2 +- components/script/dom/range.rs | 2 +- components/script/dom/request.rs | 2 +- components/script/dom/response.rs | 2 +- components/script/dom/screen.rs | 2 +- components/script/dom/serviceworker.rs | 2 +- components/script/dom/serviceworkercontainer.rs | 2 +- components/script/dom/serviceworkerglobalscope.rs | 2 +- components/script/dom/serviceworkerregistration.rs | 2 +- components/script/dom/servoparser/async_html.rs | 2 +- components/script/dom/servoparser/html.rs | 2 +- components/script/dom/servoparser/mod.rs | 2 +- components/script/dom/servoparser/xml.rs | 2 +- components/script/dom/storage.rs | 2 +- components/script/dom/storageevent.rs | 2 +- components/script/dom/stylepropertymapreadonly.rs | 3 +-- components/script/dom/stylesheet.rs | 2 +- components/script/dom/stylesheetlist.rs | 2 +- components/script/dom/svgsvgelement.rs | 2 +- components/script/dom/testbinding.rs | 2 +- components/script/dom/testbindingiterable.rs | 2 +- components/script/dom/testbindingpairiterable.rs | 2 +- components/script/dom/testrunner.rs | 2 +- components/script/dom/testworklet.rs | 3 +-- components/script/dom/testworkletglobalscope.rs | 2 +- components/script/dom/text.rs | 3 +-- components/script/dom/textdecoder.rs | 2 +- components/script/dom/textencoder.rs | 2 +- components/script/dom/touch.rs | 2 +- components/script/dom/touchevent.rs | 2 +- components/script/dom/touchlist.rs | 2 +- components/script/dom/transitionevent.rs | 2 +- components/script/dom/treewalker.rs | 3 +-- components/script/dom/uievent.rs | 2 +- components/script/dom/url.rs | 2 +- components/script/dom/urlsearchparams.rs | 2 +- components/script/dom/validitystate.rs | 2 +- components/script/dom/vr.rs | 2 +- components/script/dom/vrdisplay.rs | 2 +- components/script/dom/vrdisplaycapabilities.rs | 2 +- components/script/dom/vrdisplayevent.rs | 2 +- components/script/dom/vreyeparameters.rs | 2 +- components/script/dom/vrfieldofview.rs | 2 +- components/script/dom/vrframedata.rs | 2 +- components/script/dom/vrpose.rs | 2 +- components/script/dom/vrstageparameters.rs | 2 +- .../webgl_extensions/ext/oesstandardderivatives.rs | 2 +- .../dom/webgl_extensions/ext/oestexturefloat.rs | 2 +- .../webgl_extensions/ext/oestexturefloatlinear.rs | 2 +- .../dom/webgl_extensions/ext/oestexturehalffloat.rs | 2 +- .../ext/oestexturehalffloatlinear.rs | 2 +- .../dom/webgl_extensions/ext/oesvertexarrayobject.rs | 2 +- .../ext/webglvertexarrayobjectoes.rs | 3 +-- components/script/dom/webgl_extensions/extension.rs | 2 +- components/script/dom/webgl_extensions/extensions.rs | 2 +- components/script/dom/webgl_extensions/wrapper.rs | 2 +- .../script/dom/webgl_validations/tex_image_2d.rs | 2 +- components/script/dom/webglactiveinfo.rs | 2 +- components/script/dom/webglbuffer.rs | 2 +- components/script/dom/webglcontextevent.rs | 2 +- components/script/dom/webglframebuffer.rs | 2 +- components/script/dom/webglprogram.rs | 2 +- components/script/dom/webglrenderbuffer.rs | 2 +- components/script/dom/webglrenderingcontext.rs | 2 +- components/script/dom/webglshader.rs | 2 +- components/script/dom/webglshaderprecisionformat.rs | 2 +- components/script/dom/webgltexture.rs | 2 +- components/script/dom/webgluniformlocation.rs | 2 +- components/script/dom/websocket.rs | 2 +- components/script/dom/window.rs | 2 +- components/script/dom/windowproxy.rs | 2 +- components/script/dom/worker.rs | 2 +- components/script/dom/workerglobalscope.rs | 2 +- components/script/dom/workerlocation.rs | 2 +- components/script/dom/workernavigator.rs | 2 +- components/script/dom/worklet.rs | 4 +--- components/script/dom/workletglobalscope.rs | 2 +- components/script/dom/xmldocument.rs | 2 +- components/script/dom/xmlhttprequest.rs | 2 +- components/script/dom/xmlhttprequestupload.rs | 2 +- components/script/fetch.rs | 2 +- components/script/lib.rs | 2 +- components/script/microtask.rs | 2 +- components/script/script_runtime.rs | 2 +- components/script/script_thread.rs | 4 ++-- components/script/serviceworkerjob.rs | 2 +- components/script/test.rs | 2 +- components/script/webdriver_handlers.rs | 2 +- 297 files changed, 310 insertions(+), 323 deletions(-) rename components/script/dom/bindings/{js.rs => root.rs} (100%) diff --git a/components/script/body.rs b/components/script/body.rs index 83fe5b119322..b574b1125352 100644 --- a/components/script/body.rs +++ b/components/script/body.rs @@ -4,8 +4,8 @@ use dom::bindings::codegen::Bindings::FormDataBinding::FormDataMethods; use dom::bindings::error::{Error, Fallible}; -use dom::bindings::js::Root; use dom::bindings::reflector::DomObject; +use dom::bindings::root::Root; use dom::bindings::str::USVString; use dom::blob::{Blob, BlobImpl}; use dom::formdata::FormData; diff --git a/components/script/devtools.rs b/components/script/devtools.rs index 7172f2bdf9d9..81c257c902f2 100644 --- a/components/script/devtools.rs +++ b/components/script/devtools.rs @@ -13,8 +13,8 @@ use dom::bindings::codegen::Bindings::ElementBinding::ElementMethods; use dom::bindings::codegen::Bindings::WindowBinding::WindowMethods; use dom::bindings::conversions::{ConversionResult, FromJSValConvertible, jsstring_to_str}; use dom::bindings::inheritance::Castable; -use dom::bindings::js::Root; use dom::bindings::reflector::DomObject; +use dom::bindings::root::Root; use dom::bindings::str::DOMString; use dom::document::AnimationFrameCallback; use dom::element::Element; diff --git a/components/script/docs/JS-Servos-only-GC.md b/components/script/docs/JS-Servos-only-GC.md index e5549a61063d..aa8f72e4f415 100644 --- a/components/script/docs/JS-Servos-only-GC.md +++ b/components/script/docs/JS-Servos-only-GC.md @@ -168,7 +168,7 @@ garbage collector about. We do this with a above). The implementation of `trace` for `JS` is not auto-generated; this is where we actually call the SpiderMonkey trace hooks: -[js]: http://doc.servo.org/script/dom/bindings/js/struct.JS.html +[js]: http://doc.servo.org/script/dom/bindings/root/struct.JS.html ```rust pub fn trace_reflector(tracer: *mut JSTracer, description: &str, reflector: &Reflector) { @@ -232,10 +232,10 @@ In some cases, we need to use a DOM object longer than the reference we received allows us to; the [`Root::from_ref` associated function][from-ref] allows creating a new `Root` struct in that case. -[root]: http://doc.servo.org/script/dom/bindings/js/struct.Root.html +[root]: http://doc.servo.org/script/dom/bindings/root/struct.Root.html [raii]: https://en.wikipedia.org/wiki/Resource_Acquisition_Is_Initialization [new]: http://doc.servo.org/script/dom/index.html#construction -[from-ref]: http://doc.servo.org/script/dom/bindings/js/struct.Root.html#method.from_ref +[from-ref]: http://doc.servo.org/script/dom/bindings/root/struct.Root.html#method.from_ref We can then obtain a reference from the `Root` through Rust's built-in [`Deref` trait][deref], which exposes a method `deref` with the following @@ -282,10 +282,10 @@ use-after-free and other dangerous bugs. [lifetimes]: https://doc.rust-lang.org/book/lifetimes.html [ti]: https://en.wikipedia.org/wiki/Type_inference -You can check out the [`js` module's documentation][js-docs] for more details +You can check out the [`root` module's documentation][root-docs] for more details that didn't make it into this document. -[js-docs]: http://doc.servo.org/script/dom/bindings/js/index.html +[root-docs]: http://doc.servo.org/script/dom/bindings/root/index.html Custom static analysis ====================== diff --git a/components/script/document_loader.rs b/components/script/document_loader.rs index 1073403da7eb..4138debf2d3f 100644 --- a/components/script/document_loader.rs +++ b/components/script/document_loader.rs @@ -5,7 +5,7 @@ //! Tracking of pending loads in a document. //! https://html.spec.whatwg.org/multipage/#the-end -use dom::bindings::js::JS; +use dom::bindings::root::JS; use dom::document::Document; use ipc_channel::ipc::IpcSender; use net_traits::{CoreResourceMsg, FetchResponseMsg, ResourceThreads, IpcSend}; diff --git a/components/script/dom/attr.rs b/components/script/dom/attr.rs index 3ce627b46775..ea97c1a294f1 100644 --- a/components/script/dom/attr.rs +++ b/components/script/dom/attr.rs @@ -6,8 +6,8 @@ use devtools_traits::AttrInfo; use dom::bindings::cell::DOMRefCell; use dom::bindings::codegen::Bindings::AttrBinding::{self, AttrMethods}; use dom::bindings::inheritance::Castable; -use dom::bindings::js::{LayoutJS, MutNullableJS, Root, RootedReference}; use dom::bindings::reflector::{Reflector, reflect_dom_object}; +use dom::bindings::root::{LayoutJS, MutNullableJS, Root, RootedReference}; use dom::bindings::str::DOMString; use dom::customelementregistry::CallbackReaction; use dom::element::{AttributeMutation, Element}; diff --git a/components/script/dom/beforeunloadevent.rs b/components/script/dom/beforeunloadevent.rs index f0b152e0fdda..dc435a206205 100644 --- a/components/script/dom/beforeunloadevent.rs +++ b/components/script/dom/beforeunloadevent.rs @@ -9,8 +9,8 @@ use dom::bindings::codegen::Bindings::BeforeUnloadEventBinding; use dom::bindings::codegen::Bindings::BeforeUnloadEventBinding::BeforeUnloadEventMethods; use dom::bindings::codegen::Bindings::EventBinding::EventMethods; use dom::bindings::inheritance::Castable; -use dom::bindings::js::Root; use dom::bindings::reflector::reflect_dom_object; +use dom::bindings::root::Root; use dom::bindings::str::DOMString; use dom::event::{Event, EventBubbles, EventCancelable}; use dom::window::Window; diff --git a/components/script/dom/bindings/callback.rs b/components/script/dom/bindings/callback.rs index 4dfb6584989d..5b2adfe2b99b 100644 --- a/components/script/dom/bindings/callback.rs +++ b/components/script/dom/bindings/callback.rs @@ -5,8 +5,8 @@ //! Base classes to work with IDL callbacks. use dom::bindings::error::{Error, Fallible, report_pending_exception}; -use dom::bindings::js::{JS, Root}; use dom::bindings::reflector::DomObject; +use dom::bindings::root::{JS, Root}; use dom::bindings::settings_stack::{AutoEntryScript, AutoIncumbentScript}; use dom::bindings::utils::AsCCharPtrPtr; use dom::globalscope::GlobalScope; diff --git a/components/script/dom/bindings/codegen/CodegenRust.py b/components/script/dom/bindings/codegen/CodegenRust.py index 68ab0a33c186..03c2076951b3 100644 --- a/components/script/dom/bindings/codegen/CodegenRust.py +++ b/components/script/dom/bindings/codegen/CodegenRust.py @@ -2253,8 +2253,8 @@ def UnionTypes(descriptors, dictionaries, callbacks, typedefs, config): 'dom::bindings::conversions::StringificationBehavior', 'dom::bindings::conversions::root_from_handlevalue', 'dom::bindings::error::throw_not_in_union', - 'dom::bindings::js::Root', 'dom::bindings::mozmap::MozMap', + 'dom::bindings::root::Root', 'dom::bindings::str::ByteString', 'dom::bindings::str::DOMString', 'dom::bindings::str::USVString', @@ -5708,14 +5708,14 @@ def generate_imports(config, cgthings, descriptors, callbacks=None, dictionaries 'dom::bindings::interface::push_new_element_queue', 'dom::bindings::iterable::Iterable', 'dom::bindings::iterable::IteratorType', - 'dom::bindings::js::JS', - 'dom::bindings::js::OptionalHeapSetter', - 'dom::bindings::js::Root', - 'dom::bindings::js::RootedReference', 'dom::bindings::namespace::NamespaceObjectClass', 'dom::bindings::namespace::create_namespace_object', 'dom::bindings::reflector::MutDomObject', 'dom::bindings::reflector::DomObject', + 'dom::bindings::root::JS', + 'dom::bindings::root::OptionalHeapSetter', + 'dom::bindings::root::Root', + 'dom::bindings::root::RootedReference', 'dom::bindings::utils::AsVoidPtr', 'dom::bindings::utils::DOMClass', 'dom::bindings::utils::DOMJSClass', @@ -7195,7 +7195,7 @@ def InheritTypes(config): imports = [CGGeneric("use dom::types::*;\n"), CGGeneric("use dom::bindings::conversions::{DerivedFrom, get_dom_class};\n"), CGGeneric("use dom::bindings::inheritance::Castable;\n"), - CGGeneric("use dom::bindings::js::{JS, LayoutJS, Root};\n"), + CGGeneric("use dom::bindings::root::{JS, LayoutJS, Root};\n"), CGGeneric("use dom::bindings::trace::JSTraceable;\n"), CGGeneric("use dom::bindings::reflector::DomObject;\n"), CGGeneric("use js::jsapi::JSTracer;\n\n"), diff --git a/components/script/dom/bindings/conversions.rs b/components/script/dom/bindings/conversions.rs index 69751f2c263b..7528830ea7c6 100644 --- a/components/script/dom/bindings/conversions.rs +++ b/components/script/dom/bindings/conversions.rs @@ -34,9 +34,9 @@ use dom::bindings::error::{Error, Fallible}; use dom::bindings::inheritance::Castable; -use dom::bindings::js::Root; use dom::bindings::num::Finite; use dom::bindings::reflector::{DomObject, Reflector}; +use dom::bindings::root::Root; use dom::bindings::str::{ByteString, DOMString, USVString}; use dom::bindings::trace::{JSTraceable, RootedTraceableBox}; use dom::bindings::utils::DOMClass; diff --git a/components/script/dom/bindings/interface.rs b/components/script/dom/bindings/interface.rs index c242bd7f0650..5e04e80ad731 100644 --- a/components/script/dom/bindings/interface.rs +++ b/components/script/dom/bindings/interface.rs @@ -77,7 +77,7 @@ use dom::bindings::constant::{ConstantSpec, define_constants}; use dom::bindings::conversions::{DOM_OBJECT_SLOT, DerivedFrom, get_dom_class}; use dom::bindings::error::{Error, Fallible}; use dom::bindings::guard::Guard; -use dom::bindings::js::Root; +use dom::bindings::root::Root; use dom::bindings::utils::{DOM_PROTOTYPE_SLOT, ProtoOrIfaceArray, get_proto_or_iface_array}; use dom::create::create_native_html_element; use dom::customelementregistry::ConstructionStackEntry; diff --git a/components/script/dom/bindings/iterable.rs b/components/script/dom/bindings/iterable.rs index 7926ff54173a..ec8daf36dcff 100644 --- a/components/script/dom/bindings/iterable.rs +++ b/components/script/dom/bindings/iterable.rs @@ -10,8 +10,8 @@ use core::nonzero::NonZero; use dom::bindings::codegen::Bindings::IterableIteratorBinding::IterableKeyAndValueResult; use dom::bindings::codegen::Bindings::IterableIteratorBinding::IterableKeyOrValueResult; use dom::bindings::error::Fallible; -use dom::bindings::js::{JS, Root}; use dom::bindings::reflector::{DomObject, Reflector, reflect_dom_object}; +use dom::bindings::root::{JS, Root}; use dom::bindings::trace::JSTraceable; use dom::globalscope::GlobalScope; use dom_struct::dom_struct; diff --git a/components/script/dom/bindings/mod.rs b/components/script/dom/bindings/mod.rs index 5d0cd864dad7..f251f0bd364c 100644 --- a/components/script/dom/bindings/mod.rs +++ b/components/script/dom/bindings/mod.rs @@ -142,13 +142,13 @@ pub mod guard; pub mod inheritance; pub mod interface; pub mod iterable; -pub mod js; pub mod mozmap; pub mod namespace; pub mod num; pub mod proxyhandler; pub mod refcounted; pub mod reflector; +pub mod root; pub mod settings_stack; pub mod str; pub mod structuredclone; diff --git a/components/script/dom/bindings/refcounted.rs b/components/script/dom/bindings/refcounted.rs index 0a00148d6617..d2c1a484887d 100644 --- a/components/script/dom/bindings/refcounted.rs +++ b/components/script/dom/bindings/refcounted.rs @@ -25,8 +25,8 @@ use core::nonzero::NonZero; use dom::bindings::conversions::ToJSValConvertible; use dom::bindings::error::Error; -use dom::bindings::js::Root; use dom::bindings::reflector::{DomObject, Reflector}; +use dom::bindings::root::Root; use dom::bindings::trace::trace_reflector; use dom::promise::Promise; use js::jsapi::JSTracer; diff --git a/components/script/dom/bindings/reflector.rs b/components/script/dom/bindings/reflector.rs index 896cf74a34f9..356086ac1462 100644 --- a/components/script/dom/bindings/reflector.rs +++ b/components/script/dom/bindings/reflector.rs @@ -5,7 +5,7 @@ //! The `Reflector` struct. use dom::bindings::conversions::DerivedFrom; -use dom::bindings::js::Root; +use dom::bindings::root::Root; use dom::globalscope::GlobalScope; use js::jsapi::{HandleObject, JSContext, JSObject, Heap}; use std::default::Default; diff --git a/components/script/dom/bindings/js.rs b/components/script/dom/bindings/root.rs similarity index 100% rename from components/script/dom/bindings/js.rs rename to components/script/dom/bindings/root.rs diff --git a/components/script/dom/bindings/settings_stack.rs b/components/script/dom/bindings/settings_stack.rs index bf67bae5f3f8..73b74f7055d4 100644 --- a/components/script/dom/bindings/settings_stack.rs +++ b/components/script/dom/bindings/settings_stack.rs @@ -2,7 +2,7 @@ * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ -use dom::bindings::js::{JS, Root}; +use dom::bindings::root::{JS, Root}; use dom::bindings::trace::JSTraceable; use dom::globalscope::GlobalScope; use js::jsapi::GetScriptedCallerGlobal; diff --git a/components/script/dom/bindings/structuredclone.rs b/components/script/dom/bindings/structuredclone.rs index 5644784e10c3..e23d478e5a82 100644 --- a/components/script/dom/bindings/structuredclone.rs +++ b/components/script/dom/bindings/structuredclone.rs @@ -7,8 +7,8 @@ use dom::bindings::conversions::root_from_handleobject; use dom::bindings::error::{Error, Fallible}; -use dom::bindings::js::Root; use dom::bindings::reflector::DomObject; +use dom::bindings::root::Root; use dom::blob::{Blob, BlobImpl}; use dom::globalscope::GlobalScope; use js::jsapi::{Handle, HandleObject, HandleValue, MutableHandleValue, JSAutoCompartment, JSContext}; diff --git a/components/script/dom/bindings/trace.rs b/components/script/dom/bindings/trace.rs index cdb2fd425ace..40945fad3e3a 100644 --- a/components/script/dom/bindings/trace.rs +++ b/components/script/dom/bindings/trace.rs @@ -40,9 +40,9 @@ use devtools_traits::{CSSError, TimelineMarkerType, WorkerId}; use dom::abstractworker::SharedRt; use dom::bindings::cell::DOMRefCell; use dom::bindings::error::Error; -use dom::bindings::js::{JS, Root}; use dom::bindings::refcounted::{Trusted, TrustedPromise}; use dom::bindings::reflector::{DomObject, Reflector}; +use dom::bindings::root::{JS, Root}; use dom::bindings::str::{DOMString, USVString}; use dom::bindings::utils::WindowProxyHandler; use dom::document::PendingRestyle; diff --git a/components/script/dom/bindings/weakref.rs b/components/script/dom/bindings/weakref.rs index 7291405e5f65..61a50a240b1e 100644 --- a/components/script/dom/bindings/weakref.rs +++ b/components/script/dom/bindings/weakref.rs @@ -12,8 +12,8 @@ //! `WeakBox` itself is dropped too. use core::nonzero::NonZero; -use dom::bindings::js::Root; use dom::bindings::reflector::DomObject; +use dom::bindings::root::Root; use dom::bindings::trace::JSTraceable; use heapsize::HeapSizeOf; use js::jsapi::{JSTracer, JS_GetReservedSlot, JS_SetReservedSlot}; diff --git a/components/script/dom/blob.rs b/components/script/dom/blob.rs index 191ea6f84f7d..5bb9109118a4 100644 --- a/components/script/dom/blob.rs +++ b/components/script/dom/blob.rs @@ -7,8 +7,8 @@ use dom::bindings::codegen::Bindings::BlobBinding; use dom::bindings::codegen::Bindings::BlobBinding::BlobMethods; use dom::bindings::codegen::UnionTypes::BlobOrString; use dom::bindings::error::{Error, Fallible}; -use dom::bindings::js::{JS, Root}; use dom::bindings::reflector::{DomObject, Reflector, reflect_dom_object}; +use dom::bindings::root::{JS, Root}; use dom::bindings::str::DOMString; use dom::globalscope::GlobalScope; use dom_struct::dom_struct; diff --git a/components/script/dom/bluetooth.rs b/components/script/dom/bluetooth.rs index 12d363731ca8..d0a35547c988 100644 --- a/components/script/dom/bluetooth.rs +++ b/components/script/dom/bluetooth.rs @@ -18,9 +18,9 @@ use dom::bindings::codegen::Bindings::PermissionStatusBinding::{PermissionName, use dom::bindings::codegen::UnionTypes::StringOrUnsignedLong; use dom::bindings::error::Error::{self, Network, Security, Type}; use dom::bindings::error::Fallible; -use dom::bindings::js::{JS, Root}; use dom::bindings::refcounted::{Trusted, TrustedPromise}; use dom::bindings::reflector::{DomObject, reflect_dom_object}; +use dom::bindings::root::{JS, Root}; use dom::bindings::str::DOMString; use dom::bluetoothdevice::BluetoothDevice; use dom::bluetoothpermissionresult::BluetoothPermissionResult; diff --git a/components/script/dom/bluetoothadvertisingevent.rs b/components/script/dom/bluetoothadvertisingevent.rs index 604a1c820259..f1a00457d14d 100644 --- a/components/script/dom/bluetoothadvertisingevent.rs +++ b/components/script/dom/bluetoothadvertisingevent.rs @@ -7,8 +7,8 @@ use dom::bindings::codegen::Bindings::BluetoothAdvertisingEventBinding::Bluetoot use dom::bindings::codegen::Bindings::EventBinding::EventBinding::EventMethods; use dom::bindings::error::Fallible; use dom::bindings::inheritance::Castable; -use dom::bindings::js::{JS, Root, RootedReference}; use dom::bindings::reflector::reflect_dom_object; +use dom::bindings::root::{JS, Root, RootedReference}; use dom::bindings::str::DOMString; use dom::bluetoothdevice::BluetoothDevice; use dom::event::{Event, EventBubbles, EventCancelable}; diff --git a/components/script/dom/bluetoothcharacteristicproperties.rs b/components/script/dom/bluetoothcharacteristicproperties.rs index a477c130a2de..3afdf3d4e4cb 100644 --- a/components/script/dom/bluetoothcharacteristicproperties.rs +++ b/components/script/dom/bluetoothcharacteristicproperties.rs @@ -5,8 +5,8 @@ use dom::bindings::codegen::Bindings::BluetoothCharacteristicPropertiesBinding; use dom::bindings::codegen::Bindings::BluetoothCharacteristicPropertiesBinding:: BluetoothCharacteristicPropertiesMethods; -use dom::bindings::js::Root; use dom::bindings::reflector::{Reflector, reflect_dom_object}; +use dom::bindings::root::Root; use dom::globalscope::GlobalScope; use dom_struct::dom_struct; diff --git a/components/script/dom/bluetoothdevice.rs b/components/script/dom/bluetoothdevice.rs index 2e8e07503da0..d3ade32120bf 100644 --- a/components/script/dom/bluetoothdevice.rs +++ b/components/script/dom/bluetoothdevice.rs @@ -11,8 +11,8 @@ use dom::bindings::codegen::Bindings::BluetoothRemoteGATTServerBinding::Bluetoot use dom::bindings::error::Error; use dom::bindings::error::ErrorResult; use dom::bindings::inheritance::Castable; -use dom::bindings::js::{JS, MutNullableJS, Root}; use dom::bindings::reflector::{DomObject, reflect_dom_object}; +use dom::bindings::root::{JS, MutNullableJS, Root}; use dom::bindings::str::DOMString; use dom::bluetooth::{AsyncBluetoothListener, Bluetooth, response_async}; use dom::bluetoothcharacteristicproperties::BluetoothCharacteristicProperties; diff --git a/components/script/dom/bluetoothpermissionresult.rs b/components/script/dom/bluetoothpermissionresult.rs index cc766b854772..ad5ec2fa3a30 100644 --- a/components/script/dom/bluetoothpermissionresult.rs +++ b/components/script/dom/bluetoothpermissionresult.rs @@ -10,8 +10,8 @@ use dom::bindings::codegen::Bindings::PermissionStatusBinding::{PermissionName, use dom::bindings::codegen::Bindings::PermissionStatusBinding::PermissionStatusBinding::PermissionStatusMethods; use dom::bindings::codegen::Bindings::WindowBinding::WindowBinding::WindowMethods; use dom::bindings::error::Error; -use dom::bindings::js::{JS, Root}; use dom::bindings::reflector::{DomObject, reflect_dom_object}; +use dom::bindings::root::{JS, Root}; use dom::bindings::str::DOMString; use dom::bluetooth::{AsyncBluetoothListener, Bluetooth, AllowedBluetoothDevice}; use dom::bluetoothdevice::BluetoothDevice; diff --git a/components/script/dom/bluetoothremotegattcharacteristic.rs b/components/script/dom/bluetoothremotegattcharacteristic.rs index f54776d37a92..569eb5115387 100644 --- a/components/script/dom/bluetoothremotegattcharacteristic.rs +++ b/components/script/dom/bluetoothremotegattcharacteristic.rs @@ -14,8 +14,8 @@ use dom::bindings::codegen::Bindings::BluetoothRemoteGATTServerBinding::Bluetoot use dom::bindings::codegen::Bindings::BluetoothRemoteGATTServiceBinding::BluetoothRemoteGATTServiceMethods; use dom::bindings::error::Error::{self, InvalidModification, Network, NotSupported, Security}; use dom::bindings::inheritance::Castable; -use dom::bindings::js::{JS, Root}; use dom::bindings::reflector::{DomObject, reflect_dom_object}; +use dom::bindings::root::{JS, Root}; use dom::bindings::str::{ByteString, DOMString}; use dom::bluetooth::{AsyncBluetoothListener, get_gatt_children, response_async}; use dom::bluetoothcharacteristicproperties::BluetoothCharacteristicProperties; diff --git a/components/script/dom/bluetoothremotegattdescriptor.rs b/components/script/dom/bluetoothremotegattdescriptor.rs index d05194af1d20..fbe96c6963b1 100644 --- a/components/script/dom/bluetoothremotegattdescriptor.rs +++ b/components/script/dom/bluetoothremotegattdescriptor.rs @@ -12,8 +12,8 @@ use dom::bindings::codegen::Bindings::BluetoothRemoteGATTDescriptorBinding::Blue use dom::bindings::codegen::Bindings::BluetoothRemoteGATTServerBinding::BluetoothRemoteGATTServerMethods; use dom::bindings::codegen::Bindings::BluetoothRemoteGATTServiceBinding::BluetoothRemoteGATTServiceMethods; use dom::bindings::error::Error::{self, InvalidModification, Network, Security}; -use dom::bindings::js::{JS, Root}; use dom::bindings::reflector::{DomObject, Reflector, reflect_dom_object}; +use dom::bindings::root::{JS, Root}; use dom::bindings::str::{ByteString, DOMString}; use dom::bluetooth::{AsyncBluetoothListener, response_async}; use dom::bluetoothremotegattcharacteristic::{BluetoothRemoteGATTCharacteristic, MAXIMUM_ATTRIBUTE_LENGTH}; diff --git a/components/script/dom/bluetoothremotegattserver.rs b/components/script/dom/bluetoothremotegattserver.rs index 65e66edecd3f..7d533114e290 100644 --- a/components/script/dom/bluetoothremotegattserver.rs +++ b/components/script/dom/bluetoothremotegattserver.rs @@ -8,8 +8,8 @@ use dom::bindings::codegen::Bindings::BluetoothRemoteGATTServerBinding; use dom::bindings::codegen::Bindings::BluetoothRemoteGATTServerBinding::BluetoothRemoteGATTServerMethods; use dom::bindings::error::Error; use dom::bindings::error::ErrorResult; -use dom::bindings::js::{JS, Root}; use dom::bindings::reflector::{DomObject, Reflector, reflect_dom_object}; +use dom::bindings::root::{JS, Root}; use dom::bluetooth::{AsyncBluetoothListener, get_gatt_children, response_async}; use dom::bluetoothdevice::BluetoothDevice; use dom::bluetoothuuid::{BluetoothServiceUUID, BluetoothUUID}; diff --git a/components/script/dom/bluetoothremotegattservice.rs b/components/script/dom/bluetoothremotegattservice.rs index 6140d83c9f52..4d2f0cfdb834 100644 --- a/components/script/dom/bluetoothremotegattservice.rs +++ b/components/script/dom/bluetoothremotegattservice.rs @@ -7,8 +7,8 @@ use dom::bindings::codegen::Bindings::BluetoothRemoteGATTServerBinding::Bluetoot use dom::bindings::codegen::Bindings::BluetoothRemoteGATTServiceBinding; use dom::bindings::codegen::Bindings::BluetoothRemoteGATTServiceBinding::BluetoothRemoteGATTServiceMethods; use dom::bindings::error::Error; -use dom::bindings::js::{JS, Root}; use dom::bindings::reflector::reflect_dom_object; +use dom::bindings::root::{JS, Root}; use dom::bindings::str::DOMString; use dom::bluetooth::{AsyncBluetoothListener, get_gatt_children}; use dom::bluetoothdevice::BluetoothDevice; diff --git a/components/script/dom/canvasgradient.rs b/components/script/dom/canvasgradient.rs index e571e3afabfc..afa782b6e9d2 100644 --- a/components/script/dom/canvasgradient.rs +++ b/components/script/dom/canvasgradient.rs @@ -9,9 +9,9 @@ use dom::bindings::cell::DOMRefCell; use dom::bindings::codegen::Bindings::CanvasGradientBinding; use dom::bindings::codegen::Bindings::CanvasGradientBinding::CanvasGradientMethods; use dom::bindings::error::{Error, ErrorResult}; -use dom::bindings::js::Root; use dom::bindings::num::Finite; use dom::bindings::reflector::{Reflector, reflect_dom_object}; +use dom::bindings::root::Root; use dom::bindings::str::DOMString; use dom::globalscope::GlobalScope; use dom_struct::dom_struct; diff --git a/components/script/dom/canvaspattern.rs b/components/script/dom/canvaspattern.rs index 46bcbedcef0d..7adb6d21fbc7 100644 --- a/components/script/dom/canvaspattern.rs +++ b/components/script/dom/canvaspattern.rs @@ -4,8 +4,8 @@ use canvas_traits::canvas::{FillOrStrokeStyle, RepetitionStyle, SurfaceStyle}; use dom::bindings::codegen::Bindings::CanvasPatternBinding; -use dom::bindings::js::Root; use dom::bindings::reflector::{Reflector, reflect_dom_object}; +use dom::bindings::root::Root; use dom::canvasgradient::ToFillOrStrokeStyle; use dom::globalscope::GlobalScope; use dom_struct::dom_struct; diff --git a/components/script/dom/canvasrenderingcontext2d.rs b/components/script/dom/canvasrenderingcontext2d.rs index e6007c8b6eec..4e98345eb07a 100644 --- a/components/script/dom/canvasrenderingcontext2d.rs +++ b/components/script/dom/canvasrenderingcontext2d.rs @@ -21,9 +21,9 @@ use dom::bindings::codegen::Bindings::WindowBinding::WindowMethods; use dom::bindings::codegen::UnionTypes::StringOrCanvasGradientOrCanvasPattern; use dom::bindings::error::{Error, ErrorResult, Fallible}; use dom::bindings::inheritance::Castable; -use dom::bindings::js::{JS, LayoutJS, Root}; use dom::bindings::num::Finite; use dom::bindings::reflector::{DomObject, Reflector, reflect_dom_object}; +use dom::bindings::root::{JS, LayoutJS, Root}; use dom::bindings::str::DOMString; use dom::canvasgradient::{CanvasGradient, CanvasGradientStyle, ToFillOrStrokeStyle}; use dom::canvaspattern::CanvasPattern; diff --git a/components/script/dom/characterdata.rs b/components/script/dom/characterdata.rs index 747589ada5dd..9db97be00f6a 100644 --- a/components/script/dom/characterdata.rs +++ b/components/script/dom/characterdata.rs @@ -12,7 +12,7 @@ use dom::bindings::codegen::InheritTypes::{CharacterDataTypeId, NodeTypeId}; use dom::bindings::codegen::UnionTypes::NodeOrString; use dom::bindings::error::{Error, ErrorResult, Fallible}; use dom::bindings::inheritance::Castable; -use dom::bindings::js::{LayoutJS, Root}; +use dom::bindings::root::{LayoutJS, Root}; use dom::bindings::str::DOMString; use dom::comment::Comment; use dom::document::Document; diff --git a/components/script/dom/client.rs b/components/script/dom/client.rs index 7910ffc8dfa2..872b23196e6b 100644 --- a/components/script/dom/client.rs +++ b/components/script/dom/client.rs @@ -4,8 +4,8 @@ use dom::bindings::codegen::Bindings::ClientBinding::{ClientMethods, Wrap}; use dom::bindings::codegen::Bindings::ClientBinding::FrameType; -use dom::bindings::js::{Root, MutNullableJS}; use dom::bindings::reflector::{Reflector, reflect_dom_object}; +use dom::bindings::root::{Root, MutNullableJS}; use dom::bindings::str::{DOMString, USVString}; use dom::serviceworker::ServiceWorker; use dom::window::Window; diff --git a/components/script/dom/closeevent.rs b/components/script/dom/closeevent.rs index f052c0eff44d..8af7d5414c8a 100644 --- a/components/script/dom/closeevent.rs +++ b/components/script/dom/closeevent.rs @@ -7,8 +7,8 @@ use dom::bindings::codegen::Bindings::CloseEventBinding::CloseEventMethods; use dom::bindings::codegen::Bindings::EventBinding::EventMethods; use dom::bindings::error::Fallible; use dom::bindings::inheritance::Castable; -use dom::bindings::js::Root; use dom::bindings::reflector::reflect_dom_object; +use dom::bindings::root::Root; use dom::bindings::str::DOMString; use dom::event::{Event, EventBubbles, EventCancelable}; use dom::globalscope::GlobalScope; diff --git a/components/script/dom/comment.rs b/components/script/dom/comment.rs index ad5121326988..e6a5f42b3db4 100644 --- a/components/script/dom/comment.rs +++ b/components/script/dom/comment.rs @@ -5,7 +5,7 @@ use dom::bindings::codegen::Bindings::CommentBinding; use dom::bindings::codegen::Bindings::WindowBinding::WindowMethods; use dom::bindings::error::Fallible; -use dom::bindings::js::Root; +use dom::bindings::root::Root; use dom::bindings::str::DOMString; use dom::characterdata::CharacterData; use dom::document::Document; diff --git a/components/script/dom/compositionevent.rs b/components/script/dom/compositionevent.rs index c1f84386adec..3c29e5d1b26f 100644 --- a/components/script/dom/compositionevent.rs +++ b/components/script/dom/compositionevent.rs @@ -5,8 +5,8 @@ use dom::bindings::codegen::Bindings::CompositionEventBinding::{self, CompositionEventMethods}; use dom::bindings::codegen::Bindings::UIEventBinding::UIEventBinding::UIEventMethods; use dom::bindings::error::Fallible; -use dom::bindings::js::{Root, RootedReference}; use dom::bindings::reflector::reflect_dom_object; +use dom::bindings::root::{Root, RootedReference}; use dom::bindings::str::DOMString; use dom::uievent::UIEvent; use dom::window::Window; diff --git a/components/script/dom/create.rs b/components/script/dom/create.rs index 922757593f35..c62fc1c14c61 100644 --- a/components/script/dom/create.rs +++ b/components/script/dom/create.rs @@ -3,8 +3,8 @@ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ use dom::bindings::error::{report_pending_exception, throw_dom_exception}; -use dom::bindings::js::Root; use dom::bindings::reflector::DomObject; +use dom::bindings::root::Root; use dom::customelementregistry::{is_valid_custom_element_name, upgrade_element}; use dom::document::Document; use dom::element::{CustomElementCreationMode, CustomElementState, Element, ElementCreator}; diff --git a/components/script/dom/crypto.rs b/components/script/dom/crypto.rs index 986e1b0ab09d..117f1ff2b1ff 100644 --- a/components/script/dom/crypto.rs +++ b/components/script/dom/crypto.rs @@ -7,8 +7,8 @@ use dom::bindings::cell::DOMRefCell; use dom::bindings::codegen::Bindings::CryptoBinding; use dom::bindings::codegen::Bindings::CryptoBinding::CryptoMethods; use dom::bindings::error::{Error, Fallible}; -use dom::bindings::js::Root; use dom::bindings::reflector::{Reflector, reflect_dom_object}; +use dom::bindings::root::Root; use dom::globalscope::GlobalScope; use dom_struct::dom_struct; use js::jsapi::{JSContext, JSObject}; diff --git a/components/script/dom/cssfontfacerule.rs b/components/script/dom/cssfontfacerule.rs index 366a28c84d12..1a72f11a5fa7 100644 --- a/components/script/dom/cssfontfacerule.rs +++ b/components/script/dom/cssfontfacerule.rs @@ -3,8 +3,8 @@ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ use dom::bindings::codegen::Bindings::CSSFontFaceRuleBinding; -use dom::bindings::js::Root; use dom::bindings::reflector::reflect_dom_object; +use dom::bindings::root::Root; use dom::bindings::str::DOMString; use dom::cssrule::{CSSRule, SpecificCSSRule}; use dom::cssstylesheet::CSSStyleSheet; diff --git a/components/script/dom/cssgroupingrule.rs b/components/script/dom/cssgroupingrule.rs index 580c6f05b0da..f3a462237528 100644 --- a/components/script/dom/cssgroupingrule.rs +++ b/components/script/dom/cssgroupingrule.rs @@ -5,8 +5,8 @@ use dom::bindings::codegen::Bindings::CSSGroupingRuleBinding::CSSGroupingRuleMethods; use dom::bindings::error::{ErrorResult, Fallible}; use dom::bindings::inheritance::Castable; -use dom::bindings::js::{MutNullableJS, Root}; use dom::bindings::reflector::DomObject; +use dom::bindings::root::{MutNullableJS, Root}; use dom::bindings::str::DOMString; use dom::cssrule::CSSRule; use dom::cssrulelist::{CSSRuleList, RulesSource}; diff --git a/components/script/dom/cssimportrule.rs b/components/script/dom/cssimportrule.rs index 1467019cb840..e0f913bb81e6 100644 --- a/components/script/dom/cssimportrule.rs +++ b/components/script/dom/cssimportrule.rs @@ -3,8 +3,8 @@ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ use dom::bindings::codegen::Bindings::CSSImportRuleBinding; -use dom::bindings::js::Root; use dom::bindings::reflector::reflect_dom_object; +use dom::bindings::root::Root; use dom::bindings::str::DOMString; use dom::cssrule::{CSSRule, SpecificCSSRule}; use dom::cssstylesheet::CSSStyleSheet; diff --git a/components/script/dom/csskeyframerule.rs b/components/script/dom/csskeyframerule.rs index e46152700cee..6bfe052d775c 100644 --- a/components/script/dom/csskeyframerule.rs +++ b/components/script/dom/csskeyframerule.rs @@ -4,8 +4,8 @@ use dom::bindings::codegen::Bindings::CSSKeyframeRuleBinding::{self, CSSKeyframeRuleMethods}; use dom::bindings::inheritance::Castable; -use dom::bindings::js::{JS, MutNullableJS, Root}; use dom::bindings::reflector::{DomObject, reflect_dom_object}; +use dom::bindings::root::{JS, MutNullableJS, Root}; use dom::bindings::str::DOMString; use dom::cssrule::{CSSRule, SpecificCSSRule}; use dom::cssstyledeclaration::{CSSModificationAccess, CSSStyleDeclaration, CSSStyleOwner}; diff --git a/components/script/dom/csskeyframesrule.rs b/components/script/dom/csskeyframesrule.rs index 0a5e0e35a7d1..d699f15c0a07 100644 --- a/components/script/dom/csskeyframesrule.rs +++ b/components/script/dom/csskeyframesrule.rs @@ -7,8 +7,8 @@ use dom::bindings::codegen::Bindings::CSSKeyframesRuleBinding; use dom::bindings::codegen::Bindings::CSSKeyframesRuleBinding::CSSKeyframesRuleMethods; use dom::bindings::error::ErrorResult; use dom::bindings::inheritance::Castable; -use dom::bindings::js::{MutNullableJS, Root}; use dom::bindings::reflector::{DomObject, reflect_dom_object}; +use dom::bindings::root::{MutNullableJS, Root}; use dom::bindings::str::DOMString; use dom::csskeyframerule::CSSKeyframeRule; use dom::cssrule::{CSSRule, SpecificCSSRule}; diff --git a/components/script/dom/cssmediarule.rs b/components/script/dom/cssmediarule.rs index dd921d9f787b..1dc4ce69a116 100644 --- a/components/script/dom/cssmediarule.rs +++ b/components/script/dom/cssmediarule.rs @@ -6,8 +6,8 @@ use cssparser::{Parser, ParserInput}; use dom::bindings::codegen::Bindings::CSSMediaRuleBinding; use dom::bindings::codegen::Bindings::CSSMediaRuleBinding::CSSMediaRuleMethods; use dom::bindings::codegen::Bindings::WindowBinding::WindowBinding::WindowMethods; -use dom::bindings::js::{MutNullableJS, Root}; use dom::bindings::reflector::{DomObject, reflect_dom_object}; +use dom::bindings::root::{MutNullableJS, Root}; use dom::bindings::str::DOMString; use dom::cssconditionrule::CSSConditionRule; use dom::cssrule::SpecificCSSRule; diff --git a/components/script/dom/cssnamespacerule.rs b/components/script/dom/cssnamespacerule.rs index e7cecb2ebe78..b64b46ec4e2c 100644 --- a/components/script/dom/cssnamespacerule.rs +++ b/components/script/dom/cssnamespacerule.rs @@ -4,8 +4,8 @@ use dom::bindings::codegen::Bindings::CSSNamespaceRuleBinding; use dom::bindings::codegen::Bindings::CSSNamespaceRuleBinding::CSSNamespaceRuleMethods; -use dom::bindings::js::Root; use dom::bindings::reflector::reflect_dom_object; +use dom::bindings::root::Root; use dom::bindings::str::DOMString; use dom::cssrule::{CSSRule, SpecificCSSRule}; use dom::cssstylesheet::CSSStyleSheet; diff --git a/components/script/dom/cssrule.rs b/components/script/dom/cssrule.rs index 40bd087899b8..36c6b2187a22 100644 --- a/components/script/dom/cssrule.rs +++ b/components/script/dom/cssrule.rs @@ -4,8 +4,8 @@ use dom::bindings::codegen::Bindings::CSSRuleBinding::CSSRuleMethods; use dom::bindings::inheritance::Castable; -use dom::bindings::js::{JS, Root}; use dom::bindings::reflector::Reflector; +use dom::bindings::root::{JS, Root}; use dom::bindings::str::DOMString; use dom::cssfontfacerule::CSSFontFaceRule; use dom::cssimportrule::CSSImportRule; diff --git a/components/script/dom/cssrulelist.rs b/components/script/dom/cssrulelist.rs index 63420f266081..b20156060d39 100644 --- a/components/script/dom/cssrulelist.rs +++ b/components/script/dom/cssrulelist.rs @@ -6,8 +6,8 @@ use dom::bindings::cell::DOMRefCell; use dom::bindings::codegen::Bindings::CSSRuleListBinding; use dom::bindings::codegen::Bindings::CSSRuleListBinding::CSSRuleListMethods; use dom::bindings::error::{Error, ErrorResult, Fallible}; -use dom::bindings::js::{JS, MutNullableJS, Root}; use dom::bindings::reflector::{DomObject, Reflector, reflect_dom_object}; +use dom::bindings::root::{JS, MutNullableJS, Root}; use dom::csskeyframerule::CSSKeyframeRule; use dom::cssrule::CSSRule; use dom::cssstylesheet::CSSStyleSheet; diff --git a/components/script/dom/cssstyledeclaration.rs b/components/script/dom/cssstyledeclaration.rs index 5aea41c1b36c..3230f9e920f9 100644 --- a/components/script/dom/cssstyledeclaration.rs +++ b/components/script/dom/cssstyledeclaration.rs @@ -6,8 +6,8 @@ use dom::bindings::codegen::Bindings::CSSStyleDeclarationBinding::{self, CSSStyl use dom::bindings::codegen::Bindings::WindowBinding::WindowMethods; use dom::bindings::error::{Error, ErrorResult, Fallible}; use dom::bindings::inheritance::Castable; -use dom::bindings::js::{JS, Root}; use dom::bindings::reflector::{DomObject, Reflector, reflect_dom_object}; +use dom::bindings::root::{JS, Root}; use dom::bindings::str::DOMString; use dom::cssrule::CSSRule; use dom::element::Element; diff --git a/components/script/dom/cssstylerule.rs b/components/script/dom/cssstylerule.rs index 42e56a5e8fcf..4a61905bfa19 100644 --- a/components/script/dom/cssstylerule.rs +++ b/components/script/dom/cssstylerule.rs @@ -7,8 +7,8 @@ use cssparser::ToCss; use dom::bindings::codegen::Bindings::CSSStyleRuleBinding::{self, CSSStyleRuleMethods}; use dom::bindings::codegen::Bindings::WindowBinding::WindowBinding::WindowMethods; use dom::bindings::inheritance::Castable; -use dom::bindings::js::{JS, MutNullableJS, Root}; use dom::bindings::reflector::{DomObject, reflect_dom_object}; +use dom::bindings::root::{JS, MutNullableJS, Root}; use dom::bindings::str::DOMString; use dom::cssrule::{CSSRule, SpecificCSSRule}; use dom::cssstyledeclaration::{CSSModificationAccess, CSSStyleDeclaration, CSSStyleOwner}; diff --git a/components/script/dom/cssstylesheet.rs b/components/script/dom/cssstylesheet.rs index 7a1634aa7340..92434022fdd9 100644 --- a/components/script/dom/cssstylesheet.rs +++ b/components/script/dom/cssstylesheet.rs @@ -6,8 +6,8 @@ use dom::bindings::codegen::Bindings::CSSStyleSheetBinding; use dom::bindings::codegen::Bindings::CSSStyleSheetBinding::CSSStyleSheetMethods; use dom::bindings::codegen::Bindings::WindowBinding::WindowBinding::WindowMethods; use dom::bindings::error::{Error, ErrorResult, Fallible}; -use dom::bindings::js::{JS, MutNullableJS, Root}; use dom::bindings::reflector::{reflect_dom_object, DomObject}; +use dom::bindings::root::{JS, MutNullableJS, Root}; use dom::bindings::str::DOMString; use dom::cssrulelist::{CSSRuleList, RulesSource}; use dom::element::Element; diff --git a/components/script/dom/cssstylevalue.rs b/components/script/dom/cssstylevalue.rs index adc70ed79722..a2dd60d87883 100644 --- a/components/script/dom/cssstylevalue.rs +++ b/components/script/dom/cssstylevalue.rs @@ -6,9 +6,9 @@ use cssparser::Parser; use cssparser::ParserInput; use dom::bindings::codegen::Bindings::CSSStyleValueBinding::CSSStyleValueMethods; use dom::bindings::codegen::Bindings::CSSStyleValueBinding::Wrap; -use dom::bindings::js::Root; use dom::bindings::reflector::Reflector; use dom::bindings::reflector::reflect_dom_object; +use dom::bindings::root::Root; use dom::bindings::str::DOMString; use dom::globalscope::GlobalScope; use dom_struct::dom_struct; diff --git a/components/script/dom/csssupportsrule.rs b/components/script/dom/csssupportsrule.rs index 5971eb6a009f..22466c859817 100644 --- a/components/script/dom/csssupportsrule.rs +++ b/components/script/dom/csssupportsrule.rs @@ -5,8 +5,8 @@ use cssparser::{Parser, ParserInput}; use dom::bindings::codegen::Bindings::CSSSupportsRuleBinding; use dom::bindings::codegen::Bindings::WindowBinding::WindowBinding::WindowMethods; -use dom::bindings::js::Root; use dom::bindings::reflector::{DomObject, reflect_dom_object}; +use dom::bindings::root::Root; use dom::bindings::str::DOMString; use dom::cssconditionrule::CSSConditionRule; use dom::cssrule::SpecificCSSRule; diff --git a/components/script/dom/cssviewportrule.rs b/components/script/dom/cssviewportrule.rs index c9acead9bd2d..47528100e83b 100644 --- a/components/script/dom/cssviewportrule.rs +++ b/components/script/dom/cssviewportrule.rs @@ -3,8 +3,8 @@ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ use dom::bindings::codegen::Bindings::CSSViewportRuleBinding; -use dom::bindings::js::Root; use dom::bindings::reflector::reflect_dom_object; +use dom::bindings::root::Root; use dom::bindings::str::DOMString; use dom::cssrule::{CSSRule, SpecificCSSRule}; use dom::cssstylesheet::CSSStyleSheet; diff --git a/components/script/dom/customelementregistry.rs b/components/script/dom/customelementregistry.rs index b4ad9365f4f6..62d54548755d 100644 --- a/components/script/dom/customelementregistry.rs +++ b/components/script/dom/customelementregistry.rs @@ -13,8 +13,8 @@ use dom::bindings::codegen::Bindings::WindowBinding::WindowBinding::WindowMethod use dom::bindings::conversions::{ConversionResult, FromJSValConvertible, StringificationBehavior}; use dom::bindings::error::{Error, ErrorResult, Fallible, report_pending_exception, throw_dom_exception}; use dom::bindings::inheritance::Castable; -use dom::bindings::js::{JS, Root}; use dom::bindings::reflector::{DomObject, Reflector, reflect_dom_object}; +use dom::bindings::root::{JS, Root}; use dom::bindings::str::DOMString; use dom::document::Document; use dom::domexception::{DOMErrorName, DOMException}; diff --git a/components/script/dom/customevent.rs b/components/script/dom/customevent.rs index 7b522cde3ed0..938ef8ed4f8a 100644 --- a/components/script/dom/customevent.rs +++ b/components/script/dom/customevent.rs @@ -7,8 +7,8 @@ use dom::bindings::codegen::Bindings::CustomEventBinding::CustomEventMethods; use dom::bindings::codegen::Bindings::EventBinding::EventMethods; use dom::bindings::error::Fallible; use dom::bindings::inheritance::Castable; -use dom::bindings::js::Root; use dom::bindings::reflector::reflect_dom_object; +use dom::bindings::root::Root; use dom::bindings::str::DOMString; use dom::bindings::trace::RootedTraceableBox; use dom::event::Event; diff --git a/components/script/dom/dedicatedworkerglobalscope.rs b/components/script/dom/dedicatedworkerglobalscope.rs index 46093a7bb7f6..b492bf9f6570 100644 --- a/components/script/dom/dedicatedworkerglobalscope.rs +++ b/components/script/dom/dedicatedworkerglobalscope.rs @@ -11,8 +11,8 @@ use dom::bindings::codegen::Bindings::DedicatedWorkerGlobalScopeBinding; use dom::bindings::codegen::Bindings::DedicatedWorkerGlobalScopeBinding::DedicatedWorkerGlobalScopeMethods; use dom::bindings::error::{ErrorInfo, ErrorResult}; use dom::bindings::inheritance::Castable; -use dom::bindings::js::{Root, RootCollection}; use dom::bindings::reflector::DomObject; +use dom::bindings::root::{Root, RootCollection}; use dom::bindings::str::DOMString; use dom::bindings::structuredclone::StructuredCloneData; use dom::errorevent::ErrorEvent; diff --git a/components/script/dom/dissimilaroriginlocation.rs b/components/script/dom/dissimilaroriginlocation.rs index 7ea2e3efc3cd..34dc8b91fd96 100644 --- a/components/script/dom/dissimilaroriginlocation.rs +++ b/components/script/dom/dissimilaroriginlocation.rs @@ -5,9 +5,9 @@ use dom::bindings::codegen::Bindings::DissimilarOriginLocationBinding; use dom::bindings::codegen::Bindings::DissimilarOriginLocationBinding::DissimilarOriginLocationMethods; use dom::bindings::error::{Error, ErrorResult, Fallible}; -use dom::bindings::js::{JS, Root}; use dom::bindings::reflector::Reflector; use dom::bindings::reflector::reflect_dom_object; +use dom::bindings::root::{JS, Root}; use dom::bindings::str::DOMString; use dom::bindings::str::USVString; use dom::dissimilaroriginwindow::DissimilarOriginWindow; diff --git a/components/script/dom/dissimilaroriginwindow.rs b/components/script/dom/dissimilaroriginwindow.rs index 6b0745a72e53..f6979e672b51 100644 --- a/components/script/dom/dissimilaroriginwindow.rs +++ b/components/script/dom/dissimilaroriginwindow.rs @@ -6,7 +6,7 @@ use dom::bindings::codegen::Bindings::DissimilarOriginWindowBinding; use dom::bindings::codegen::Bindings::DissimilarOriginWindowBinding::DissimilarOriginWindowMethods; use dom::bindings::error::{Error, ErrorResult}; use dom::bindings::inheritance::Castable; -use dom::bindings::js::{JS, MutNullableJS, Root}; +use dom::bindings::root::{JS, MutNullableJS, Root}; use dom::bindings::str::DOMString; use dom::bindings::structuredclone::StructuredCloneData; use dom::dissimilaroriginlocation::DissimilarOriginLocation; diff --git a/components/script/dom/document.rs b/components/script/dom/document.rs index bccfe5a76b33..7937ba7729d8 100644 --- a/components/script/dom/document.rs +++ b/components/script/dom/document.rs @@ -24,11 +24,10 @@ use dom::bindings::codegen::Bindings::WindowBinding::{FrameRequestCallback, Scro use dom::bindings::codegen::UnionTypes::NodeOrString; use dom::bindings::error::{Error, ErrorResult, Fallible}; use dom::bindings::inheritance::{Castable, ElementTypeId, HTMLElementTypeId, NodeTypeId}; -use dom::bindings::js::{JS, LayoutJS, MutNullableJS, Root}; -use dom::bindings::js::RootedReference; use dom::bindings::num::Finite; use dom::bindings::refcounted::{Trusted, TrustedPromise}; use dom::bindings::reflector::{DomObject, reflect_dom_object}; +use dom::bindings::root::{JS, LayoutJS, MutNullableJS, Root, RootedReference}; use dom::bindings::str::{DOMString, USVString}; use dom::bindings::xmlname::{namespace_from_domstring, validate_and_extract, xml_name_type}; use dom::bindings::xmlname::XMLName::InvalidXMLName; diff --git a/components/script/dom/documentfragment.rs b/components/script/dom/documentfragment.rs index 6f2a123dd06c..f43d93f85176 100644 --- a/components/script/dom/documentfragment.rs +++ b/components/script/dom/documentfragment.rs @@ -8,7 +8,7 @@ use dom::bindings::codegen::Bindings::WindowBinding::WindowMethods; use dom::bindings::codegen::UnionTypes::NodeOrString; use dom::bindings::error::{ErrorResult, Fallible}; use dom::bindings::inheritance::Castable; -use dom::bindings::js::Root; +use dom::bindings::root::Root; use dom::bindings::str::DOMString; use dom::document::Document; use dom::element::Element; diff --git a/components/script/dom/documenttype.rs b/components/script/dom/documenttype.rs index 2b03ce2e07bf..4eb83c39c916 100644 --- a/components/script/dom/documenttype.rs +++ b/components/script/dom/documenttype.rs @@ -7,7 +7,7 @@ use dom::bindings::codegen::Bindings::DocumentTypeBinding::DocumentTypeMethods; use dom::bindings::codegen::UnionTypes::NodeOrString; use dom::bindings::error::ErrorResult; use dom::bindings::inheritance::Castable; -use dom::bindings::js::Root; +use dom::bindings::root::Root; use dom::bindings::str::DOMString; use dom::document::Document; use dom::node::Node; diff --git a/components/script/dom/domexception.rs b/components/script/dom/domexception.rs index 63be8dc83e80..933818e1a4fc 100644 --- a/components/script/dom/domexception.rs +++ b/components/script/dom/domexception.rs @@ -5,8 +5,8 @@ use dom::bindings::codegen::Bindings::DOMExceptionBinding; use dom::bindings::codegen::Bindings::DOMExceptionBinding::DOMExceptionConstants; use dom::bindings::codegen::Bindings::DOMExceptionBinding::DOMExceptionMethods; -use dom::bindings::js::Root; use dom::bindings::reflector::{Reflector, reflect_dom_object}; +use dom::bindings::root::Root; use dom::bindings::str::DOMString; use dom::globalscope::GlobalScope; use dom_struct::dom_struct; diff --git a/components/script/dom/domimplementation.rs b/components/script/dom/domimplementation.rs index 5b56242e14bc..1346c52690f6 100644 --- a/components/script/dom/domimplementation.rs +++ b/components/script/dom/domimplementation.rs @@ -9,8 +9,8 @@ use dom::bindings::codegen::Bindings::DocumentBinding::{DocumentMethods, Element use dom::bindings::codegen::Bindings::NodeBinding::NodeMethods; use dom::bindings::error::Fallible; use dom::bindings::inheritance::Castable; -use dom::bindings::js::{JS, Root}; use dom::bindings::reflector::{Reflector, reflect_dom_object}; +use dom::bindings::root::{JS, Root}; use dom::bindings::str::DOMString; use dom::bindings::xmlname::{namespace_from_domstring, validate_qualified_name}; use dom::document::{Document, HasBrowsingContext, IsHTMLDocument}; diff --git a/components/script/dom/dommatrix.rs b/components/script/dom/dommatrix.rs index 3b262650bac8..869dd38d59b2 100644 --- a/components/script/dom/dommatrix.rs +++ b/components/script/dom/dommatrix.rs @@ -6,8 +6,8 @@ use dom::bindings::codegen::Bindings::DOMMatrixBinding::{Wrap, DOMMatrixMethods, use dom::bindings::codegen::Bindings::DOMMatrixReadOnlyBinding::DOMMatrixReadOnlyMethods; use dom::bindings::error::Fallible; use dom::bindings::inheritance::Castable; -use dom::bindings::js::Root; use dom::bindings::reflector::reflect_dom_object; +use dom::bindings::root::Root; use dom::dommatrixreadonly::{dommatrixinit_to_matrix, DOMMatrixReadOnly, entries_to_matrix}; use dom::globalscope::GlobalScope; use dom_struct::dom_struct; diff --git a/components/script/dom/dommatrixreadonly.rs b/components/script/dom/dommatrixreadonly.rs index b31ce329ce2a..df4e0d74dfe9 100644 --- a/components/script/dom/dommatrixreadonly.rs +++ b/components/script/dom/dommatrixreadonly.rs @@ -8,8 +8,8 @@ use dom::bindings::codegen::Bindings::DOMMatrixReadOnlyBinding::{DOMMatrixReadOn use dom::bindings::codegen::Bindings::DOMPointBinding::DOMPointInit; use dom::bindings::error; use dom::bindings::error::Fallible; -use dom::bindings::js::Root; use dom::bindings::reflector::{reflect_dom_object, DomObject, Reflector}; +use dom::bindings::root::Root; use dom::dommatrix::DOMMatrix; use dom::dompoint::DOMPoint; use dom::globalscope::GlobalScope; diff --git a/components/script/dom/domparser.rs b/components/script/dom/domparser.rs index 4af6ebf8c60b..f82dea49f80a 100644 --- a/components/script/dom/domparser.rs +++ b/components/script/dom/domparser.rs @@ -12,8 +12,8 @@ use dom::bindings::codegen::Bindings::DOMParserBinding::SupportedType::Text_xml; use dom::bindings::codegen::Bindings::DocumentBinding::DocumentReadyState; use dom::bindings::codegen::Bindings::WindowBinding::WindowMethods; use dom::bindings::error::Fallible; -use dom::bindings::js::{JS, Root}; use dom::bindings::reflector::{Reflector, reflect_dom_object}; +use dom::bindings::root::{JS, Root}; use dom::bindings::str::DOMString; use dom::document::{Document, HasBrowsingContext, IsHTMLDocument}; use dom::document::DocumentSource; diff --git a/components/script/dom/dompoint.rs b/components/script/dom/dompoint.rs index 0a2ed9cec5dd..44fe7a99ea7f 100644 --- a/components/script/dom/dompoint.rs +++ b/components/script/dom/dompoint.rs @@ -5,8 +5,8 @@ use dom::bindings::codegen::Bindings::DOMPointBinding::{DOMPointInit, DOMPointMethods, Wrap}; use dom::bindings::codegen::Bindings::DOMPointReadOnlyBinding::DOMPointReadOnlyMethods; use dom::bindings::error::Fallible; -use dom::bindings::js::Root; use dom::bindings::reflector::reflect_dom_object; +use dom::bindings::root::Root; use dom::dompointreadonly::{DOMPointReadOnly, DOMPointWriteMethods}; use dom::globalscope::GlobalScope; use dom_struct::dom_struct; diff --git a/components/script/dom/dompointreadonly.rs b/components/script/dom/dompointreadonly.rs index 7180207c9308..ae9cab6f3f97 100644 --- a/components/script/dom/dompointreadonly.rs +++ b/components/script/dom/dompointreadonly.rs @@ -4,8 +4,8 @@ use dom::bindings::codegen::Bindings::DOMPointReadOnlyBinding::{DOMPointReadOnlyMethods, Wrap}; use dom::bindings::error::Fallible; -use dom::bindings::js::Root; use dom::bindings::reflector::{Reflector, reflect_dom_object}; +use dom::bindings::root::Root; use dom::globalscope::GlobalScope; use dom_struct::dom_struct; use std::cell::Cell; diff --git a/components/script/dom/domquad.rs b/components/script/dom/domquad.rs index 8c665731f847..b6c186d05dbb 100644 --- a/components/script/dom/domquad.rs +++ b/components/script/dom/domquad.rs @@ -6,8 +6,8 @@ use dom::bindings::codegen::Bindings::DOMPointBinding::{DOMPointInit, DOMPointMe use dom::bindings::codegen::Bindings::DOMQuadBinding::{DOMQuadInit, DOMQuadMethods, Wrap}; use dom::bindings::codegen::Bindings::DOMRectReadOnlyBinding::DOMRectInit; use dom::bindings::error::Fallible; -use dom::bindings::js::{Root, JS}; use dom::bindings::reflector::{DomObject, Reflector, reflect_dom_object}; +use dom::bindings::root::{Root, JS}; use dom::dompoint::DOMPoint; use dom::domrect::DOMRect; use dom::globalscope::GlobalScope; diff --git a/components/script/dom/domrect.rs b/components/script/dom/domrect.rs index 3201e6c49efa..5cad05c23f78 100644 --- a/components/script/dom/domrect.rs +++ b/components/script/dom/domrect.rs @@ -6,8 +6,8 @@ use dom::bindings::codegen::Bindings::DOMRectBinding; use dom::bindings::codegen::Bindings::DOMRectBinding::DOMRectMethods; use dom::bindings::codegen::Bindings::DOMRectReadOnlyBinding::DOMRectReadOnlyMethods; use dom::bindings::error::Fallible; -use dom::bindings::js::Root; use dom::bindings::reflector::reflect_dom_object; +use dom::bindings::root::Root; use dom::domrectreadonly::DOMRectReadOnly; use dom::globalscope::GlobalScope; use dom_struct::dom_struct; diff --git a/components/script/dom/domrectreadonly.rs b/components/script/dom/domrectreadonly.rs index f5e08a4fcb78..7427cf22b8dd 100644 --- a/components/script/dom/domrectreadonly.rs +++ b/components/script/dom/domrectreadonly.rs @@ -4,8 +4,8 @@ use dom::bindings::codegen::Bindings::DOMRectReadOnlyBinding::{DOMRectReadOnlyMethods, Wrap}; use dom::bindings::error::Fallible; -use dom::bindings::js::Root; use dom::bindings::reflector::{Reflector, reflect_dom_object}; +use dom::bindings::root::Root; use dom::globalscope::GlobalScope; use dom_struct::dom_struct; use std::cell::Cell; diff --git a/components/script/dom/domstringmap.rs b/components/script/dom/domstringmap.rs index d529ca25cf8b..50c81c9d3b5d 100644 --- a/components/script/dom/domstringmap.rs +++ b/components/script/dom/domstringmap.rs @@ -5,8 +5,8 @@ use dom::bindings::codegen::Bindings::DOMStringMapBinding; use dom::bindings::codegen::Bindings::DOMStringMapBinding::DOMStringMapMethods; use dom::bindings::error::ErrorResult; -use dom::bindings::js::{JS, Root}; use dom::bindings::reflector::{Reflector, reflect_dom_object}; +use dom::bindings::root::{JS, Root}; use dom::bindings::str::DOMString; use dom::htmlelement::HTMLElement; use dom::node::window_from_node; diff --git a/components/script/dom/domtokenlist.rs b/components/script/dom/domtokenlist.rs index c3834ceeddd5..16523a489fc9 100644 --- a/components/script/dom/domtokenlist.rs +++ b/components/script/dom/domtokenlist.rs @@ -6,8 +6,8 @@ use dom::attr::Attr; use dom::bindings::codegen::Bindings::DOMTokenListBinding; use dom::bindings::codegen::Bindings::DOMTokenListBinding::DOMTokenListMethods; use dom::bindings::error::{Error, ErrorResult, Fallible}; -use dom::bindings::js::{JS, Root}; use dom::bindings::reflector::{Reflector, reflect_dom_object}; +use dom::bindings::root::{JS, Root}; use dom::bindings::str::DOMString; use dom::element::Element; use dom::node::window_from_node; diff --git a/components/script/dom/element.rs b/components/script/dom/element.rs index 0fe36814b335..d62bd03896b5 100644 --- a/components/script/dom/element.rs +++ b/components/script/dom/element.rs @@ -22,10 +22,9 @@ use dom::bindings::codegen::UnionTypes::NodeOrString; use dom::bindings::conversions::DerivedFrom; use dom::bindings::error::{Error, ErrorResult, Fallible}; use dom::bindings::inheritance::{Castable, ElementTypeId, HTMLElementTypeId, NodeTypeId}; -use dom::bindings::js::{JS, LayoutJS, MutNullableJS}; -use dom::bindings::js::{Root, RootedReference}; use dom::bindings::refcounted::{Trusted, TrustedPromise}; use dom::bindings::reflector::DomObject; +use dom::bindings::root::{JS, LayoutJS, MutNullableJS, Root, RootedReference}; use dom::bindings::str::DOMString; use dom::bindings::xmlname::{namespace_from_domstring, validate_and_extract, xml_name_type}; use dom::bindings::xmlname::XMLName::InvalidXMLName; diff --git a/components/script/dom/errorevent.rs b/components/script/dom/errorevent.rs index 170a979d9969..c3f4ac95525c 100644 --- a/components/script/dom/errorevent.rs +++ b/components/script/dom/errorevent.rs @@ -8,8 +8,8 @@ use dom::bindings::codegen::Bindings::ErrorEventBinding::ErrorEventMethods; use dom::bindings::codegen::Bindings::EventBinding::EventMethods; use dom::bindings::error::Fallible; use dom::bindings::inheritance::Castable; -use dom::bindings::js::Root; use dom::bindings::reflector::reflect_dom_object; +use dom::bindings::root::Root; use dom::bindings::str::DOMString; use dom::bindings::trace::RootedTraceableBox; use dom::event::{Event, EventBubbles, EventCancelable}; diff --git a/components/script/dom/event.rs b/components/script/dom/event.rs index cead9f74df9b..7dfd9e80409b 100644 --- a/components/script/dom/event.rs +++ b/components/script/dom/event.rs @@ -9,9 +9,9 @@ use dom::bindings::codegen::Bindings::EventBinding; use dom::bindings::codegen::Bindings::EventBinding::{EventConstants, EventMethods}; use dom::bindings::error::Fallible; use dom::bindings::inheritance::Castable; -use dom::bindings::js::{JS, MutNullableJS, Root, RootedReference}; use dom::bindings::refcounted::Trusted; use dom::bindings::reflector::{DomObject, Reflector, reflect_dom_object}; +use dom::bindings::root::{JS, MutNullableJS, Root, RootedReference}; use dom::bindings::str::DOMString; use dom::document::Document; use dom::eventtarget::{CompiledEventListener, EventTarget, ListenerPhase}; diff --git a/components/script/dom/eventsource.rs b/components/script/dom/eventsource.rs index 07f5c3b45008..01f25ec281c9 100644 --- a/components/script/dom/eventsource.rs +++ b/components/script/dom/eventsource.rs @@ -6,9 +6,9 @@ use dom::bindings::cell::DOMRefCell; use dom::bindings::codegen::Bindings::EventSourceBinding::{EventSourceInit, EventSourceMethods, Wrap}; use dom::bindings::error::{Error, Fallible}; use dom::bindings::inheritance::Castable; -use dom::bindings::js::Root; use dom::bindings::refcounted::Trusted; use dom::bindings::reflector::{DomObject, reflect_dom_object}; +use dom::bindings::root::Root; use dom::bindings::str::DOMString; use dom::event::Event; use dom::eventtarget::EventTarget; diff --git a/components/script/dom/eventtarget.rs b/components/script/dom/eventtarget.rs index eaab9f79d9b8..ed9ec8603c1c 100644 --- a/components/script/dom/eventtarget.rs +++ b/components/script/dom/eventtarget.rs @@ -17,8 +17,8 @@ use dom::bindings::codegen::Bindings::WindowBinding::WindowMethods; use dom::bindings::codegen::UnionTypes::EventOrString; use dom::bindings::error::{Error, Fallible, report_pending_exception}; use dom::bindings::inheritance::Castable; -use dom::bindings::js::Root; use dom::bindings::reflector::{DomObject, Reflector}; +use dom::bindings::root::Root; use dom::bindings::str::DOMString; use dom::element::Element; use dom::errorevent::ErrorEvent; diff --git a/components/script/dom/extendableevent.rs b/components/script/dom/extendableevent.rs index 553ed7a1fe40..50ccda70eb76 100644 --- a/components/script/dom/extendableevent.rs +++ b/components/script/dom/extendableevent.rs @@ -6,8 +6,8 @@ use dom::bindings::codegen::Bindings::EventBinding::{self, EventMethods}; use dom::bindings::codegen::Bindings::ExtendableEventBinding; use dom::bindings::error::{Error, ErrorResult, Fallible}; use dom::bindings::inheritance::Castable; -use dom::bindings::js::Root; use dom::bindings::reflector::reflect_dom_object; +use dom::bindings::root::Root; use dom::bindings::str::DOMString; use dom::event::Event; use dom::serviceworkerglobalscope::ServiceWorkerGlobalScope; diff --git a/components/script/dom/extendablemessageevent.rs b/components/script/dom/extendablemessageevent.rs index 6c72655ec4c1..0bc5403620cc 100644 --- a/components/script/dom/extendablemessageevent.rs +++ b/components/script/dom/extendablemessageevent.rs @@ -6,8 +6,8 @@ use dom::bindings::codegen::Bindings::ExtendableMessageEventBinding; use dom::bindings::codegen::Bindings::ExtendableMessageEventBinding::ExtendableMessageEventMethods; use dom::bindings::error::Fallible; use dom::bindings::inheritance::Castable; -use dom::bindings::js::Root; use dom::bindings::reflector::reflect_dom_object; +use dom::bindings::root::Root; use dom::bindings::str::DOMString; use dom::bindings::trace::RootedTraceableBox; use dom::event::Event; diff --git a/components/script/dom/file.rs b/components/script/dom/file.rs index 6cf144d10e00..bcea622d4d8b 100644 --- a/components/script/dom/file.rs +++ b/components/script/dom/file.rs @@ -7,8 +7,8 @@ use dom::bindings::codegen::Bindings::FileBinding::FileMethods; use dom::bindings::codegen::UnionTypes::BlobOrString; use dom::bindings::error::{Error, Fallible}; use dom::bindings::inheritance::Castable; -use dom::bindings::js::Root; use dom::bindings::reflector::reflect_dom_object; +use dom::bindings::root::Root; use dom::bindings::str::DOMString; use dom::blob::{Blob, BlobImpl, blob_parts_to_bytes}; use dom::globalscope::GlobalScope; diff --git a/components/script/dom/filelist.rs b/components/script/dom/filelist.rs index 3a5acc41235e..d6e6dcd7158b 100644 --- a/components/script/dom/filelist.rs +++ b/components/script/dom/filelist.rs @@ -4,8 +4,8 @@ use dom::bindings::codegen::Bindings::FileListBinding; use dom::bindings::codegen::Bindings::FileListBinding::FileListMethods; -use dom::bindings::js::{JS, Root}; use dom::bindings::reflector::{Reflector, reflect_dom_object}; +use dom::bindings::root::{JS, Root}; use dom::file::File; use dom::window::Window; use dom_struct::dom_struct; diff --git a/components/script/dom/filereader.rs b/components/script/dom/filereader.rs index 355cd85bcd47..6e72249748fc 100644 --- a/components/script/dom/filereader.rs +++ b/components/script/dom/filereader.rs @@ -9,9 +9,9 @@ use dom::bindings::codegen::Bindings::FileReaderBinding::{self, FileReaderConsta use dom::bindings::codegen::UnionTypes::StringOrObject; use dom::bindings::error::{Error, ErrorResult, Fallible}; use dom::bindings::inheritance::Castable; -use dom::bindings::js::{MutNullableJS, Root}; use dom::bindings::refcounted::Trusted; use dom::bindings::reflector::{DomObject, reflect_dom_object}; +use dom::bindings::root::{MutNullableJS, Root}; use dom::bindings::str::DOMString; use dom::bindings::trace::RootedTraceableBox; use dom::blob::Blob; diff --git a/components/script/dom/filereadersync.rs b/components/script/dom/filereadersync.rs index 744625474cdd..f6fb8ca85637 100644 --- a/components/script/dom/filereadersync.rs +++ b/components/script/dom/filereadersync.rs @@ -4,8 +4,8 @@ use dom::bindings::codegen::Bindings::FileReaderSyncBinding; use dom::bindings::error::Fallible; -use dom::bindings::js::Root; use dom::bindings::reflector::reflect_dom_object; +use dom::bindings::root::Root; use dom::eventtarget::EventTarget; use dom::globalscope::GlobalScope; use dom_struct::dom_struct; diff --git a/components/script/dom/focusevent.rs b/components/script/dom/focusevent.rs index eae3920dae01..0dbf3fc2f1e7 100644 --- a/components/script/dom/focusevent.rs +++ b/components/script/dom/focusevent.rs @@ -7,8 +7,8 @@ use dom::bindings::codegen::Bindings::FocusEventBinding::FocusEventMethods; use dom::bindings::codegen::Bindings::UIEventBinding::UIEventMethods; use dom::bindings::error::Fallible; use dom::bindings::inheritance::Castable; -use dom::bindings::js::{MutNullableJS, Root, RootedReference}; use dom::bindings::reflector::reflect_dom_object; +use dom::bindings::root::{MutNullableJS, Root, RootedReference}; use dom::bindings::str::DOMString; use dom::event::{EventBubbles, EventCancelable}; use dom::eventtarget::EventTarget; diff --git a/components/script/dom/forcetouchevent.rs b/components/script/dom/forcetouchevent.rs index cf5c622d8e8a..6ac5ea83206e 100644 --- a/components/script/dom/forcetouchevent.rs +++ b/components/script/dom/forcetouchevent.rs @@ -6,9 +6,9 @@ use dom::bindings::codegen::Bindings::ForceTouchEventBinding; use dom::bindings::codegen::Bindings::ForceTouchEventBinding::ForceTouchEventMethods; use dom::bindings::codegen::Bindings::UIEventBinding::UIEventMethods; use dom::bindings::inheritance::Castable; -use dom::bindings::js::Root; use dom::bindings::num::Finite; use dom::bindings::reflector::reflect_dom_object; +use dom::bindings::root::Root; use dom::bindings::str::DOMString; use dom::uievent::UIEvent; use dom::window::Window; diff --git a/components/script/dom/formdata.rs b/components/script/dom/formdata.rs index 2d8657e35648..8181fd43d07e 100644 --- a/components/script/dom/formdata.rs +++ b/components/script/dom/formdata.rs @@ -9,8 +9,8 @@ use dom::bindings::codegen::UnionTypes::FileOrUSVString; use dom::bindings::error::Fallible; use dom::bindings::inheritance::Castable; use dom::bindings::iterable::Iterable; -use dom::bindings::js::Root; use dom::bindings::reflector::{DomObject, Reflector, reflect_dom_object}; +use dom::bindings::root::Root; use dom::bindings::str::{DOMString, USVString}; use dom::blob::{Blob, BlobImpl}; use dom::file::File; diff --git a/components/script/dom/gamepad.rs b/components/script/dom/gamepad.rs index bee219bbbcdc..96da458d98bb 100644 --- a/components/script/dom/gamepad.rs +++ b/components/script/dom/gamepad.rs @@ -6,9 +6,9 @@ use core::nonzero::NonZero; use dom::bindings::codegen::Bindings::GamepadBinding; use dom::bindings::codegen::Bindings::GamepadBinding::GamepadMethods; use dom::bindings::inheritance::Castable; -use dom::bindings::js::{JS, Root}; use dom::bindings::num::Finite; use dom::bindings::reflector::{DomObject, Reflector, reflect_dom_object}; +use dom::bindings::root::{JS, Root}; use dom::bindings::str::DOMString; use dom::event::Event; use dom::eventtarget::EventTarget; diff --git a/components/script/dom/gamepadbutton.rs b/components/script/dom/gamepadbutton.rs index ff0c7271e5b8..f896b39f3c61 100644 --- a/components/script/dom/gamepadbutton.rs +++ b/components/script/dom/gamepadbutton.rs @@ -4,9 +4,9 @@ use dom::bindings::codegen::Bindings::GamepadButtonBinding; use dom::bindings::codegen::Bindings::GamepadButtonBinding::GamepadButtonMethods; -use dom::bindings::js::Root; use dom::bindings::num::Finite; use dom::bindings::reflector::{Reflector, reflect_dom_object}; +use dom::bindings::root::Root; use dom::globalscope::GlobalScope; use dom_struct::dom_struct; use std::cell::Cell; diff --git a/components/script/dom/gamepadbuttonlist.rs b/components/script/dom/gamepadbuttonlist.rs index 5ac25504009b..0e26875fcc39 100644 --- a/components/script/dom/gamepadbuttonlist.rs +++ b/components/script/dom/gamepadbuttonlist.rs @@ -4,8 +4,8 @@ use dom::bindings::codegen::Bindings::GamepadButtonListBinding; use dom::bindings::codegen::Bindings::GamepadButtonListBinding::GamepadButtonListMethods; -use dom::bindings::js::{JS, Root, RootedReference}; use dom::bindings::reflector::{Reflector, reflect_dom_object}; +use dom::bindings::root::{JS, Root, RootedReference}; use dom::gamepadbutton::GamepadButton; use dom::globalscope::GlobalScope; use dom_struct::dom_struct; diff --git a/components/script/dom/gamepadevent.rs b/components/script/dom/gamepadevent.rs index f6690981a57b..7e4f899f00c5 100644 --- a/components/script/dom/gamepadevent.rs +++ b/components/script/dom/gamepadevent.rs @@ -7,8 +7,8 @@ use dom::bindings::codegen::Bindings::GamepadEventBinding; use dom::bindings::codegen::Bindings::GamepadEventBinding::GamepadEventMethods; use dom::bindings::error::Fallible; use dom::bindings::inheritance::Castable; -use dom::bindings::js::{JS, Root}; use dom::bindings::reflector::{DomObject, reflect_dom_object}; +use dom::bindings::root::{JS, Root}; use dom::bindings::str::DOMString; use dom::event::Event; use dom::gamepad::Gamepad; diff --git a/components/script/dom/gamepadlist.rs b/components/script/dom/gamepadlist.rs index dd5bdd757d9c..9c84a0597030 100644 --- a/components/script/dom/gamepadlist.rs +++ b/components/script/dom/gamepadlist.rs @@ -5,8 +5,8 @@ use dom::bindings::cell::DOMRefCell; use dom::bindings::codegen::Bindings::GamepadListBinding; use dom::bindings::codegen::Bindings::GamepadListBinding::GamepadListMethods; -use dom::bindings::js::{JS, Root}; use dom::bindings::reflector::{Reflector, reflect_dom_object}; +use dom::bindings::root::{JS, Root}; use dom::gamepad::Gamepad; use dom::globalscope::GlobalScope; use dom_struct::dom_struct; diff --git a/components/script/dom/globalscope.rs b/components/script/dom/globalscope.rs index e298cb184c8b..11196102af03 100644 --- a/components/script/dom/globalscope.rs +++ b/components/script/dom/globalscope.rs @@ -9,8 +9,8 @@ use dom::bindings::codegen::Bindings::WorkerGlobalScopeBinding::WorkerGlobalScop use dom::bindings::conversions::root_from_object; use dom::bindings::error::{ErrorInfo, report_pending_exception}; use dom::bindings::inheritance::Castable; -use dom::bindings::js::{MutNullableJS, Root}; use dom::bindings::reflector::DomObject; +use dom::bindings::root::{MutNullableJS, Root}; use dom::bindings::settings_stack::{AutoEntryScript, entry_global, incumbent_global}; use dom::bindings::str::DOMString; use dom::crypto::Crypto; diff --git a/components/script/dom/hashchangeevent.rs b/components/script/dom/hashchangeevent.rs index 4505d79f4401..4d374685ec65 100644 --- a/components/script/dom/hashchangeevent.rs +++ b/components/script/dom/hashchangeevent.rs @@ -7,8 +7,8 @@ use dom::bindings::codegen::Bindings::HashChangeEventBinding; use dom::bindings::codegen::Bindings::HashChangeEventBinding::HashChangeEventMethods; use dom::bindings::error::Fallible; use dom::bindings::inheritance::Castable; -use dom::bindings::js::Root; use dom::bindings::reflector::reflect_dom_object; +use dom::bindings::root::Root; use dom::bindings::str::{DOMString, USVString}; use dom::event::Event; use dom::window::Window; diff --git a/components/script/dom/headers.rs b/components/script/dom/headers.rs index ce97cb860d2e..f5ac52e10060 100644 --- a/components/script/dom/headers.rs +++ b/components/script/dom/headers.rs @@ -6,8 +6,8 @@ use dom::bindings::cell::DOMRefCell; use dom::bindings::codegen::Bindings::HeadersBinding::{HeadersInit, HeadersMethods, HeadersWrap}; use dom::bindings::error::{Error, ErrorResult, Fallible}; use dom::bindings::iterable::Iterable; -use dom::bindings::js::Root; use dom::bindings::reflector::{Reflector, reflect_dom_object}; +use dom::bindings::root::Root; use dom::bindings::str::{ByteString, is_token}; use dom::globalscope::GlobalScope; use dom_struct::dom_struct; diff --git a/components/script/dom/history.rs b/components/script/dom/history.rs index 9344f3f4b80b..bc22a3e3af27 100644 --- a/components/script/dom/history.rs +++ b/components/script/dom/history.rs @@ -8,8 +8,8 @@ use dom::bindings::codegen::Bindings::LocationBinding::LocationBinding::Location use dom::bindings::codegen::Bindings::WindowBinding::WindowMethods; use dom::bindings::error::{Error, ErrorResult, Fallible}; use dom::bindings::inheritance::Castable; -use dom::bindings::js::{JS, Root}; use dom::bindings::reflector::{Reflector, reflect_dom_object}; +use dom::bindings::root::{JS, Root}; use dom::globalscope::GlobalScope; use dom::window::Window; use dom_struct::dom_struct; diff --git a/components/script/dom/htmlanchorelement.rs b/components/script/dom/htmlanchorelement.rs index aefa776531c0..05065e078063 100644 --- a/components/script/dom/htmlanchorelement.rs +++ b/components/script/dom/htmlanchorelement.rs @@ -11,7 +11,7 @@ use dom::bindings::codegen::Bindings::HTMLAnchorElementBinding::HTMLAnchorElemen use dom::bindings::codegen::Bindings::MouseEventBinding::MouseEventMethods; use dom::bindings::codegen::Bindings::NodeBinding::NodeMethods; use dom::bindings::inheritance::Castable; -use dom::bindings::js::{MutNullableJS, Root}; +use dom::bindings::root::{MutNullableJS, Root}; use dom::bindings::str::{DOMString, USVString}; use dom::document::Document; use dom::domtokenlist::DOMTokenList; diff --git a/components/script/dom/htmlappletelement.rs b/components/script/dom/htmlappletelement.rs index c8d07f488040..61431c6b4478 100644 --- a/components/script/dom/htmlappletelement.rs +++ b/components/script/dom/htmlappletelement.rs @@ -5,7 +5,7 @@ use dom::bindings::codegen::Bindings::HTMLAppletElementBinding; use dom::bindings::codegen::Bindings::HTMLAppletElementBinding::HTMLAppletElementMethods; use dom::bindings::inheritance::Castable; -use dom::bindings::js::Root; +use dom::bindings::root::Root; use dom::bindings::str::DOMString; use dom::document::Document; use dom::htmlelement::HTMLElement; diff --git a/components/script/dom/htmlareaelement.rs b/components/script/dom/htmlareaelement.rs index 4e227491d01d..531752ac8f92 100644 --- a/components/script/dom/htmlareaelement.rs +++ b/components/script/dom/htmlareaelement.rs @@ -7,7 +7,7 @@ use dom::bindings::codegen::Bindings::DOMTokenListBinding::DOMTokenListMethods; use dom::bindings::codegen::Bindings::HTMLAreaElementBinding; use dom::bindings::codegen::Bindings::HTMLAreaElementBinding::HTMLAreaElementMethods; use dom::bindings::inheritance::Castable; -use dom::bindings::js::{MutNullableJS, Root}; +use dom::bindings::root::{MutNullableJS, Root}; use dom::bindings::str::DOMString; use dom::document::Document; use dom::domtokenlist::DOMTokenList; diff --git a/components/script/dom/htmlaudioelement.rs b/components/script/dom/htmlaudioelement.rs index 6d98e94209b5..ed0b0093900c 100644 --- a/components/script/dom/htmlaudioelement.rs +++ b/components/script/dom/htmlaudioelement.rs @@ -3,7 +3,7 @@ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ use dom::bindings::codegen::Bindings::HTMLAudioElementBinding; -use dom::bindings::js::Root; +use dom::bindings::root::Root; use dom::document::Document; use dom::htmlmediaelement::HTMLMediaElement; use dom::node::Node; diff --git a/components/script/dom/htmlbaseelement.rs b/components/script/dom/htmlbaseelement.rs index 0b42265617d2..0ae261d290c8 100644 --- a/components/script/dom/htmlbaseelement.rs +++ b/components/script/dom/htmlbaseelement.rs @@ -6,7 +6,7 @@ use dom::attr::Attr; use dom::bindings::codegen::Bindings::HTMLBaseElementBinding; use dom::bindings::codegen::Bindings::HTMLBaseElementBinding::HTMLBaseElementMethods; use dom::bindings::inheritance::Castable; -use dom::bindings::js::Root; +use dom::bindings::root::Root; use dom::bindings::str::DOMString; use dom::document::Document; use dom::element::{AttributeMutation, Element}; diff --git a/components/script/dom/htmlbodyelement.rs b/components/script/dom/htmlbodyelement.rs index 7c9c53ade45b..3eca3fba978c 100644 --- a/components/script/dom/htmlbodyelement.rs +++ b/components/script/dom/htmlbodyelement.rs @@ -7,7 +7,7 @@ use dom::attr::Attr; use dom::bindings::codegen::Bindings::HTMLBodyElementBinding::{self, HTMLBodyElementMethods}; use dom::bindings::codegen::Bindings::WindowBinding::WindowMethods; use dom::bindings::inheritance::Castable; -use dom::bindings::js::{LayoutJS, Root}; +use dom::bindings::root::{LayoutJS, Root}; use dom::bindings::str::DOMString; use dom::document::Document; use dom::element::{AttributeMutation, Element, RawLayoutElementHelpers}; diff --git a/components/script/dom/htmlbrelement.rs b/components/script/dom/htmlbrelement.rs index dba06c52a0f1..4be8cd477729 100644 --- a/components/script/dom/htmlbrelement.rs +++ b/components/script/dom/htmlbrelement.rs @@ -3,7 +3,7 @@ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ use dom::bindings::codegen::Bindings::HTMLBRElementBinding; -use dom::bindings::js::Root; +use dom::bindings::root::Root; use dom::document::Document; use dom::htmlelement::HTMLElement; use dom::node::Node; diff --git a/components/script/dom/htmlbuttonelement.rs b/components/script/dom/htmlbuttonelement.rs index 84a1294d1c2e..00aec8d5f2d4 100755 --- a/components/script/dom/htmlbuttonelement.rs +++ b/components/script/dom/htmlbuttonelement.rs @@ -7,7 +7,7 @@ use dom::attr::Attr; use dom::bindings::codegen::Bindings::HTMLButtonElementBinding; use dom::bindings::codegen::Bindings::HTMLButtonElementBinding::HTMLButtonElementMethods; use dom::bindings::inheritance::Castable; -use dom::bindings::js::{MutNullableJS, Root}; +use dom::bindings::root::{MutNullableJS, Root}; use dom::bindings::str::DOMString; use dom::document::Document; use dom::element::{AttributeMutation, Element}; diff --git a/components/script/dom/htmlcanvaselement.rs b/components/script/dom/htmlcanvaselement.rs index 4491c22487a2..e870a3195010 100644 --- a/components/script/dom/htmlcanvaselement.rs +++ b/components/script/dom/htmlcanvaselement.rs @@ -14,8 +14,8 @@ use dom::bindings::codegen::UnionTypes::CanvasRenderingContext2DOrWebGLRendering use dom::bindings::conversions::ConversionResult; use dom::bindings::error::{Error, Fallible}; use dom::bindings::inheritance::Castable; -use dom::bindings::js::{JS, LayoutJS, Root}; use dom::bindings::num::Finite; +use dom::bindings::root::{JS, LayoutJS, Root}; use dom::bindings::str::DOMString; use dom::canvasrenderingcontext2d::{CanvasRenderingContext2D, LayoutCanvasRenderingContext2DHelpers}; use dom::document::Document; diff --git a/components/script/dom/htmlcollection.rs b/components/script/dom/htmlcollection.rs index aa8fe9cf3830..533659be4b94 100644 --- a/components/script/dom/htmlcollection.rs +++ b/components/script/dom/htmlcollection.rs @@ -5,8 +5,8 @@ use dom::bindings::codegen::Bindings::HTMLCollectionBinding; use dom::bindings::codegen::Bindings::HTMLCollectionBinding::HTMLCollectionMethods; use dom::bindings::inheritance::Castable; -use dom::bindings::js::{JS, Root, MutNullableJS}; use dom::bindings::reflector::{Reflector, reflect_dom_object}; +use dom::bindings::root::{JS, Root, MutNullableJS}; use dom::bindings::str::DOMString; use dom::bindings::trace::JSTraceable; use dom::bindings::xmlname::namespace_from_domstring; diff --git a/components/script/dom/htmldataelement.rs b/components/script/dom/htmldataelement.rs index baf9c565b4d0..0a32c87261a9 100644 --- a/components/script/dom/htmldataelement.rs +++ b/components/script/dom/htmldataelement.rs @@ -4,7 +4,7 @@ use dom::bindings::codegen::Bindings::HTMLDataElementBinding; use dom::bindings::codegen::Bindings::HTMLDataElementBinding::HTMLDataElementMethods; -use dom::bindings::js::Root; +use dom::bindings::root::Root; use dom::bindings::str::DOMString; use dom::document::Document; use dom::htmlelement::HTMLElement; diff --git a/components/script/dom/htmldatalistelement.rs b/components/script/dom/htmldatalistelement.rs index c7ee6c60ff86..bae9b016456c 100644 --- a/components/script/dom/htmldatalistelement.rs +++ b/components/script/dom/htmldatalistelement.rs @@ -5,7 +5,7 @@ use dom::bindings::codegen::Bindings::HTMLDataListElementBinding; use dom::bindings::codegen::Bindings::HTMLDataListElementBinding::HTMLDataListElementMethods; use dom::bindings::inheritance::Castable; -use dom::bindings::js::Root; +use dom::bindings::root::Root; use dom::document::Document; use dom::element::Element; use dom::htmlcollection::{CollectionFilter, HTMLCollection}; diff --git a/components/script/dom/htmldetailselement.rs b/components/script/dom/htmldetailselement.rs index 72952da8310c..4942253a6672 100644 --- a/components/script/dom/htmldetailselement.rs +++ b/components/script/dom/htmldetailselement.rs @@ -6,8 +6,8 @@ use dom::attr::Attr; use dom::bindings::codegen::Bindings::HTMLDetailsElementBinding; use dom::bindings::codegen::Bindings::HTMLDetailsElementBinding::HTMLDetailsElementMethods; use dom::bindings::inheritance::Castable; -use dom::bindings::js::Root; use dom::bindings::refcounted::Trusted; +use dom::bindings::root::Root; use dom::document::Document; use dom::element::AttributeMutation; use dom::eventtarget::EventTarget; diff --git a/components/script/dom/htmldialogelement.rs b/components/script/dom/htmldialogelement.rs index 15bbdbfe99e2..96671be699d5 100644 --- a/components/script/dom/htmldialogelement.rs +++ b/components/script/dom/htmldialogelement.rs @@ -6,7 +6,7 @@ use dom::bindings::cell::DOMRefCell; use dom::bindings::codegen::Bindings::HTMLDialogElementBinding; use dom::bindings::codegen::Bindings::HTMLDialogElementBinding::HTMLDialogElementMethods; use dom::bindings::inheritance::Castable; -use dom::bindings::js::Root; +use dom::bindings::root::Root; use dom::bindings::str::DOMString; use dom::document::Document; use dom::element::Element; diff --git a/components/script/dom/htmldirectoryelement.rs b/components/script/dom/htmldirectoryelement.rs index 67d1b567c52b..cfec92a71987 100644 --- a/components/script/dom/htmldirectoryelement.rs +++ b/components/script/dom/htmldirectoryelement.rs @@ -3,7 +3,7 @@ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ use dom::bindings::codegen::Bindings::HTMLDirectoryElementBinding; -use dom::bindings::js::Root; +use dom::bindings::root::Root; use dom::document::Document; use dom::htmlelement::HTMLElement; use dom::node::Node; diff --git a/components/script/dom/htmldivelement.rs b/components/script/dom/htmldivelement.rs index 6e20b3796f5d..5f152d770ad7 100644 --- a/components/script/dom/htmldivelement.rs +++ b/components/script/dom/htmldivelement.rs @@ -3,7 +3,7 @@ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ use dom::bindings::codegen::Bindings::HTMLDivElementBinding::{self, HTMLDivElementMethods}; -use dom::bindings::js::Root; +use dom::bindings::root::Root; use dom::bindings::str::DOMString; use dom::document::Document; use dom::htmlelement::HTMLElement; diff --git a/components/script/dom/htmldlistelement.rs b/components/script/dom/htmldlistelement.rs index 796f104c240e..c8890e83f1b7 100644 --- a/components/script/dom/htmldlistelement.rs +++ b/components/script/dom/htmldlistelement.rs @@ -3,7 +3,7 @@ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ use dom::bindings::codegen::Bindings::HTMLDListElementBinding; -use dom::bindings::js::Root; +use dom::bindings::root::Root; use dom::document::Document; use dom::htmlelement::HTMLElement; use dom::node::Node; diff --git a/components/script/dom/htmlelement.rs b/components/script/dom/htmlelement.rs index 1e87982aa540..5fc6023eebae 100644 --- a/components/script/dom/htmlelement.rs +++ b/components/script/dom/htmlelement.rs @@ -12,7 +12,7 @@ use dom::bindings::codegen::Bindings::WindowBinding::WindowMethods; use dom::bindings::error::{Error, ErrorResult}; use dom::bindings::inheritance::{ElementTypeId, HTMLElementTypeId, NodeTypeId}; use dom::bindings::inheritance::Castable; -use dom::bindings::js::{JS, MutNullableJS, Root, RootedReference}; +use dom::bindings::root::{JS, MutNullableJS, Root, RootedReference}; use dom::bindings::str::DOMString; use dom::cssstyledeclaration::{CSSModificationAccess, CSSStyleDeclaration, CSSStyleOwner}; use dom::document::{Document, FocusType}; diff --git a/components/script/dom/htmlembedelement.rs b/components/script/dom/htmlembedelement.rs index 0b3c80b9beaa..e5b207764a2b 100644 --- a/components/script/dom/htmlembedelement.rs +++ b/components/script/dom/htmlembedelement.rs @@ -3,7 +3,7 @@ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ use dom::bindings::codegen::Bindings::HTMLEmbedElementBinding; -use dom::bindings::js::Root; +use dom::bindings::root::Root; use dom::document::Document; use dom::htmlelement::HTMLElement; use dom::node::Node; diff --git a/components/script/dom/htmlfieldsetelement.rs b/components/script/dom/htmlfieldsetelement.rs index e121a38032f4..37187c6def56 100644 --- a/components/script/dom/htmlfieldsetelement.rs +++ b/components/script/dom/htmlfieldsetelement.rs @@ -6,7 +6,7 @@ use dom::attr::Attr; use dom::bindings::codegen::Bindings::HTMLFieldSetElementBinding; use dom::bindings::codegen::Bindings::HTMLFieldSetElementBinding::HTMLFieldSetElementMethods; use dom::bindings::inheritance::{Castable, ElementTypeId, HTMLElementTypeId, NodeTypeId}; -use dom::bindings::js::{MutNullableJS, Root}; +use dom::bindings::root::{MutNullableJS, Root}; use dom::document::Document; use dom::element::{AttributeMutation, Element}; use dom::htmlcollection::{CollectionFilter, HTMLCollection}; diff --git a/components/script/dom/htmlfontelement.rs b/components/script/dom/htmlfontelement.rs index b804d3273261..77417b899970 100644 --- a/components/script/dom/htmlfontelement.rs +++ b/components/script/dom/htmlfontelement.rs @@ -7,7 +7,7 @@ use dom::attr::Attr; use dom::bindings::codegen::Bindings::HTMLFontElementBinding; use dom::bindings::codegen::Bindings::HTMLFontElementBinding::HTMLFontElementMethods; use dom::bindings::inheritance::Castable; -use dom::bindings::js::{LayoutJS, Root}; +use dom::bindings::root::{LayoutJS, Root}; use dom::bindings::str::DOMString; use dom::document::Document; use dom::element::{Element, RawLayoutElementHelpers}; diff --git a/components/script/dom/htmlformcontrolscollection.rs b/components/script/dom/htmlformcontrolscollection.rs index a90e2dd48eea..1b215ba2320d 100644 --- a/components/script/dom/htmlformcontrolscollection.rs +++ b/components/script/dom/htmlformcontrolscollection.rs @@ -6,8 +6,8 @@ use dom::bindings::codegen::Bindings::HTMLCollectionBinding::HTMLCollectionMetho use dom::bindings::codegen::Bindings::HTMLFormControlsCollectionBinding; use dom::bindings::codegen::Bindings::HTMLFormControlsCollectionBinding::HTMLFormControlsCollectionMethods; use dom::bindings::codegen::UnionTypes::RadioNodeListOrElement; -use dom::bindings::js::Root; use dom::bindings::reflector::{DomObject, reflect_dom_object}; +use dom::bindings::root::Root; use dom::bindings::str::DOMString; use dom::element::Element; use dom::htmlcollection::{CollectionFilter, HTMLCollection}; diff --git a/components/script/dom/htmlformelement.rs b/components/script/dom/htmlformelement.rs index 9b63d1fca667..82f9d35997ee 100755 --- a/components/script/dom/htmlformelement.rs +++ b/components/script/dom/htmlformelement.rs @@ -13,9 +13,9 @@ use dom::bindings::codegen::Bindings::HTMLFormElementBinding::HTMLFormElementMet use dom::bindings::codegen::Bindings::HTMLInputElementBinding::HTMLInputElementMethods; use dom::bindings::codegen::Bindings::HTMLTextAreaElementBinding::HTMLTextAreaElementMethods; use dom::bindings::inheritance::{Castable, ElementTypeId, HTMLElementTypeId, NodeTypeId}; -use dom::bindings::js::{JS, OnceCellJS, Root, RootedReference}; use dom::bindings::refcounted::Trusted; use dom::bindings::reflector::DomObject; +use dom::bindings::root::{JS, OnceCellJS, Root, RootedReference}; use dom::bindings::str::DOMString; use dom::blob::Blob; use dom::document::Document; diff --git a/components/script/dom/htmlframeelement.rs b/components/script/dom/htmlframeelement.rs index 68cd8f8a4059..0f70cb99b3e6 100644 --- a/components/script/dom/htmlframeelement.rs +++ b/components/script/dom/htmlframeelement.rs @@ -3,7 +3,7 @@ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ use dom::bindings::codegen::Bindings::HTMLFrameElementBinding; -use dom::bindings::js::Root; +use dom::bindings::root::Root; use dom::document::Document; use dom::htmlelement::HTMLElement; use dom::node::Node; diff --git a/components/script/dom/htmlframesetelement.rs b/components/script/dom/htmlframesetelement.rs index 56195bd57adb..2f8cf1c99a64 100644 --- a/components/script/dom/htmlframesetelement.rs +++ b/components/script/dom/htmlframesetelement.rs @@ -5,7 +5,7 @@ use dom::bindings::codegen::Bindings::HTMLFrameSetElementBinding; use dom::bindings::codegen::Bindings::HTMLFrameSetElementBinding::HTMLFrameSetElementMethods; use dom::bindings::codegen::Bindings::WindowBinding::WindowMethods; -use dom::bindings::js::Root; +use dom::bindings::root::Root; use dom::document::Document; use dom::htmlelement::HTMLElement; use dom::node::{Node, document_from_node}; diff --git a/components/script/dom/htmlheadelement.rs b/components/script/dom/htmlheadelement.rs index 5c14f110c8f7..0d0f2be734c5 100644 --- a/components/script/dom/htmlheadelement.rs +++ b/components/script/dom/htmlheadelement.rs @@ -5,7 +5,7 @@ use dom::bindings::codegen::Bindings::DocumentBinding::DocumentMethods; use dom::bindings::codegen::Bindings::HTMLHeadElementBinding; use dom::bindings::inheritance::Castable; -use dom::bindings::js::{Root, RootedReference}; +use dom::bindings::root::{Root, RootedReference}; use dom::document::{Document, determine_policy_for_token}; use dom::element::Element; use dom::htmlelement::HTMLElement; diff --git a/components/script/dom/htmlheadingelement.rs b/components/script/dom/htmlheadingelement.rs index e9cba94c2df5..5b0a90a1374d 100644 --- a/components/script/dom/htmlheadingelement.rs +++ b/components/script/dom/htmlheadingelement.rs @@ -3,7 +3,7 @@ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ use dom::bindings::codegen::Bindings::HTMLHeadingElementBinding; -use dom::bindings::js::Root; +use dom::bindings::root::Root; use dom::document::Document; use dom::htmlelement::HTMLElement; use dom::node::Node; diff --git a/components/script/dom/htmlhrelement.rs b/components/script/dom/htmlhrelement.rs index 85b160bb8482..38a2f354a6f2 100644 --- a/components/script/dom/htmlhrelement.rs +++ b/components/script/dom/htmlhrelement.rs @@ -5,7 +5,7 @@ use cssparser::RGBA; use dom::bindings::codegen::Bindings::HTMLHRElementBinding::{self, HTMLHRElementMethods}; use dom::bindings::inheritance::Castable; -use dom::bindings::js::{LayoutJS, Root}; +use dom::bindings::root::{LayoutJS, Root}; use dom::bindings::str::DOMString; use dom::document::Document; use dom::element::{Element, RawLayoutElementHelpers}; diff --git a/components/script/dom/htmlhtmlelement.rs b/components/script/dom/htmlhtmlelement.rs index 47aa909035da..75a233b82ce8 100644 --- a/components/script/dom/htmlhtmlelement.rs +++ b/components/script/dom/htmlhtmlelement.rs @@ -3,7 +3,7 @@ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ use dom::bindings::codegen::Bindings::HTMLHtmlElementBinding; -use dom::bindings::js::Root; +use dom::bindings::root::Root; use dom::document::Document; use dom::htmlelement::HTMLElement; use dom::node::Node; diff --git a/components/script/dom/htmliframeelement.rs b/components/script/dom/htmliframeelement.rs index 7f0b82fa2391..cbff0beacc44 100644 --- a/components/script/dom/htmliframeelement.rs +++ b/components/script/dom/htmliframeelement.rs @@ -19,9 +19,9 @@ use dom::bindings::codegen::Bindings::WindowBinding::WindowBinding::WindowMethod use dom::bindings::conversions::ToJSValConvertible; use dom::bindings::error::{Error, ErrorResult, Fallible}; use dom::bindings::inheritance::Castable; -use dom::bindings::js::{LayoutJS, MutNullableJS, Root}; use dom::bindings::refcounted::Trusted; use dom::bindings::reflector::DomObject; +use dom::bindings::root::{LayoutJS, MutNullableJS, Root}; use dom::bindings::str::DOMString; use dom::customevent::CustomEvent; use dom::document::Document; diff --git a/components/script/dom/htmlimageelement.rs b/components/script/dom/htmlimageelement.rs index 49db07a3242c..48cb34d1a988 100644 --- a/components/script/dom/htmlimageelement.rs +++ b/components/script/dom/htmlimageelement.rs @@ -15,9 +15,9 @@ use dom::bindings::codegen::Bindings::MouseEventBinding::MouseEventMethods; use dom::bindings::codegen::Bindings::WindowBinding::WindowMethods; use dom::bindings::error::Fallible; use dom::bindings::inheritance::Castable; -use dom::bindings::js::{LayoutJS, MutNullableJS, Root}; use dom::bindings::refcounted::Trusted; use dom::bindings::reflector::DomObject; +use dom::bindings::root::{LayoutJS, MutNullableJS, Root}; use dom::bindings::str::DOMString; use dom::document::Document; use dom::element::{AttributeMutation, Element, RawLayoutElementHelpers}; diff --git a/components/script/dom/htmlinputelement.rs b/components/script/dom/htmlinputelement.rs index 26597f5a1003..27b401c81e22 100755 --- a/components/script/dom/htmlinputelement.rs +++ b/components/script/dom/htmlinputelement.rs @@ -15,7 +15,7 @@ use dom::bindings::codegen::Bindings::MouseEventBinding::MouseEventMethods; use dom::bindings::codegen::Bindings::WindowBinding::WindowMethods; use dom::bindings::error::{Error, ErrorResult}; use dom::bindings::inheritance::Castable; -use dom::bindings::js::{JS, LayoutJS, MutNullableJS, Root, RootedReference}; +use dom::bindings::root::{JS, LayoutJS, MutNullableJS, Root, RootedReference}; use dom::bindings::str::DOMString; use dom::document::Document; use dom::element::{AttributeMutation, Element, LayoutElementHelpers, RawLayoutElementHelpers}; diff --git a/components/script/dom/htmllabelelement.rs b/components/script/dom/htmllabelelement.rs index cd5044fe4ed0..0e1e99c3f7b2 100644 --- a/components/script/dom/htmllabelelement.rs +++ b/components/script/dom/htmllabelelement.rs @@ -7,7 +7,7 @@ use dom::attr::Attr; use dom::bindings::codegen::Bindings::HTMLLabelElementBinding; use dom::bindings::codegen::Bindings::HTMLLabelElementBinding::HTMLLabelElementMethods; use dom::bindings::inheritance::Castable; -use dom::bindings::js::Root; +use dom::bindings::root::Root; use dom::bindings::str::DOMString; use dom::document::Document; use dom::element::{AttributeMutation, Element}; diff --git a/components/script/dom/htmllegendelement.rs b/components/script/dom/htmllegendelement.rs index d527df711ef2..ad51e0cb6522 100644 --- a/components/script/dom/htmllegendelement.rs +++ b/components/script/dom/htmllegendelement.rs @@ -6,7 +6,7 @@ use dom::bindings::codegen::Bindings::HTMLLegendElementBinding; use dom::bindings::codegen::Bindings::HTMLLegendElementBinding::HTMLLegendElementMethods; use dom::bindings::codegen::Bindings::NodeBinding::NodeMethods; use dom::bindings::inheritance::Castable; -use dom::bindings::js::{MutNullableJS, Root}; +use dom::bindings::root::{MutNullableJS, Root}; use dom::document::Document; use dom::element::Element; use dom::htmlelement::HTMLElement; diff --git a/components/script/dom/htmllielement.rs b/components/script/dom/htmllielement.rs index 9d949764a61e..b175d3359a94 100644 --- a/components/script/dom/htmllielement.rs +++ b/components/script/dom/htmllielement.rs @@ -5,7 +5,7 @@ use dom::bindings::codegen::Bindings::HTMLLIElementBinding; use dom::bindings::codegen::Bindings::HTMLLIElementBinding::HTMLLIElementMethods; use dom::bindings::inheritance::Castable; -use dom::bindings::js::Root; +use dom::bindings::root::Root; use dom::bindings::str::DOMString; use dom::document::Document; use dom::htmlelement::HTMLElement; diff --git a/components/script/dom/htmllinkelement.rs b/components/script/dom/htmllinkelement.rs index f1a8242b3453..814c6b94bd49 100644 --- a/components/script/dom/htmllinkelement.rs +++ b/components/script/dom/htmllinkelement.rs @@ -9,7 +9,7 @@ use dom::bindings::codegen::Bindings::DOMTokenListBinding::DOMTokenListBinding:: use dom::bindings::codegen::Bindings::HTMLLinkElementBinding; use dom::bindings::codegen::Bindings::HTMLLinkElementBinding::HTMLLinkElementMethods; use dom::bindings::inheritance::Castable; -use dom::bindings::js::{MutNullableJS, Root, RootedReference}; +use dom::bindings::root::{MutNullableJS, Root, RootedReference}; use dom::bindings::str::DOMString; use dom::cssstylesheet::CSSStyleSheet; use dom::document::Document; diff --git a/components/script/dom/htmlmapelement.rs b/components/script/dom/htmlmapelement.rs index e3ec4dc42ebd..0f977ae1eda3 100644 --- a/components/script/dom/htmlmapelement.rs +++ b/components/script/dom/htmlmapelement.rs @@ -4,7 +4,7 @@ use dom::bindings::codegen::Bindings::HTMLMapElementBinding; use dom::bindings::inheritance::Castable; -use dom::bindings::js::Root; +use dom::bindings::root::Root; use dom::document::Document; use dom::htmlareaelement::HTMLAreaElement; use dom::htmlelement::HTMLElement; diff --git a/components/script/dom/htmlmediaelement.rs b/components/script/dom/htmlmediaelement.rs index 90efb26e1f31..cadde0b2073a 100644 --- a/components/script/dom/htmlmediaelement.rs +++ b/components/script/dom/htmlmediaelement.rs @@ -16,9 +16,9 @@ use dom::bindings::codegen::InheritTypes::{ElementTypeId, HTMLElementTypeId}; use dom::bindings::codegen::InheritTypes::{HTMLMediaElementTypeId, NodeTypeId}; use dom::bindings::error::{Error, ErrorResult}; use dom::bindings::inheritance::Castable; -use dom::bindings::js::{MutNullableJS, Root}; use dom::bindings::refcounted::Trusted; use dom::bindings::reflector::DomObject; +use dom::bindings::root::{MutNullableJS, Root}; use dom::bindings::str::DOMString; use dom::document::Document; use dom::element::{Element, AttributeMutation}; diff --git a/components/script/dom/htmlmetaelement.rs b/components/script/dom/htmlmetaelement.rs index 462c4aafec17..09443824b70e 100644 --- a/components/script/dom/htmlmetaelement.rs +++ b/components/script/dom/htmlmetaelement.rs @@ -8,7 +8,7 @@ use dom::bindings::codegen::Bindings::HTMLMetaElementBinding; use dom::bindings::codegen::Bindings::HTMLMetaElementBinding::HTMLMetaElementMethods; use dom::bindings::codegen::Bindings::NodeBinding::NodeMethods; use dom::bindings::inheritance::Castable; -use dom::bindings::js::{MutNullableJS, Root, RootedReference}; +use dom::bindings::root::{MutNullableJS, Root, RootedReference}; use dom::bindings::str::DOMString; use dom::cssstylesheet::CSSStyleSheet; use dom::document::Document; diff --git a/components/script/dom/htmlmeterelement.rs b/components/script/dom/htmlmeterelement.rs index ccf1e9a07bb1..20a51ac2db3c 100644 --- a/components/script/dom/htmlmeterelement.rs +++ b/components/script/dom/htmlmeterelement.rs @@ -4,7 +4,7 @@ use dom::bindings::codegen::Bindings::HTMLMeterElementBinding::{self, HTMLMeterElementMethods}; use dom::bindings::inheritance::Castable; -use dom::bindings::js::Root; +use dom::bindings::root::Root; use dom::document::Document; use dom::htmlelement::HTMLElement; use dom::node::Node; diff --git a/components/script/dom/htmlmodelement.rs b/components/script/dom/htmlmodelement.rs index fc3ac0752428..5c1aa846b2d2 100644 --- a/components/script/dom/htmlmodelement.rs +++ b/components/script/dom/htmlmodelement.rs @@ -3,7 +3,7 @@ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ use dom::bindings::codegen::Bindings::HTMLModElementBinding; -use dom::bindings::js::Root; +use dom::bindings::root::Root; use dom::document::Document; use dom::htmlelement::HTMLElement; use dom::node::Node; diff --git a/components/script/dom/htmlobjectelement.rs b/components/script/dom/htmlobjectelement.rs index 4c7d54c2f1fe..bfab288a9cf8 100755 --- a/components/script/dom/htmlobjectelement.rs +++ b/components/script/dom/htmlobjectelement.rs @@ -7,7 +7,7 @@ use dom::bindings::cell::DOMRefCell; use dom::bindings::codegen::Bindings::HTMLObjectElementBinding; use dom::bindings::codegen::Bindings::HTMLObjectElementBinding::HTMLObjectElementMethods; use dom::bindings::inheritance::Castable; -use dom::bindings::js::{MutNullableJS, Root}; +use dom::bindings::root::{MutNullableJS, Root}; use dom::bindings::str::DOMString; use dom::document::Document; use dom::element::{AttributeMutation, Element}; diff --git a/components/script/dom/htmlolistelement.rs b/components/script/dom/htmlolistelement.rs index 42351aea0ffc..87d217575f99 100644 --- a/components/script/dom/htmlolistelement.rs +++ b/components/script/dom/htmlolistelement.rs @@ -3,7 +3,7 @@ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ use dom::bindings::codegen::Bindings::HTMLOListElementBinding; -use dom::bindings::js::Root; +use dom::bindings::root::Root; use dom::document::Document; use dom::htmlelement::HTMLElement; use dom::node::Node; diff --git a/components/script/dom/htmloptgroupelement.rs b/components/script/dom/htmloptgroupelement.rs index d7a50906a76a..cbeef475d386 100644 --- a/components/script/dom/htmloptgroupelement.rs +++ b/components/script/dom/htmloptgroupelement.rs @@ -6,7 +6,7 @@ use dom::attr::Attr; use dom::bindings::codegen::Bindings::HTMLOptGroupElementBinding; use dom::bindings::codegen::Bindings::HTMLOptGroupElementBinding::HTMLOptGroupElementMethods; use dom::bindings::inheritance::Castable; -use dom::bindings::js::Root; +use dom::bindings::root::Root; use dom::document::Document; use dom::element::{AttributeMutation, Element}; use dom::htmlelement::HTMLElement; diff --git a/components/script/dom/htmloptionelement.rs b/components/script/dom/htmloptionelement.rs index 251bbc62a840..41f6996a2508 100644 --- a/components/script/dom/htmloptionelement.rs +++ b/components/script/dom/htmloptionelement.rs @@ -9,7 +9,7 @@ use dom::bindings::codegen::Bindings::HTMLOptionElementBinding::HTMLOptionElemen use dom::bindings::codegen::Bindings::HTMLSelectElementBinding::HTMLSelectElementBinding::HTMLSelectElementMethods; use dom::bindings::codegen::Bindings::NodeBinding::NodeMethods; use dom::bindings::inheritance::Castable; -use dom::bindings::js::Root; +use dom::bindings::root::Root; use dom::bindings::str::DOMString; use dom::characterdata::CharacterData; use dom::document::Document; diff --git a/components/script/dom/htmloptionscollection.rs b/components/script/dom/htmloptionscollection.rs index f3b839a8a2a7..9e946cf84e32 100644 --- a/components/script/dom/htmloptionscollection.rs +++ b/components/script/dom/htmloptionscollection.rs @@ -11,8 +11,8 @@ use dom::bindings::codegen::Bindings::NodeBinding::NodeBinding::NodeMethods; use dom::bindings::codegen::UnionTypes::{HTMLOptionElementOrHTMLOptGroupElement, HTMLElementOrLong}; use dom::bindings::error::{Error, ErrorResult}; use dom::bindings::inheritance::Castable; -use dom::bindings::js::{Root, RootedReference}; use dom::bindings::reflector::reflect_dom_object; +use dom::bindings::root::{Root, RootedReference}; use dom::bindings::str::DOMString; use dom::element::Element; use dom::htmlcollection::{CollectionFilter, HTMLCollection}; diff --git a/components/script/dom/htmloutputelement.rs b/components/script/dom/htmloutputelement.rs index f0b9377e4478..510235e617aa 100644 --- a/components/script/dom/htmloutputelement.rs +++ b/components/script/dom/htmloutputelement.rs @@ -6,7 +6,7 @@ use dom::attr::Attr; use dom::bindings::codegen::Bindings::HTMLOutputElementBinding; use dom::bindings::codegen::Bindings::HTMLOutputElementBinding::HTMLOutputElementMethods; use dom::bindings::inheritance::Castable; -use dom::bindings::js::{MutNullableJS, Root}; +use dom::bindings::root::{MutNullableJS, Root}; use dom::document::Document; use dom::element::{AttributeMutation, Element}; use dom::htmlelement::HTMLElement; diff --git a/components/script/dom/htmlparagraphelement.rs b/components/script/dom/htmlparagraphelement.rs index f0b0e176152b..061847d3e12e 100644 --- a/components/script/dom/htmlparagraphelement.rs +++ b/components/script/dom/htmlparagraphelement.rs @@ -3,7 +3,7 @@ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ use dom::bindings::codegen::Bindings::HTMLParagraphElementBinding; -use dom::bindings::js::Root; +use dom::bindings::root::Root; use dom::document::Document; use dom::htmlelement::HTMLElement; use dom::node::Node; diff --git a/components/script/dom/htmlparamelement.rs b/components/script/dom/htmlparamelement.rs index 46dd705ef3bd..af7d73c3cd80 100644 --- a/components/script/dom/htmlparamelement.rs +++ b/components/script/dom/htmlparamelement.rs @@ -3,7 +3,7 @@ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ use dom::bindings::codegen::Bindings::HTMLParamElementBinding; -use dom::bindings::js::Root; +use dom::bindings::root::Root; use dom::document::Document; use dom::htmlelement::HTMLElement; use dom::node::Node; diff --git a/components/script/dom/htmlpreelement.rs b/components/script/dom/htmlpreelement.rs index 76862160847a..dc531c99b767 100644 --- a/components/script/dom/htmlpreelement.rs +++ b/components/script/dom/htmlpreelement.rs @@ -3,7 +3,7 @@ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ use dom::bindings::codegen::Bindings::HTMLPreElementBinding; -use dom::bindings::js::Root; +use dom::bindings::root::Root; use dom::document::Document; use dom::htmlelement::HTMLElement; use dom::node::Node; diff --git a/components/script/dom/htmlprogresselement.rs b/components/script/dom/htmlprogresselement.rs index 2ad3371da940..c5c777d9816f 100644 --- a/components/script/dom/htmlprogresselement.rs +++ b/components/script/dom/htmlprogresselement.rs @@ -4,7 +4,7 @@ use dom::bindings::codegen::Bindings::HTMLProgressElementBinding::{self, HTMLProgressElementMethods}; use dom::bindings::inheritance::Castable; -use dom::bindings::js::Root; +use dom::bindings::root::Root; use dom::document::Document; use dom::htmlelement::HTMLElement; use dom::node::Node; diff --git a/components/script/dom/htmlquoteelement.rs b/components/script/dom/htmlquoteelement.rs index 7ccb59b5e848..2169851edb1d 100644 --- a/components/script/dom/htmlquoteelement.rs +++ b/components/script/dom/htmlquoteelement.rs @@ -3,7 +3,7 @@ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ use dom::bindings::codegen::Bindings::HTMLQuoteElementBinding; -use dom::bindings::js::Root; +use dom::bindings::root::Root; use dom::document::Document; use dom::htmlelement::HTMLElement; use dom::node::Node; diff --git a/components/script/dom/htmlscriptelement.rs b/components/script/dom/htmlscriptelement.rs index a9a7869e33e3..eea87ffe7950 100644 --- a/components/script/dom/htmlscriptelement.rs +++ b/components/script/dom/htmlscriptelement.rs @@ -9,10 +9,9 @@ use dom::bindings::codegen::Bindings::HTMLScriptElementBinding; use dom::bindings::codegen::Bindings::HTMLScriptElementBinding::HTMLScriptElementMethods; use dom::bindings::codegen::Bindings::NodeBinding::NodeMethods; use dom::bindings::inheritance::Castable; -use dom::bindings::js::{JS, Root}; -use dom::bindings::js::RootedReference; use dom::bindings::refcounted::Trusted; use dom::bindings::reflector::DomObject; +use dom::bindings::root::{JS, Root, RootedReference}; use dom::bindings::str::DOMString; use dom::document::Document; use dom::element::{AttributeMutation, Element, ElementCreator}; diff --git a/components/script/dom/htmlselectelement.rs b/components/script/dom/htmlselectelement.rs index 9db953162970..641a88178149 100755 --- a/components/script/dom/htmlselectelement.rs +++ b/components/script/dom/htmlselectelement.rs @@ -14,7 +14,7 @@ use dom::bindings::codegen::UnionTypes::HTMLElementOrLong; use dom::bindings::codegen::UnionTypes::HTMLOptionElementOrHTMLOptGroupElement; //use dom::bindings::error::ErrorResult; use dom::bindings::inheritance::Castable; -use dom::bindings::js::{MutNullableJS, Root}; +use dom::bindings::root::{MutNullableJS, Root}; use dom::bindings::str::DOMString; use dom::document::Document; use dom::element::{AttributeMutation, Element}; diff --git a/components/script/dom/htmlsourceelement.rs b/components/script/dom/htmlsourceelement.rs index 865b21d6acb1..9ff82f59aef7 100644 --- a/components/script/dom/htmlsourceelement.rs +++ b/components/script/dom/htmlsourceelement.rs @@ -5,7 +5,7 @@ use dom::bindings::codegen::Bindings::HTMLSourceElementBinding; use dom::bindings::codegen::Bindings::NodeBinding::NodeBinding::NodeMethods; use dom::bindings::inheritance::Castable; -use dom::bindings::js::Root; +use dom::bindings::root::Root; use dom::document::Document; use dom::htmlelement::HTMLElement; use dom::htmlmediaelement::HTMLMediaElement; diff --git a/components/script/dom/htmlspanelement.rs b/components/script/dom/htmlspanelement.rs index 657b4aca17b7..9713ad86007e 100644 --- a/components/script/dom/htmlspanelement.rs +++ b/components/script/dom/htmlspanelement.rs @@ -3,7 +3,7 @@ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ use dom::bindings::codegen::Bindings::HTMLSpanElementBinding; -use dom::bindings::js::Root; +use dom::bindings::root::Root; use dom::document::Document; use dom::htmlelement::HTMLElement; use dom::node::Node; diff --git a/components/script/dom/htmlstyleelement.rs b/components/script/dom/htmlstyleelement.rs index 65c7d11c12f2..cfe0651df28f 100644 --- a/components/script/dom/htmlstyleelement.rs +++ b/components/script/dom/htmlstyleelement.rs @@ -8,7 +8,7 @@ use dom::bindings::codegen::Bindings::HTMLStyleElementBinding; use dom::bindings::codegen::Bindings::HTMLStyleElementBinding::HTMLStyleElementMethods; use dom::bindings::codegen::Bindings::NodeBinding::NodeMethods; use dom::bindings::inheritance::Castable; -use dom::bindings::js::{MutNullableJS, Root}; +use dom::bindings::root::{MutNullableJS, Root}; use dom::cssstylesheet::CSSStyleSheet; use dom::document::Document; use dom::element::{Element, ElementCreator}; diff --git a/components/script/dom/htmltablecaptionelement.rs b/components/script/dom/htmltablecaptionelement.rs index b21a00bc1906..852850f4db99 100644 --- a/components/script/dom/htmltablecaptionelement.rs +++ b/components/script/dom/htmltablecaptionelement.rs @@ -3,7 +3,7 @@ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ use dom::bindings::codegen::Bindings::HTMLTableCaptionElementBinding; -use dom::bindings::js::Root; +use dom::bindings::root::Root; use dom::document::Document; use dom::htmlelement::HTMLElement; use dom::node::Node; diff --git a/components/script/dom/htmltablecellelement.rs b/components/script/dom/htmltablecellelement.rs index de0bab2ce9a9..6bbdc65079a2 100644 --- a/components/script/dom/htmltablecellelement.rs +++ b/components/script/dom/htmltablecellelement.rs @@ -6,7 +6,7 @@ use cssparser::RGBA; use dom::bindings::codegen::Bindings::HTMLTableCellElementBinding::HTMLTableCellElementMethods; use dom::bindings::codegen::Bindings::NodeBinding::NodeMethods; use dom::bindings::inheritance::Castable; -use dom::bindings::js::LayoutJS; +use dom::bindings::root::LayoutJS; use dom::bindings::str::DOMString; use dom::document::Document; use dom::element::{Element, RawLayoutElementHelpers}; diff --git a/components/script/dom/htmltablecolelement.rs b/components/script/dom/htmltablecolelement.rs index 875e6e696bd9..d2910023466a 100644 --- a/components/script/dom/htmltablecolelement.rs +++ b/components/script/dom/htmltablecolelement.rs @@ -3,7 +3,7 @@ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ use dom::bindings::codegen::Bindings::HTMLTableColElementBinding; -use dom::bindings::js::Root; +use dom::bindings::root::Root; use dom::document::Document; use dom::htmlelement::HTMLElement; use dom::node::Node; diff --git a/components/script/dom/htmltabledatacellelement.rs b/components/script/dom/htmltabledatacellelement.rs index 1c70ffbd8fb4..6c9a2c638179 100644 --- a/components/script/dom/htmltabledatacellelement.rs +++ b/components/script/dom/htmltabledatacellelement.rs @@ -3,7 +3,7 @@ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ use dom::bindings::codegen::Bindings::HTMLTableDataCellElementBinding; -use dom::bindings::js::Root; +use dom::bindings::root::Root; use dom::document::Document; use dom::htmltablecellelement::HTMLTableCellElement; use dom::node::Node; diff --git a/components/script/dom/htmltableelement.rs b/components/script/dom/htmltableelement.rs index c4a6232a5998..e7982476982b 100644 --- a/components/script/dom/htmltableelement.rs +++ b/components/script/dom/htmltableelement.rs @@ -10,7 +10,7 @@ use dom::bindings::codegen::Bindings::HTMLTableElementBinding::HTMLTableElementM use dom::bindings::codegen::Bindings::NodeBinding::NodeMethods; use dom::bindings::error::{Error, ErrorResult, Fallible}; use dom::bindings::inheritance::Castable; -use dom::bindings::js::{JS, LayoutJS, MutNullableJS, Root, RootedReference}; +use dom::bindings::root::{JS, LayoutJS, MutNullableJS, Root, RootedReference}; use dom::bindings::str::DOMString; use dom::document::Document; use dom::element::{AttributeMutation, Element, RawLayoutElementHelpers}; diff --git a/components/script/dom/htmltableheadercellelement.rs b/components/script/dom/htmltableheadercellelement.rs index 7655db7ee775..7f426ff9dca9 100644 --- a/components/script/dom/htmltableheadercellelement.rs +++ b/components/script/dom/htmltableheadercellelement.rs @@ -3,7 +3,7 @@ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ use dom::bindings::codegen::Bindings::HTMLTableHeaderCellElementBinding; -use dom::bindings::js::Root; +use dom::bindings::root::Root; use dom::document::Document; use dom::htmltablecellelement::HTMLTableCellElement; use dom::node::Node; diff --git a/components/script/dom/htmltablerowelement.rs b/components/script/dom/htmltablerowelement.rs index d18ef77f8d85..c56c7ae7add7 100644 --- a/components/script/dom/htmltablerowelement.rs +++ b/components/script/dom/htmltablerowelement.rs @@ -9,7 +9,7 @@ use dom::bindings::codegen::Bindings::HTMLTableSectionElementBinding::HTMLTableS use dom::bindings::codegen::Bindings::NodeBinding::NodeMethods; use dom::bindings::error::{ErrorResult, Fallible}; use dom::bindings::inheritance::Castable; -use dom::bindings::js::{LayoutJS, MutNullableJS, Root, RootedReference}; +use dom::bindings::root::{LayoutJS, MutNullableJS, Root, RootedReference}; use dom::bindings::str::DOMString; use dom::document::Document; use dom::element::{Element, RawLayoutElementHelpers}; diff --git a/components/script/dom/htmltablesectionelement.rs b/components/script/dom/htmltablesectionelement.rs index 66703305bc73..e2165843b0fa 100644 --- a/components/script/dom/htmltablesectionelement.rs +++ b/components/script/dom/htmltablesectionelement.rs @@ -7,7 +7,7 @@ use dom::bindings::codegen::Bindings::HTMLTableSectionElementBinding::{self, HTM use dom::bindings::codegen::Bindings::NodeBinding::NodeMethods; use dom::bindings::error::{ErrorResult, Fallible}; use dom::bindings::inheritance::Castable; -use dom::bindings::js::{LayoutJS, Root, RootedReference}; +use dom::bindings::root::{LayoutJS, Root, RootedReference}; use dom::bindings::str::DOMString; use dom::document::Document; use dom::element::{Element, RawLayoutElementHelpers}; diff --git a/components/script/dom/htmltemplateelement.rs b/components/script/dom/htmltemplateelement.rs index 9b058607aff8..ec46955db7e6 100644 --- a/components/script/dom/htmltemplateelement.rs +++ b/components/script/dom/htmltemplateelement.rs @@ -7,7 +7,7 @@ use dom::bindings::codegen::Bindings::HTMLTemplateElementBinding; use dom::bindings::codegen::Bindings::HTMLTemplateElementBinding::HTMLTemplateElementMethods; use dom::bindings::codegen::Bindings::NodeBinding::NodeMethods; use dom::bindings::inheritance::Castable; -use dom::bindings::js::{MutNullableJS, Root}; +use dom::bindings::root::{MutNullableJS, Root}; use dom::document::Document; use dom::documentfragment::DocumentFragment; use dom::htmlelement::HTMLElement; diff --git a/components/script/dom/htmltextareaelement.rs b/components/script/dom/htmltextareaelement.rs index fc48564d0300..9c050f0790fc 100755 --- a/components/script/dom/htmltextareaelement.rs +++ b/components/script/dom/htmltextareaelement.rs @@ -9,7 +9,7 @@ use dom::bindings::codegen::Bindings::HTMLTextAreaElementBinding; use dom::bindings::codegen::Bindings::HTMLTextAreaElementBinding::HTMLTextAreaElementMethods; use dom::bindings::codegen::Bindings::NodeBinding::NodeMethods; use dom::bindings::inheritance::Castable; -use dom::bindings::js::{LayoutJS, MutNullableJS, Root}; +use dom::bindings::root::{LayoutJS, MutNullableJS, Root}; use dom::bindings::str::DOMString; use dom::document::Document; use dom::element::{AttributeMutation, Element}; diff --git a/components/script/dom/htmltimeelement.rs b/components/script/dom/htmltimeelement.rs index 7fc3245ed419..c5a54bc0ebcd 100644 --- a/components/script/dom/htmltimeelement.rs +++ b/components/script/dom/htmltimeelement.rs @@ -4,7 +4,7 @@ use dom::bindings::codegen::Bindings::HTMLTimeElementBinding; use dom::bindings::codegen::Bindings::HTMLTimeElementBinding::HTMLTimeElementMethods; -use dom::bindings::js::Root; +use dom::bindings::root::Root; use dom::bindings::str::DOMString; use dom::document::Document; use dom::htmlelement::HTMLElement; diff --git a/components/script/dom/htmltitleelement.rs b/components/script/dom/htmltitleelement.rs index 751f3c0ef2e8..4e7208dc9ad7 100644 --- a/components/script/dom/htmltitleelement.rs +++ b/components/script/dom/htmltitleelement.rs @@ -6,7 +6,7 @@ use dom::bindings::codegen::Bindings::HTMLTitleElementBinding; use dom::bindings::codegen::Bindings::HTMLTitleElementBinding::HTMLTitleElementMethods; use dom::bindings::codegen::Bindings::NodeBinding::NodeMethods; use dom::bindings::inheritance::Castable; -use dom::bindings::js::Root; +use dom::bindings::root::Root; use dom::bindings::str::DOMString; use dom::document::Document; use dom::htmlelement::HTMLElement; diff --git a/components/script/dom/htmltrackelement.rs b/components/script/dom/htmltrackelement.rs index eb9a5ecf80d5..f91ea1aba3d4 100644 --- a/components/script/dom/htmltrackelement.rs +++ b/components/script/dom/htmltrackelement.rs @@ -3,7 +3,7 @@ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ use dom::bindings::codegen::Bindings::HTMLTrackElementBinding; -use dom::bindings::js::Root; +use dom::bindings::root::Root; use dom::document::Document; use dom::htmlelement::HTMLElement; use dom::node::Node; diff --git a/components/script/dom/htmlulistelement.rs b/components/script/dom/htmlulistelement.rs index b40f4a1f8dbb..7240597d4f03 100644 --- a/components/script/dom/htmlulistelement.rs +++ b/components/script/dom/htmlulistelement.rs @@ -3,7 +3,7 @@ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ use dom::bindings::codegen::Bindings::HTMLUListElementBinding; -use dom::bindings::js::Root; +use dom::bindings::root::Root; use dom::document::Document; use dom::htmlelement::HTMLElement; use dom::node::Node; diff --git a/components/script/dom/htmlunknownelement.rs b/components/script/dom/htmlunknownelement.rs index cb3db5be2928..7894dfafc432 100644 --- a/components/script/dom/htmlunknownelement.rs +++ b/components/script/dom/htmlunknownelement.rs @@ -3,7 +3,7 @@ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ use dom::bindings::codegen::Bindings::HTMLUnknownElementBinding; -use dom::bindings::js::Root; +use dom::bindings::root::Root; use dom::document::Document; use dom::htmlelement::HTMLElement; use dom::node::Node; diff --git a/components/script/dom/htmlvideoelement.rs b/components/script/dom/htmlvideoelement.rs index 00befe9a109a..c841832c17d2 100644 --- a/components/script/dom/htmlvideoelement.rs +++ b/components/script/dom/htmlvideoelement.rs @@ -3,7 +3,7 @@ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ use dom::bindings::codegen::Bindings::HTMLVideoElementBinding; -use dom::bindings::js::Root; +use dom::bindings::root::Root; use dom::document::Document; use dom::htmlmediaelement::HTMLMediaElement; use dom::node::Node; diff --git a/components/script/dom/imagedata.rs b/components/script/dom/imagedata.rs index 30e0e3d6dae5..910bc4004ded 100644 --- a/components/script/dom/imagedata.rs +++ b/components/script/dom/imagedata.rs @@ -6,8 +6,8 @@ use core::nonzero::NonZero; use dom::bindings::codegen::Bindings::ImageDataBinding; use dom::bindings::codegen::Bindings::ImageDataBinding::ImageDataMethods; use dom::bindings::error::{Fallible, Error}; -use dom::bindings::js::Root; use dom::bindings::reflector::{Reflector, reflect_dom_object}; +use dom::bindings::root::Root; use dom::globalscope::GlobalScope; use dom_struct::dom_struct; use euclid::Size2D; diff --git a/components/script/dom/inputevent.rs b/components/script/dom/inputevent.rs index c080ea0c9173..821008bb383e 100644 --- a/components/script/dom/inputevent.rs +++ b/components/script/dom/inputevent.rs @@ -5,8 +5,8 @@ use dom::bindings::codegen::Bindings::InputEventBinding::{self, InputEventMethods}; use dom::bindings::codegen::Bindings::UIEventBinding::UIEventBinding::UIEventMethods; use dom::bindings::error::Fallible; -use dom::bindings::js::{Root, RootedReference}; use dom::bindings::reflector::reflect_dom_object; +use dom::bindings::root::{Root, RootedReference}; use dom::bindings::str::DOMString; use dom::uievent::UIEvent; use dom::window::Window; diff --git a/components/script/dom/keyboardevent.rs b/components/script/dom/keyboardevent.rs index 33b044085a23..b9f2e354022e 100644 --- a/components/script/dom/keyboardevent.rs +++ b/components/script/dom/keyboardevent.rs @@ -8,8 +8,8 @@ use dom::bindings::codegen::Bindings::KeyboardEventBinding::{KeyboardEventConsta use dom::bindings::codegen::Bindings::UIEventBinding::UIEventMethods; use dom::bindings::error::Fallible; use dom::bindings::inheritance::Castable; -use dom::bindings::js::{Root, RootedReference}; use dom::bindings::reflector::reflect_dom_object; +use dom::bindings::root::{Root, RootedReference}; use dom::bindings::str::DOMString; use dom::event::Event; use dom::uievent::UIEvent; diff --git a/components/script/dom/location.rs b/components/script/dom/location.rs index c725e6cee54e..dd8f6405610c 100644 --- a/components/script/dom/location.rs +++ b/components/script/dom/location.rs @@ -6,8 +6,8 @@ use dom::bindings::codegen::Bindings::LocationBinding; use dom::bindings::codegen::Bindings::LocationBinding::LocationMethods; use dom::bindings::codegen::Bindings::WindowBinding::WindowBinding::WindowMethods; use dom::bindings::error::{Error, ErrorResult, Fallible}; -use dom::bindings::js::{JS, Root}; use dom::bindings::reflector::{Reflector, reflect_dom_object}; +use dom::bindings::root::{JS, Root}; use dom::bindings::str::{DOMString, USVString}; use dom::globalscope::GlobalScope; use dom::urlhelper::UrlHelper; diff --git a/components/script/dom/macros.rs b/components/script/dom/macros.rs index 075caf04c5fc..43b1b17724f7 100644 --- a/components/script/dom/macros.rs +++ b/components/script/dom/macros.rs @@ -600,8 +600,8 @@ macro_rules! rooted_vec { macro_rules! impl_performance_entry_struct( ($binding:ident, $struct:ident, $type:expr) => ( use dom::bindings::codegen::Bindings::$binding; - use dom::bindings::js::Root; use dom::bindings::reflector::reflect_dom_object; + use dom::bindings::root::Root; use dom::bindings::str::DOMString; use dom::globalscope::GlobalScope; use dom::performanceentry::PerformanceEntry; diff --git a/components/script/dom/mediaerror.rs b/components/script/dom/mediaerror.rs index ff158333473e..a506134b90ca 100644 --- a/components/script/dom/mediaerror.rs +++ b/components/script/dom/mediaerror.rs @@ -3,8 +3,8 @@ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ use dom::bindings::codegen::Bindings::MediaErrorBinding::{self, MediaErrorMethods}; -use dom::bindings::js::Root; use dom::bindings::reflector::{Reflector, reflect_dom_object}; +use dom::bindings::root::Root; use dom::window::Window; use dom_struct::dom_struct; diff --git a/components/script/dom/medialist.rs b/components/script/dom/medialist.rs index f737ecc9d2ed..41599f08a3d0 100644 --- a/components/script/dom/medialist.rs +++ b/components/script/dom/medialist.rs @@ -6,8 +6,8 @@ use cssparser::{Parser, ParserInput}; use dom::bindings::codegen::Bindings::MediaListBinding; use dom::bindings::codegen::Bindings::MediaListBinding::MediaListMethods; use dom::bindings::codegen::Bindings::WindowBinding::WindowBinding::WindowMethods; -use dom::bindings::js::{JS, Root}; use dom::bindings::reflector::{DomObject, Reflector, reflect_dom_object}; +use dom::bindings::root::{JS, Root}; use dom::bindings::str::DOMString; use dom::cssstylesheet::CSSStyleSheet; use dom::window::Window; diff --git a/components/script/dom/mediaquerylist.rs b/components/script/dom/mediaquerylist.rs index d80354645de4..044f83af3124 100644 --- a/components/script/dom/mediaquerylist.rs +++ b/components/script/dom/mediaquerylist.rs @@ -7,9 +7,9 @@ use dom::bindings::codegen::Bindings::EventListenerBinding::EventListener; use dom::bindings::codegen::Bindings::EventTargetBinding::EventTargetMethods; use dom::bindings::codegen::Bindings::MediaQueryListBinding::{self, MediaQueryListMethods}; use dom::bindings::inheritance::Castable; -use dom::bindings::js::{JS, Root}; use dom::bindings::reflector::DomObject; use dom::bindings::reflector::reflect_dom_object; +use dom::bindings::root::{JS, Root}; use dom::bindings::str::DOMString; use dom::bindings::trace::JSTraceable; use dom::bindings::weakref::{WeakRef, WeakRefVec}; diff --git a/components/script/dom/mediaquerylistevent.rs b/components/script/dom/mediaquerylistevent.rs index 18be8b1d1b54..e825b278730a 100644 --- a/components/script/dom/mediaquerylistevent.rs +++ b/components/script/dom/mediaquerylistevent.rs @@ -8,8 +8,8 @@ use dom::bindings::codegen::Bindings::MediaQueryListEventBinding::MediaQueryList use dom::bindings::codegen::Bindings::MediaQueryListEventBinding::MediaQueryListEventMethods; use dom::bindings::error::Fallible; use dom::bindings::inheritance::Castable; -use dom::bindings::js::Root; use dom::bindings::reflector::reflect_dom_object; +use dom::bindings::root::Root; use dom::bindings::str::DOMString; use dom::event::Event; use dom::globalscope::GlobalScope; diff --git a/components/script/dom/messageevent.rs b/components/script/dom/messageevent.rs index 4b49840b9c4e..7987032f42d4 100644 --- a/components/script/dom/messageevent.rs +++ b/components/script/dom/messageevent.rs @@ -7,8 +7,8 @@ use dom::bindings::codegen::Bindings::MessageEventBinding; use dom::bindings::codegen::Bindings::MessageEventBinding::MessageEventMethods; use dom::bindings::error::Fallible; use dom::bindings::inheritance::Castable; -use dom::bindings::js::Root; use dom::bindings::reflector::reflect_dom_object; +use dom::bindings::root::Root; use dom::bindings::str::DOMString; use dom::bindings::trace::RootedTraceableBox; use dom::event::Event; diff --git a/components/script/dom/mimetype.rs b/components/script/dom/mimetype.rs index daa499084082..b27255e85b2d 100644 --- a/components/script/dom/mimetype.rs +++ b/components/script/dom/mimetype.rs @@ -3,8 +3,8 @@ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ use dom::bindings::codegen::Bindings::MimeTypeBinding::MimeTypeMethods; -use dom::bindings::js::Root; use dom::bindings::reflector::Reflector; +use dom::bindings::root::Root; use dom::bindings::str::DOMString; use dom::plugin::Plugin; use dom_struct::dom_struct; diff --git a/components/script/dom/mimetypearray.rs b/components/script/dom/mimetypearray.rs index 4bc33e9b2373..6b87bb60b3f1 100644 --- a/components/script/dom/mimetypearray.rs +++ b/components/script/dom/mimetypearray.rs @@ -4,8 +4,8 @@ use dom::bindings::codegen::Bindings::MimeTypeArrayBinding; use dom::bindings::codegen::Bindings::MimeTypeArrayBinding::MimeTypeArrayMethods; -use dom::bindings::js::Root; use dom::bindings::reflector::{Reflector, reflect_dom_object}; +use dom::bindings::root::Root; use dom::bindings::str::DOMString; use dom::globalscope::GlobalScope; use dom::mimetype::MimeType; diff --git a/components/script/dom/mod.rs b/components/script/dom/mod.rs index a088b1ae96a4..5b049c0cb29e 100644 --- a/components/script/dom/mod.rs +++ b/components/script/dom/mod.rs @@ -30,10 +30,10 @@ //! For more information, see: //! //! * rooting pointers on the stack: -//! the [`Root`](bindings/js/struct.Root.html) smart pointer; -//! * tracing pointers in member fields: the [`JS`](bindings/js/struct.JS.html), -//! [`MutNullableJS`](bindings/js/struct.MutNullableJS.html) and -//! [`MutJS`](bindings/js/struct.MutJS.html) smart pointers and +//! the [`Root`](bindings/root/struct.Root.html) smart pointer; +//! * tracing pointers in member fields: the [`JS`](bindings/root/struct.JS.html), +//! [`MutNullableJS`](bindings/root/struct.MutNullableJS.html) and +//! [`MutJS`](bindings/root/struct.MutJS.html) smart pointers and //! [the tracing implementation](bindings/trace/index.html); //! * rooting pointers from across thread boundaries or in channels: the //! [`Trusted`](bindings/refcounted/struct.Trusted.html) smart pointer; @@ -195,7 +195,7 @@ //! ================================= //! //! Layout code can access the DOM through the -//! [`LayoutJS`](bindings/js/struct.LayoutJS.html) smart pointer. This does not +//! [`LayoutJS`](bindings/root/struct.LayoutJS.html) smart pointer. This does not //! keep the DOM object alive; we ensure that no DOM code (Garbage Collection //! in particular) runs while the layout thread is accessing the DOM. //! diff --git a/components/script/dom/mouseevent.rs b/components/script/dom/mouseevent.rs index f19c37df868b..049a92c8308e 100644 --- a/components/script/dom/mouseevent.rs +++ b/components/script/dom/mouseevent.rs @@ -7,8 +7,8 @@ use dom::bindings::codegen::Bindings::MouseEventBinding::MouseEventMethods; use dom::bindings::codegen::Bindings::UIEventBinding::UIEventMethods; use dom::bindings::error::Fallible; use dom::bindings::inheritance::Castable; -use dom::bindings::js::{MutNullableJS, Root, RootedReference}; use dom::bindings::reflector::reflect_dom_object; +use dom::bindings::root::{MutNullableJS, Root, RootedReference}; use dom::bindings::str::DOMString; use dom::event::{Event, EventBubbles, EventCancelable}; use dom::eventtarget::EventTarget; diff --git a/components/script/dom/mutationobserver.rs b/components/script/dom/mutationobserver.rs index 84d34af0149c..ced20d1ec4a8 100644 --- a/components/script/dom/mutationobserver.rs +++ b/components/script/dom/mutationobserver.rs @@ -9,8 +9,8 @@ use dom::bindings::codegen::Bindings::MutationObserverBinding::MutationCallback; use dom::bindings::codegen::Bindings::MutationObserverBinding::MutationObserverBinding::MutationObserverMethods; use dom::bindings::codegen::Bindings::MutationObserverBinding::MutationObserverInit; use dom::bindings::error::{Error, Fallible}; -use dom::bindings::js::Root; use dom::bindings::reflector::{Reflector, reflect_dom_object}; +use dom::bindings::root::Root; use dom::bindings::str::DOMString; use dom::mutationrecord::MutationRecord; use dom::node::Node; diff --git a/components/script/dom/mutationrecord.rs b/components/script/dom/mutationrecord.rs index 00d96e258c4c..fd2037790492 100644 --- a/components/script/dom/mutationrecord.rs +++ b/components/script/dom/mutationrecord.rs @@ -4,8 +4,8 @@ use dom::bindings::codegen::Bindings::MutationRecordBinding::MutationRecordBinding; use dom::bindings::codegen::Bindings::MutationRecordBinding::MutationRecordBinding::MutationRecordMethods; -use dom::bindings::js::{JS, MutNullableJS, Root}; use dom::bindings::reflector::{Reflector, reflect_dom_object}; +use dom::bindings::root::{JS, MutNullableJS, Root}; use dom::bindings::str::DOMString; use dom::node::{Node, window_from_node}; use dom::nodelist::NodeList; diff --git a/components/script/dom/namednodemap.rs b/components/script/dom/namednodemap.rs index 9d92bf11c2d2..297c9df9a98a 100644 --- a/components/script/dom/namednodemap.rs +++ b/components/script/dom/namednodemap.rs @@ -7,8 +7,8 @@ use dom::bindings::codegen::Bindings::ElementBinding::ElementMethods; use dom::bindings::codegen::Bindings::NamedNodeMapBinding; use dom::bindings::codegen::Bindings::NamedNodeMapBinding::NamedNodeMapMethods; use dom::bindings::error::{Error, Fallible}; -use dom::bindings::js::{JS, Root}; use dom::bindings::reflector::{Reflector, reflect_dom_object}; +use dom::bindings::root::{JS, Root}; use dom::bindings::str::DOMString; use dom::bindings::xmlname::namespace_from_domstring; use dom::element::Element; diff --git a/components/script/dom/navigator.rs b/components/script/dom/navigator.rs index 4d0b38f78b37..dddac1bb5613 100644 --- a/components/script/dom/navigator.rs +++ b/components/script/dom/navigator.rs @@ -5,8 +5,8 @@ use dom::bindings::codegen::Bindings::NavigatorBinding; use dom::bindings::codegen::Bindings::NavigatorBinding::NavigatorMethods; use dom::bindings::codegen::Bindings::VRBinding::VRBinding::VRMethods; -use dom::bindings::js::{MutNullableJS, Root}; use dom::bindings::reflector::{Reflector, DomObject, reflect_dom_object}; +use dom::bindings::root::{MutNullableJS, Root}; use dom::bindings::str::DOMString; use dom::bluetooth::Bluetooth; use dom::gamepadlist::GamepadList; diff --git a/components/script/dom/node.rs b/components/script/dom/node.rs index 77e499a6f5ab..a6bfcb398da1 100644 --- a/components/script/dom/node.rs +++ b/components/script/dom/node.rs @@ -22,10 +22,8 @@ use dom::bindings::error::{Error, ErrorResult, Fallible}; use dom::bindings::inheritance::{Castable, CharacterDataTypeId, ElementTypeId}; use dom::bindings::inheritance::{EventTargetTypeId, HTMLElementTypeId, NodeTypeId}; use dom::bindings::inheritance::{SVGElementTypeId, SVGGraphicsElementTypeId}; -use dom::bindings::js::{JS, LayoutJS, MutNullableJS}; -use dom::bindings::js::Root; -use dom::bindings::js::RootedReference; use dom::bindings::reflector::{DomObject, reflect_dom_object}; +use dom::bindings::root::{JS, LayoutJS, MutNullableJS, Root, RootedReference}; use dom::bindings::str::{DOMString, USVString}; use dom::bindings::xmlname::namespace_from_domstring; use dom::characterdata::{CharacterData, LayoutCharacterDataHelpers}; diff --git a/components/script/dom/nodeiterator.rs b/components/script/dom/nodeiterator.rs index 93e50ca46a97..1fce57699103 100644 --- a/components/script/dom/nodeiterator.rs +++ b/components/script/dom/nodeiterator.rs @@ -9,8 +9,8 @@ use dom::bindings::codegen::Bindings::NodeFilterBinding::NodeFilterConstants; use dom::bindings::codegen::Bindings::NodeIteratorBinding; use dom::bindings::codegen::Bindings::NodeIteratorBinding::NodeIteratorMethods; use dom::bindings::error::Fallible; -use dom::bindings::js::{JS, MutJS, Root}; use dom::bindings::reflector::{Reflector, reflect_dom_object}; +use dom::bindings::root::{JS, MutJS, Root}; use dom::document::Document; use dom::node::Node; use dom_struct::dom_struct; diff --git a/components/script/dom/nodelist.rs b/components/script/dom/nodelist.rs index 7fdfe5b60646..c0d962adab6c 100644 --- a/components/script/dom/nodelist.rs +++ b/components/script/dom/nodelist.rs @@ -5,8 +5,8 @@ use dom::bindings::codegen::Bindings::NodeBinding::NodeMethods; use dom::bindings::codegen::Bindings::NodeListBinding; use dom::bindings::codegen::Bindings::NodeListBinding::NodeListMethods; -use dom::bindings::js::{JS, MutNullableJS, Root, RootedReference}; use dom::bindings::reflector::{Reflector, reflect_dom_object}; +use dom::bindings::root::{JS, MutNullableJS, Root, RootedReference}; use dom::node::{ChildrenMutation, Node}; use dom::window::Window; use dom_struct::dom_struct; diff --git a/components/script/dom/pagetransitionevent.rs b/components/script/dom/pagetransitionevent.rs index 3757bece84ac..4ee04dde09d5 100644 --- a/components/script/dom/pagetransitionevent.rs +++ b/components/script/dom/pagetransitionevent.rs @@ -7,8 +7,8 @@ use dom::bindings::codegen::Bindings::PageTransitionEventBinding; use dom::bindings::codegen::Bindings::PageTransitionEventBinding::PageTransitionEventMethods; use dom::bindings::error::Fallible; use dom::bindings::inheritance::Castable; -use dom::bindings::js::Root; use dom::bindings::reflector::reflect_dom_object; +use dom::bindings::root::Root; use dom::bindings::str::DOMString; use dom::event::Event; use dom::window::Window; diff --git a/components/script/dom/paintrenderingcontext2d.rs b/components/script/dom/paintrenderingcontext2d.rs index 5a269eaf37a4..261e9b953224 100644 --- a/components/script/dom/paintrenderingcontext2d.rs +++ b/components/script/dom/paintrenderingcontext2d.rs @@ -16,9 +16,9 @@ use dom::bindings::codegen::UnionTypes::StringOrCanvasGradientOrCanvasPattern; use dom::bindings::error::ErrorResult; use dom::bindings::error::Fallible; use dom::bindings::inheritance::Castable; -use dom::bindings::js::Root; use dom::bindings::num::Finite; use dom::bindings::reflector::reflect_dom_object; +use dom::bindings::root::Root; use dom::bindings::str::DOMString; use dom::canvasgradient::CanvasGradient; use dom::canvaspattern::CanvasPattern; diff --git a/components/script/dom/paintsize.rs b/components/script/dom/paintsize.rs index df94bd365662..5943b97d6f09 100644 --- a/components/script/dom/paintsize.rs +++ b/components/script/dom/paintsize.rs @@ -4,10 +4,10 @@ use dom::bindings::codegen::Bindings::PaintSizeBinding; use dom::bindings::codegen::Bindings::PaintSizeBinding::PaintSizeMethods; -use dom::bindings::js::Root; use dom::bindings::num::Finite; use dom::bindings::reflector::Reflector; use dom::bindings::reflector::reflect_dom_object; +use dom::bindings::root::Root; use dom::paintworkletglobalscope::PaintWorkletGlobalScope; use dom_struct::dom_struct; use euclid::TypedSize2D; diff --git a/components/script/dom/paintworkletglobalscope.rs b/components/script/dom/paintworkletglobalscope.rs index 8eba2c8bb147..3a749cfaf2b0 100644 --- a/components/script/dom/paintworkletglobalscope.rs +++ b/components/script/dom/paintworkletglobalscope.rs @@ -12,9 +12,8 @@ use dom::bindings::conversions::get_property_jsval; use dom::bindings::error::Error; use dom::bindings::error::Fallible; use dom::bindings::inheritance::Castable; -use dom::bindings::js::JS; -use dom::bindings::js::Root; use dom::bindings::reflector::DomObject; +use dom::bindings::root::{JS, Root}; use dom::bindings::str::DOMString; use dom::cssstylevalue::CSSStyleValue; use dom::paintrenderingcontext2d::PaintRenderingContext2D; diff --git a/components/script/dom/performance.rs b/components/script/dom/performance.rs index 7d2b053dda72..0213c2999074 100644 --- a/components/script/dom/performance.rs +++ b/components/script/dom/performance.rs @@ -8,9 +8,9 @@ use dom::bindings::codegen::Bindings::PerformanceBinding::{DOMHighResTimeStamp, use dom::bindings::codegen::Bindings::PerformanceBinding::PerformanceEntryList as DOMPerformanceEntryList; use dom::bindings::error::{Error, Fallible}; use dom::bindings::inheritance::Castable; -use dom::bindings::js::{JS, Root}; use dom::bindings::num::Finite; use dom::bindings::reflector::{DomObject, Reflector, reflect_dom_object}; +use dom::bindings::root::{JS, Root}; use dom::bindings::str::DOMString; use dom::globalscope::GlobalScope; use dom::performanceentry::PerformanceEntry; diff --git a/components/script/dom/performanceentry.rs b/components/script/dom/performanceentry.rs index 3242d5d5abd7..12d3934cceaf 100644 --- a/components/script/dom/performanceentry.rs +++ b/components/script/dom/performanceentry.rs @@ -4,9 +4,9 @@ use dom::bindings::codegen::Bindings::PerformanceEntryBinding; use dom::bindings::codegen::Bindings::PerformanceEntryBinding::PerformanceEntryMethods; -use dom::bindings::js::Root; use dom::bindings::num::Finite; use dom::bindings::reflector::{Reflector, reflect_dom_object}; +use dom::bindings::root::Root; use dom::bindings::str::DOMString; use dom::globalscope::GlobalScope; use dom_struct::dom_struct; diff --git a/components/script/dom/performanceobserver.rs b/components/script/dom/performanceobserver.rs index 24bf84ffd5c7..ac28a7f42972 100644 --- a/components/script/dom/performanceobserver.rs +++ b/components/script/dom/performanceobserver.rs @@ -10,8 +10,8 @@ use dom::bindings::codegen::Bindings::PerformanceObserverBinding::PerformanceObs use dom::bindings::codegen::Bindings::PerformanceObserverBinding::PerformanceObserverInit; use dom::bindings::codegen::Bindings::PerformanceObserverBinding::PerformanceObserverMethods; use dom::bindings::error::{Error, Fallible}; -use dom::bindings::js::Root; use dom::bindings::reflector::{DomObject, Reflector, reflect_dom_object}; +use dom::bindings::root::Root; use dom::bindings::str::DOMString; use dom::globalscope::GlobalScope; use dom::performance::PerformanceEntryList; diff --git a/components/script/dom/performanceobserverentrylist.rs b/components/script/dom/performanceobserverentrylist.rs index 94f62248fbd7..2b127ec75f7d 100644 --- a/components/script/dom/performanceobserverentrylist.rs +++ b/components/script/dom/performanceobserverentrylist.rs @@ -5,8 +5,8 @@ use dom::bindings::cell::DOMRefCell; use dom::bindings::codegen::Bindings::PerformanceObserverEntryListBinding; use dom::bindings::codegen::Bindings::PerformanceObserverEntryListBinding::PerformanceObserverEntryListMethods; -use dom::bindings::js::Root; use dom::bindings::reflector::{Reflector, reflect_dom_object}; +use dom::bindings::root::Root; use dom::bindings::str::DOMString; use dom::globalscope::GlobalScope; use dom::performance::PerformanceEntryList; diff --git a/components/script/dom/performancepainttiming.rs b/components/script/dom/performancepainttiming.rs index a4e4369ccebc..505444c33db9 100644 --- a/components/script/dom/performancepainttiming.rs +++ b/components/script/dom/performancepainttiming.rs @@ -3,8 +3,8 @@ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ use dom::bindings::codegen::Bindings::PerformancePaintTimingBinding; -use dom::bindings::js::Root; use dom::bindings::reflector::reflect_dom_object; +use dom::bindings::root::Root; use dom::bindings::str::DOMString; use dom::globalscope::GlobalScope; use dom::performanceentry::PerformanceEntry; diff --git a/components/script/dom/performancetiming.rs b/components/script/dom/performancetiming.rs index 37001f5d15fb..0300accc922d 100644 --- a/components/script/dom/performancetiming.rs +++ b/components/script/dom/performancetiming.rs @@ -5,8 +5,8 @@ use dom::bindings::codegen::Bindings::PerformanceTimingBinding; use dom::bindings::codegen::Bindings::PerformanceTimingBinding::PerformanceTimingMethods; use dom::bindings::codegen::Bindings::WindowBinding::WindowMethods; -use dom::bindings::js::{JS, Root}; use dom::bindings::reflector::{Reflector, reflect_dom_object}; +use dom::bindings::root::{JS, Root}; use dom::document::Document; use dom::window::Window; use dom_struct::dom_struct; diff --git a/components/script/dom/permissions.rs b/components/script/dom/permissions.rs index 99908aa51e9a..1ff8fc301b7a 100644 --- a/components/script/dom/permissions.rs +++ b/components/script/dom/permissions.rs @@ -6,8 +6,8 @@ use dom::bindings::codegen::Bindings::PermissionStatusBinding::{PermissionDescri use dom::bindings::codegen::Bindings::PermissionStatusBinding::PermissionStatusMethods; use dom::bindings::codegen::Bindings::PermissionsBinding::{self, PermissionsMethods}; use dom::bindings::error::Error; -use dom::bindings::js::Root; use dom::bindings::reflector::{DomObject, Reflector, reflect_dom_object}; +use dom::bindings::root::Root; use dom::bluetooth::Bluetooth; use dom::bluetoothpermissionresult::BluetoothPermissionResult; use dom::globalscope::GlobalScope; diff --git a/components/script/dom/permissionstatus.rs b/components/script/dom/permissionstatus.rs index ec2138cf23d5..505f4ad346ba 100644 --- a/components/script/dom/permissionstatus.rs +++ b/components/script/dom/permissionstatus.rs @@ -5,8 +5,8 @@ use dom::bindings::codegen::Bindings::PermissionStatusBinding::{self, PermissionDescriptor, PermissionName}; use dom::bindings::codegen::Bindings::PermissionStatusBinding::PermissionState; use dom::bindings::codegen::Bindings::PermissionStatusBinding::PermissionStatusMethods; -use dom::bindings::js::Root; use dom::bindings::reflector::reflect_dom_object; +use dom::bindings::root::Root; use dom::eventtarget::EventTarget; use dom::globalscope::GlobalScope; use dom_struct::dom_struct; diff --git a/components/script/dom/plugin.rs b/components/script/dom/plugin.rs index 8e3af814ec94..d16aba43e909 100644 --- a/components/script/dom/plugin.rs +++ b/components/script/dom/plugin.rs @@ -3,8 +3,8 @@ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ use dom::bindings::codegen::Bindings::PluginBinding::PluginMethods; -use dom::bindings::js::Root; use dom::bindings::reflector::Reflector; +use dom::bindings::root::Root; use dom::bindings::str::DOMString; use dom::mimetype::MimeType; use dom_struct::dom_struct; diff --git a/components/script/dom/pluginarray.rs b/components/script/dom/pluginarray.rs index b359c2b83689..2ddd0449b6cf 100644 --- a/components/script/dom/pluginarray.rs +++ b/components/script/dom/pluginarray.rs @@ -4,8 +4,8 @@ use dom::bindings::codegen::Bindings::PluginArrayBinding; use dom::bindings::codegen::Bindings::PluginArrayBinding::PluginArrayMethods; -use dom::bindings::js::Root; use dom::bindings::reflector::{Reflector, reflect_dom_object}; +use dom::bindings::root::Root; use dom::bindings::str::DOMString; use dom::globalscope::GlobalScope; use dom::plugin::Plugin; diff --git a/components/script/dom/popstateevent.rs b/components/script/dom/popstateevent.rs index c5e63d4ea50b..e07c1faa71f9 100644 --- a/components/script/dom/popstateevent.rs +++ b/components/script/dom/popstateevent.rs @@ -7,8 +7,8 @@ use dom::bindings::codegen::Bindings::PopStateEventBinding; use dom::bindings::codegen::Bindings::PopStateEventBinding::PopStateEventMethods; use dom::bindings::error::Fallible; use dom::bindings::inheritance::Castable; -use dom::bindings::js::Root; use dom::bindings::reflector::reflect_dom_object; +use dom::bindings::root::Root; use dom::bindings::str::DOMString; use dom::bindings::trace::RootedTraceableBox; use dom::event::Event; diff --git a/components/script/dom/processinginstruction.rs b/components/script/dom/processinginstruction.rs index 31e6737a977e..c70e191976e2 100644 --- a/components/script/dom/processinginstruction.rs +++ b/components/script/dom/processinginstruction.rs @@ -4,7 +4,7 @@ use dom::bindings::codegen::Bindings::ProcessingInstructionBinding; use dom::bindings::codegen::Bindings::ProcessingInstructionBinding::ProcessingInstructionMethods; -use dom::bindings::js::Root; +use dom::bindings::root::Root; use dom::bindings::str::DOMString; use dom::characterdata::CharacterData; use dom::document::Document; diff --git a/components/script/dom/progressevent.rs b/components/script/dom/progressevent.rs index e5ca1af2ae1b..72898430f6ba 100644 --- a/components/script/dom/progressevent.rs +++ b/components/script/dom/progressevent.rs @@ -7,8 +7,8 @@ use dom::bindings::codegen::Bindings::ProgressEventBinding; use dom::bindings::codegen::Bindings::ProgressEventBinding::ProgressEventMethods; use dom::bindings::error::Fallible; use dom::bindings::inheritance::Castable; -use dom::bindings::js::Root; use dom::bindings::reflector::reflect_dom_object; +use dom::bindings::root::Root; use dom::bindings::str::DOMString; use dom::event::{Event, EventBubbles, EventCancelable}; use dom::globalscope::GlobalScope; diff --git a/components/script/dom/promisenativehandler.rs b/components/script/dom/promisenativehandler.rs index 59fe1d7425b9..756b9b840228 100644 --- a/components/script/dom/promisenativehandler.rs +++ b/components/script/dom/promisenativehandler.rs @@ -3,8 +3,8 @@ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ use dom::bindings::codegen::Bindings::PromiseNativeHandlerBinding; -use dom::bindings::js::Root; use dom::bindings::reflector::{Reflector, reflect_dom_object}; +use dom::bindings::root::Root; use dom::bindings::trace::JSTraceable; use dom::globalscope::GlobalScope; use dom_struct::dom_struct; diff --git a/components/script/dom/radionodelist.rs b/components/script/dom/radionodelist.rs index 07f479c6ed49..64abfe9177e0 100644 --- a/components/script/dom/radionodelist.rs +++ b/components/script/dom/radionodelist.rs @@ -7,8 +7,8 @@ use dom::bindings::codegen::Bindings::NodeListBinding::NodeListMethods; use dom::bindings::codegen::Bindings::RadioNodeListBinding; use dom::bindings::codegen::Bindings::RadioNodeListBinding::RadioNodeListMethods; use dom::bindings::inheritance::Castable; -use dom::bindings::js::{JS, Root}; use dom::bindings::reflector::reflect_dom_object; +use dom::bindings::root::{JS, Root}; use dom::bindings::str::DOMString; use dom::htmlinputelement::HTMLInputElement; use dom::node::Node; diff --git a/components/script/dom/range.rs b/components/script/dom/range.rs index 1e65caedc9dd..1e0e8f090c64 100644 --- a/components/script/dom/range.rs +++ b/components/script/dom/range.rs @@ -13,8 +13,8 @@ use dom::bindings::codegen::Bindings::WindowBinding::WindowMethods; use dom::bindings::error::{Error, ErrorResult, Fallible}; use dom::bindings::inheritance::{CharacterDataTypeId, NodeTypeId}; use dom::bindings::inheritance::Castable; -use dom::bindings::js::{JS, MutJS, Root, RootedReference}; use dom::bindings::reflector::{Reflector, reflect_dom_object}; +use dom::bindings::root::{JS, MutJS, Root, RootedReference}; use dom::bindings::str::DOMString; use dom::bindings::trace::JSTraceable; use dom::bindings::weakref::{WeakRef, WeakRefVec}; diff --git a/components/script/dom/request.rs b/components/script/dom/request.rs index 9abfb4b0eb43..70835465093e 100644 --- a/components/script/dom/request.rs +++ b/components/script/dom/request.rs @@ -17,8 +17,8 @@ use dom::bindings::codegen::Bindings::RequestBinding::RequestMode; use dom::bindings::codegen::Bindings::RequestBinding::RequestRedirect; use dom::bindings::codegen::Bindings::RequestBinding::RequestType; use dom::bindings::error::{Error, Fallible}; -use dom::bindings::js::{MutNullableJS, Root}; use dom::bindings::reflector::{DomObject, Reflector, reflect_dom_object}; +use dom::bindings::root::{MutNullableJS, Root}; use dom::bindings::str::{ByteString, DOMString, USVString}; use dom::bindings::trace::RootedTraceableBox; use dom::globalscope::GlobalScope; diff --git a/components/script/dom/response.rs b/components/script/dom/response.rs index c2b2dd20346c..5d254b345256 100644 --- a/components/script/dom/response.rs +++ b/components/script/dom/response.rs @@ -10,8 +10,8 @@ use dom::bindings::codegen::Bindings::ResponseBinding; use dom::bindings::codegen::Bindings::ResponseBinding::{ResponseMethods, ResponseType as DOMResponseType}; use dom::bindings::codegen::Bindings::XMLHttpRequestBinding::BodyInit; use dom::bindings::error::{Error, Fallible}; -use dom::bindings::js::{MutNullableJS, Root}; use dom::bindings::reflector::{DomObject, Reflector, reflect_dom_object}; +use dom::bindings::root::{MutNullableJS, Root}; use dom::bindings::str::{ByteString, USVString}; use dom::globalscope::GlobalScope; use dom::headers::{Headers, Guard}; diff --git a/components/script/dom/screen.rs b/components/script/dom/screen.rs index 80e5bf8d5c6f..e1ff7589dbd1 100644 --- a/components/script/dom/screen.rs +++ b/components/script/dom/screen.rs @@ -4,8 +4,8 @@ use dom::bindings::codegen::Bindings::ScreenBinding; use dom::bindings::codegen::Bindings::ScreenBinding::ScreenMethods; -use dom::bindings::js::Root; use dom::bindings::reflector::{Reflector, reflect_dom_object}; +use dom::bindings::root::Root; use dom::window::Window; use dom_struct::dom_struct; diff --git a/components/script/dom/serviceworker.rs b/components/script/dom/serviceworker.rs index 51c75309050b..adc4796a2706 100644 --- a/components/script/dom/serviceworker.rs +++ b/components/script/dom/serviceworker.rs @@ -7,9 +7,9 @@ use dom::bindings::cell::DOMRefCell; use dom::bindings::codegen::Bindings::ServiceWorkerBinding::{ServiceWorkerMethods, ServiceWorkerState, Wrap}; use dom::bindings::error::{ErrorResult, Error}; use dom::bindings::inheritance::Castable; -use dom::bindings::js::Root; use dom::bindings::refcounted::Trusted; use dom::bindings::reflector::{DomObject, reflect_dom_object}; +use dom::bindings::root::Root; use dom::bindings::str::USVString; use dom::bindings::structuredclone::StructuredCloneData; use dom::eventtarget::EventTarget; diff --git a/components/script/dom/serviceworkercontainer.rs b/components/script/dom/serviceworkercontainer.rs index ed423c0a849a..7c5d30709fb1 100644 --- a/components/script/dom/serviceworkercontainer.rs +++ b/components/script/dom/serviceworkercontainer.rs @@ -5,8 +5,8 @@ use dom::bindings::codegen::Bindings::ServiceWorkerContainerBinding::{ServiceWorkerContainerMethods, Wrap}; use dom::bindings::codegen::Bindings::ServiceWorkerContainerBinding::RegistrationOptions; use dom::bindings::error::Error; -use dom::bindings::js::{JS, MutNullableJS, Root}; use dom::bindings::reflector::{DomObject, reflect_dom_object}; +use dom::bindings::root::{JS, MutNullableJS, Root}; use dom::bindings::str::USVString; use dom::client::Client; use dom::eventtarget::EventTarget; diff --git a/components/script/dom/serviceworkerglobalscope.rs b/components/script/dom/serviceworkerglobalscope.rs index 5f3a2b82aa2a..b7b44328bc75 100644 --- a/components/script/dom/serviceworkerglobalscope.rs +++ b/components/script/dom/serviceworkerglobalscope.rs @@ -8,8 +8,8 @@ use dom::abstractworker::WorkerScriptMsg; use dom::bindings::codegen::Bindings::ServiceWorkerGlobalScopeBinding; use dom::bindings::codegen::Bindings::ServiceWorkerGlobalScopeBinding::ServiceWorkerGlobalScopeMethods; use dom::bindings::inheritance::Castable; -use dom::bindings::js::{Root, RootCollection}; use dom::bindings::reflector::DomObject; +use dom::bindings::root::{Root, RootCollection}; use dom::bindings::str::DOMString; use dom::event::Event; use dom::eventtarget::EventTarget; diff --git a/components/script/dom/serviceworkerregistration.rs b/components/script/dom/serviceworkerregistration.rs index b296b62b6c5b..3ca40ab874c8 100644 --- a/components/script/dom/serviceworkerregistration.rs +++ b/components/script/dom/serviceworkerregistration.rs @@ -4,8 +4,8 @@ use dom::bindings::codegen::Bindings::ServiceWorkerBinding::ServiceWorkerState; use dom::bindings::codegen::Bindings::ServiceWorkerRegistrationBinding::{ServiceWorkerRegistrationMethods, Wrap}; -use dom::bindings::js::{JS, Root}; use dom::bindings::reflector::reflect_dom_object; +use dom::bindings::root::{JS, Root}; use dom::bindings::str::USVString; use dom::eventtarget::EventTarget; use dom::globalscope::GlobalScope; diff --git a/components/script/dom/servoparser/async_html.rs b/components/script/dom/servoparser/async_html.rs index ec4bc6e070b7..c33ffe6aa027 100644 --- a/components/script/dom/servoparser/async_html.rs +++ b/components/script/dom/servoparser/async_html.rs @@ -7,7 +7,7 @@ use dom::bindings::codegen::Bindings::HTMLTemplateElementBinding::HTMLTemplateElementMethods; use dom::bindings::codegen::Bindings::NodeBinding::NodeMethods; use dom::bindings::inheritance::Castable; -use dom::bindings::js::{JS, Root}; +use dom::bindings::root::{JS, Root}; use dom::bindings::str::DOMString; use dom::comment::Comment; use dom::document::Document; diff --git a/components/script/dom/servoparser/html.rs b/components/script/dom/servoparser/html.rs index 4621faacf545..447e8e28e67d 100644 --- a/components/script/dom/servoparser/html.rs +++ b/components/script/dom/servoparser/html.rs @@ -6,7 +6,7 @@ use dom::bindings::codegen::Bindings::HTMLTemplateElementBinding::HTMLTemplateElementMethods; use dom::bindings::inheritance::{Castable, CharacterDataTypeId, NodeTypeId}; -use dom::bindings::js::{JS, Root}; +use dom::bindings::root::{JS, Root}; use dom::bindings::trace::JSTraceable; use dom::characterdata::CharacterData; use dom::document::Document; diff --git a/components/script/dom/servoparser/mod.rs b/components/script/dom/servoparser/mod.rs index d0e08664e73a..61400a30f70d 100644 --- a/components/script/dom/servoparser/mod.rs +++ b/components/script/dom/servoparser/mod.rs @@ -10,9 +10,9 @@ use dom::bindings::codegen::Bindings::HTMLTemplateElementBinding::HTMLTemplateEl use dom::bindings::codegen::Bindings::NodeBinding::NodeMethods; use dom::bindings::codegen::Bindings::ServoParserBinding; use dom::bindings::inheritance::Castable; -use dom::bindings::js::{JS, MutNullableJS, Root, RootedReference}; use dom::bindings::refcounted::Trusted; use dom::bindings::reflector::{Reflector, reflect_dom_object}; +use dom::bindings::root::{JS, MutNullableJS, Root, RootedReference}; use dom::bindings::str::DOMString; use dom::characterdata::CharacterData; use dom::comment::Comment; diff --git a/components/script/dom/servoparser/xml.rs b/components/script/dom/servoparser/xml.rs index 508a66929195..58791b4d3230 100644 --- a/components/script/dom/servoparser/xml.rs +++ b/components/script/dom/servoparser/xml.rs @@ -4,7 +4,7 @@ #![allow(unrooted_must_root)] -use dom::bindings::js::{JS, Root}; +use dom::bindings::root::{JS, Root}; use dom::bindings::trace::JSTraceable; use dom::document::Document; use dom::htmlscriptelement::HTMLScriptElement; diff --git a/components/script/dom/storage.rs b/components/script/dom/storage.rs index e7b948e46d6d..ba4ac955e6dc 100644 --- a/components/script/dom/storage.rs +++ b/components/script/dom/storage.rs @@ -6,9 +6,9 @@ use dom::bindings::codegen::Bindings::StorageBinding; use dom::bindings::codegen::Bindings::StorageBinding::StorageMethods; use dom::bindings::error::{Error, ErrorResult}; use dom::bindings::inheritance::Castable; -use dom::bindings::js::Root; use dom::bindings::refcounted::Trusted; use dom::bindings::reflector::{DomObject, Reflector, reflect_dom_object}; +use dom::bindings::root::Root; use dom::bindings::str::DOMString; use dom::event::{Event, EventBubbles, EventCancelable}; use dom::storageevent::StorageEvent; diff --git a/components/script/dom/storageevent.rs b/components/script/dom/storageevent.rs index b0cab81eb7b9..5fa2f5da9dce 100644 --- a/components/script/dom/storageevent.rs +++ b/components/script/dom/storageevent.rs @@ -7,8 +7,8 @@ use dom::bindings::codegen::Bindings::StorageEventBinding; use dom::bindings::codegen::Bindings::StorageEventBinding::StorageEventMethods; use dom::bindings::error::Fallible; use dom::bindings::inheritance::Castable; -use dom::bindings::js::{MutNullableJS, Root, RootedReference}; use dom::bindings::reflector::reflect_dom_object; +use dom::bindings::root::{MutNullableJS, Root, RootedReference}; use dom::bindings::str::DOMString; use dom::event::{Event, EventBubbles, EventCancelable}; use dom::storage::Storage; diff --git a/components/script/dom/stylepropertymapreadonly.rs b/components/script/dom/stylepropertymapreadonly.rs index 02f8a3423217..cde0f9042e0f 100644 --- a/components/script/dom/stylepropertymapreadonly.rs +++ b/components/script/dom/stylepropertymapreadonly.rs @@ -4,10 +4,9 @@ use dom::bindings::codegen::Bindings::StylePropertyMapReadOnlyBinding::StylePropertyMapReadOnlyMethods; use dom::bindings::codegen::Bindings::StylePropertyMapReadOnlyBinding::Wrap; -use dom::bindings::js::JS; -use dom::bindings::js::Root; use dom::bindings::reflector::Reflector; use dom::bindings::reflector::reflect_dom_object; +use dom::bindings::root::{JS, Root}; use dom::bindings::str::DOMString; use dom::cssstylevalue::CSSStyleValue; use dom::globalscope::GlobalScope; diff --git a/components/script/dom/stylesheet.rs b/components/script/dom/stylesheet.rs index bf4b1c562e3d..731431ca94fd 100644 --- a/components/script/dom/stylesheet.rs +++ b/components/script/dom/stylesheet.rs @@ -5,8 +5,8 @@ use dom::bindings::codegen::Bindings::StyleSheetBinding; use dom::bindings::codegen::Bindings::StyleSheetBinding::StyleSheetMethods; use dom::bindings::inheritance::Castable; -use dom::bindings::js::Root; use dom::bindings::reflector::{Reflector, reflect_dom_object}; +use dom::bindings::root::Root; use dom::bindings::str::DOMString; use dom::cssstylesheet::CSSStyleSheet; use dom::window::Window; diff --git a/components/script/dom/stylesheetlist.rs b/components/script/dom/stylesheetlist.rs index faeb04c1dda5..3021b47a0a95 100644 --- a/components/script/dom/stylesheetlist.rs +++ b/components/script/dom/stylesheetlist.rs @@ -4,8 +4,8 @@ use dom::bindings::codegen::Bindings::StyleSheetListBinding; use dom::bindings::codegen::Bindings::StyleSheetListBinding::StyleSheetListMethods; -use dom::bindings::js::{JS, Root}; use dom::bindings::reflector::{Reflector, reflect_dom_object}; +use dom::bindings::root::{JS, Root}; use dom::document::Document; use dom::stylesheet::StyleSheet; use dom::window::Window; diff --git a/components/script/dom/svgsvgelement.rs b/components/script/dom/svgsvgelement.rs index 90a272885a01..b1ab9ddd50f8 100644 --- a/components/script/dom/svgsvgelement.rs +++ b/components/script/dom/svgsvgelement.rs @@ -5,7 +5,7 @@ use dom::attr::Attr; use dom::bindings::codegen::Bindings::SVGSVGElementBinding; use dom::bindings::inheritance::Castable; -use dom::bindings::js::{LayoutJS, Root}; +use dom::bindings::root::{LayoutJS, Root}; use dom::bindings::str::DOMString; use dom::document::Document; use dom::element::{AttributeMutation, Element, RawLayoutElementHelpers}; diff --git a/components/script/dom/testbinding.rs b/components/script/dom/testbinding.rs index 22f8066d24ad..23309f28dd57 100644 --- a/components/script/dom/testbinding.rs +++ b/components/script/dom/testbinding.rs @@ -21,11 +21,11 @@ use dom::bindings::codegen::UnionTypes::{HTMLElementOrUnsignedLongOrStringOrBool use dom::bindings::codegen::UnionTypes::{StringOrLongSequence, StringOrStringSequence, StringSequenceOrUnsignedLong}; use dom::bindings::codegen::UnionTypes::{StringOrUnsignedLong, StringOrBoolean, UnsignedLongOrBoolean}; use dom::bindings::error::{Error, Fallible}; -use dom::bindings::js::Root; use dom::bindings::mozmap::MozMap; use dom::bindings::num::Finite; use dom::bindings::refcounted::TrustedPromise; use dom::bindings::reflector::{DomObject, Reflector, reflect_dom_object}; +use dom::bindings::root::Root; use dom::bindings::str::{ByteString, DOMString, USVString}; use dom::bindings::trace::RootedTraceableBox; use dom::bindings::weakref::MutableWeakRef; diff --git a/components/script/dom/testbindingiterable.rs b/components/script/dom/testbindingiterable.rs index d89d7345f912..2ee9fca631d4 100644 --- a/components/script/dom/testbindingiterable.rs +++ b/components/script/dom/testbindingiterable.rs @@ -7,8 +7,8 @@ use dom::bindings::cell::DOMRefCell; use dom::bindings::codegen::Bindings::TestBindingIterableBinding::{self, TestBindingIterableMethods}; use dom::bindings::error::Fallible; -use dom::bindings::js::Root; use dom::bindings::reflector::{Reflector, reflect_dom_object}; +use dom::bindings::root::Root; use dom::bindings::str::DOMString; use dom::globalscope::GlobalScope; use dom_struct::dom_struct; diff --git a/components/script/dom/testbindingpairiterable.rs b/components/script/dom/testbindingpairiterable.rs index c31d0e34fb52..7d95e95e7d70 100644 --- a/components/script/dom/testbindingpairiterable.rs +++ b/components/script/dom/testbindingpairiterable.rs @@ -9,8 +9,8 @@ use dom::bindings::codegen::Bindings::TestBindingPairIterableBinding; use dom::bindings::codegen::Bindings::TestBindingPairIterableBinding::TestBindingPairIterableMethods; use dom::bindings::error::Fallible; use dom::bindings::iterable::Iterable; -use dom::bindings::js::Root; use dom::bindings::reflector::{Reflector, reflect_dom_object}; +use dom::bindings::root::Root; use dom::bindings::str::DOMString; use dom::globalscope::GlobalScope; use dom_struct::dom_struct; diff --git a/components/script/dom/testrunner.rs b/components/script/dom/testrunner.rs index 1783fce72238..1036f7ea0653 100644 --- a/components/script/dom/testrunner.rs +++ b/components/script/dom/testrunner.rs @@ -6,8 +6,8 @@ use bluetooth_traits::BluetoothRequest; use dom::bindings::codegen::Bindings::TestRunnerBinding; use dom::bindings::codegen::Bindings::TestRunnerBinding::TestRunnerMethods; use dom::bindings::error::{Error, ErrorResult}; -use dom::bindings::js::Root; use dom::bindings::reflector::{DomObject, Reflector, reflect_dom_object}; +use dom::bindings::root::Root; use dom::bindings::str::DOMString; use dom::globalscope::GlobalScope; use dom_struct::dom_struct; diff --git a/components/script/dom/testworklet.rs b/components/script/dom/testworklet.rs index ea032e66faa2..3ff7a8a4b9cb 100644 --- a/components/script/dom/testworklet.rs +++ b/components/script/dom/testworklet.rs @@ -9,10 +9,9 @@ use dom::bindings::codegen::Bindings::TestWorkletBinding::Wrap; use dom::bindings::codegen::Bindings::WorkletBinding::WorkletBinding::WorkletMethods; use dom::bindings::codegen::Bindings::WorkletBinding::WorkletOptions; use dom::bindings::error::Fallible; -use dom::bindings::js::JS; -use dom::bindings::js::Root; use dom::bindings::reflector::Reflector; use dom::bindings::reflector::reflect_dom_object; +use dom::bindings::root::{JS, Root}; use dom::bindings::str::DOMString; use dom::bindings::str::USVString; use dom::promise::Promise; diff --git a/components/script/dom/testworkletglobalscope.rs b/components/script/dom/testworkletglobalscope.rs index 5c9641d5fd2e..f548fb0544f9 100644 --- a/components/script/dom/testworkletglobalscope.rs +++ b/components/script/dom/testworkletglobalscope.rs @@ -5,7 +5,7 @@ use dom::bindings::cell::DOMRefCell; use dom::bindings::codegen::Bindings::TestWorkletGlobalScopeBinding; use dom::bindings::codegen::Bindings::TestWorkletGlobalScopeBinding::TestWorkletGlobalScopeMethods; -use dom::bindings::js::Root; +use dom::bindings::root::Root; use dom::bindings::str::DOMString; use dom::worklet::WorkletExecutor; use dom::workletglobalscope::WorkletGlobalScope; diff --git a/components/script/dom/text.rs b/components/script/dom/text.rs index 0343b373931a..800b9288c143 100644 --- a/components/script/dom/text.rs +++ b/components/script/dom/text.rs @@ -9,8 +9,7 @@ use dom::bindings::codegen::Bindings::TextBinding::{self, TextMethods}; use dom::bindings::codegen::Bindings::WindowBinding::WindowMethods; use dom::bindings::error::{Error, Fallible}; use dom::bindings::inheritance::Castable; -use dom::bindings::js::Root; -use dom::bindings::js::RootedReference; +use dom::bindings::root::{Root, RootedReference}; use dom::bindings::str::DOMString; use dom::characterdata::CharacterData; use dom::document::Document; diff --git a/components/script/dom/textdecoder.rs b/components/script/dom/textdecoder.rs index e1b1edc10480..48dc364c489e 100644 --- a/components/script/dom/textdecoder.rs +++ b/components/script/dom/textdecoder.rs @@ -5,8 +5,8 @@ use dom::bindings::codegen::Bindings::TextDecoderBinding; use dom::bindings::codegen::Bindings::TextDecoderBinding::TextDecoderMethods; use dom::bindings::error::{Error, Fallible}; -use dom::bindings::js::Root; use dom::bindings::reflector::{Reflector, reflect_dom_object}; +use dom::bindings::root::Root; use dom::bindings::str::{DOMString, USVString}; use dom::globalscope::GlobalScope; use dom_struct::dom_struct; diff --git a/components/script/dom/textencoder.rs b/components/script/dom/textencoder.rs index fa527d710732..cb557861d1cf 100644 --- a/components/script/dom/textencoder.rs +++ b/components/script/dom/textencoder.rs @@ -6,8 +6,8 @@ use core::nonzero::NonZero; use dom::bindings::codegen::Bindings::TextEncoderBinding; use dom::bindings::codegen::Bindings::TextEncoderBinding::TextEncoderMethods; use dom::bindings::error::Fallible; -use dom::bindings::js::Root; use dom::bindings::reflector::{Reflector, reflect_dom_object}; +use dom::bindings::root::Root; use dom::bindings::str::{DOMString, USVString}; use dom::globalscope::GlobalScope; use dom_struct::dom_struct; diff --git a/components/script/dom/touch.rs b/components/script/dom/touch.rs index 3ebfd17af125..d7920a2dd196 100644 --- a/components/script/dom/touch.rs +++ b/components/script/dom/touch.rs @@ -4,9 +4,9 @@ use dom::bindings::codegen::Bindings::TouchBinding; use dom::bindings::codegen::Bindings::TouchBinding::TouchMethods; -use dom::bindings::js::{MutJS, Root}; use dom::bindings::num::Finite; use dom::bindings::reflector::{Reflector, reflect_dom_object}; +use dom::bindings::root::{MutJS, Root}; use dom::eventtarget::EventTarget; use dom::window::Window; use dom_struct::dom_struct; diff --git a/components/script/dom/touchevent.rs b/components/script/dom/touchevent.rs index 30044094fcdf..4c29bc484454 100644 --- a/components/script/dom/touchevent.rs +++ b/components/script/dom/touchevent.rs @@ -6,8 +6,8 @@ use dom::bindings::codegen::Bindings::TouchEventBinding; use dom::bindings::codegen::Bindings::TouchEventBinding::TouchEventMethods; use dom::bindings::codegen::Bindings::UIEventBinding::UIEventMethods; use dom::bindings::inheritance::Castable; -use dom::bindings::js::{MutJS, Root}; use dom::bindings::reflector::reflect_dom_object; +use dom::bindings::root::{MutJS, Root}; use dom::bindings::str::DOMString; use dom::event::{EventBubbles, EventCancelable}; use dom::touchlist::TouchList; diff --git a/components/script/dom/touchlist.rs b/components/script/dom/touchlist.rs index 829b6f0d5a6d..299cab0c9824 100644 --- a/components/script/dom/touchlist.rs +++ b/components/script/dom/touchlist.rs @@ -4,8 +4,8 @@ use dom::bindings::codegen::Bindings::TouchListBinding; use dom::bindings::codegen::Bindings::TouchListBinding::TouchListMethods; -use dom::bindings::js::{JS, Root}; use dom::bindings::reflector::{Reflector, reflect_dom_object}; +use dom::bindings::root::{JS, Root}; use dom::touch::Touch; use dom::window::Window; use dom_struct::dom_struct; diff --git a/components/script/dom/transitionevent.rs b/components/script/dom/transitionevent.rs index 28aec7097f88..30870fba978d 100644 --- a/components/script/dom/transitionevent.rs +++ b/components/script/dom/transitionevent.rs @@ -7,9 +7,9 @@ use dom::bindings::codegen::Bindings::TransitionEventBinding; use dom::bindings::codegen::Bindings::TransitionEventBinding::{TransitionEventInit, TransitionEventMethods}; use dom::bindings::error::Fallible; use dom::bindings::inheritance::Castable; -use dom::bindings::js::Root; use dom::bindings::num::Finite; use dom::bindings::reflector::reflect_dom_object; +use dom::bindings::root::Root; use dom::bindings::str::DOMString; use dom::event::Event; use dom::window::Window; diff --git a/components/script/dom/treewalker.rs b/components/script/dom/treewalker.rs index 8515d7b6ae7d..54d085792c25 100644 --- a/components/script/dom/treewalker.rs +++ b/components/script/dom/treewalker.rs @@ -9,9 +9,8 @@ use dom::bindings::codegen::Bindings::NodeFilterBinding::NodeFilterConstants; use dom::bindings::codegen::Bindings::TreeWalkerBinding; use dom::bindings::codegen::Bindings::TreeWalkerBinding::TreeWalkerMethods; use dom::bindings::error::Fallible; -use dom::bindings::js::{JS, MutJS}; -use dom::bindings::js::Root; use dom::bindings::reflector::{Reflector, reflect_dom_object}; +use dom::bindings::root::{JS, MutJS, Root}; use dom::document::Document; use dom::node::Node; use dom_struct::dom_struct; diff --git a/components/script/dom/uievent.rs b/components/script/dom/uievent.rs index f3f77953c292..2c17f4961f27 100644 --- a/components/script/dom/uievent.rs +++ b/components/script/dom/uievent.rs @@ -7,8 +7,8 @@ use dom::bindings::codegen::Bindings::UIEventBinding; use dom::bindings::codegen::Bindings::UIEventBinding::UIEventMethods; use dom::bindings::error::Fallible; use dom::bindings::inheritance::Castable; -use dom::bindings::js::{MutNullableJS, Root, RootedReference}; use dom::bindings::reflector::reflect_dom_object; +use dom::bindings::root::{MutNullableJS, Root, RootedReference}; use dom::bindings::str::DOMString; use dom::event::{Event, EventBubbles, EventCancelable}; use dom::window::Window; diff --git a/components/script/dom/url.rs b/components/script/dom/url.rs index 41de4dcc0c72..b4d17fdc9b6d 100644 --- a/components/script/dom/url.rs +++ b/components/script/dom/url.rs @@ -5,8 +5,8 @@ use dom::bindings::cell::DOMRefCell; use dom::bindings::codegen::Bindings::URLBinding::{self, URLMethods}; use dom::bindings::error::{Error, ErrorResult, Fallible}; -use dom::bindings::js::{MutNullableJS, Root}; use dom::bindings::reflector::{DomObject, Reflector, reflect_dom_object}; +use dom::bindings::root::{MutNullableJS, Root}; use dom::bindings::str::{DOMString, USVString}; use dom::blob::Blob; use dom::globalscope::GlobalScope; diff --git a/components/script/dom/urlsearchparams.rs b/components/script/dom/urlsearchparams.rs index 58391d651516..cdb215a2c95e 100644 --- a/components/script/dom/urlsearchparams.rs +++ b/components/script/dom/urlsearchparams.rs @@ -8,8 +8,8 @@ use dom::bindings::codegen::Bindings::URLSearchParamsBinding::URLSearchParamsWra use dom::bindings::codegen::UnionTypes::USVStringOrURLSearchParams; use dom::bindings::error::Fallible; use dom::bindings::iterable::Iterable; -use dom::bindings::js::Root; use dom::bindings::reflector::{Reflector, reflect_dom_object}; +use dom::bindings::root::Root; use dom::bindings::str::{DOMString, USVString}; use dom::bindings::weakref::MutableWeakRef; use dom::globalscope::GlobalScope; diff --git a/components/script/dom/validitystate.rs b/components/script/dom/validitystate.rs index 4b4273bf353d..dd10dc0e99c2 100755 --- a/components/script/dom/validitystate.rs +++ b/components/script/dom/validitystate.rs @@ -4,8 +4,8 @@ use dom::bindings::codegen::Bindings::ValidityStateBinding; use dom::bindings::codegen::Bindings::ValidityStateBinding::ValidityStateMethods; -use dom::bindings::js::{JS, Root}; use dom::bindings::reflector::{Reflector, reflect_dom_object}; +use dom::bindings::root::{JS, Root}; use dom::element::Element; use dom::window::Window; use dom_struct::dom_struct; diff --git a/components/script/dom/vr.rs b/components/script/dom/vr.rs index 04c63a2f002f..cf5ed1fe084b 100644 --- a/components/script/dom/vr.rs +++ b/components/script/dom/vr.rs @@ -8,8 +8,8 @@ use dom::bindings::codegen::Bindings::VRBinding::VRMethods; use dom::bindings::codegen::Bindings::VRDisplayBinding::VRDisplayMethods; use dom::bindings::error::Error; use dom::bindings::inheritance::Castable; -use dom::bindings::js::{JS, Root}; use dom::bindings::reflector::{DomObject, Reflector, reflect_dom_object}; +use dom::bindings::root::{JS, Root}; use dom::event::Event; use dom::eventtarget::EventTarget; use dom::gamepad::Gamepad; diff --git a/components/script/dom/vrdisplay.rs b/components/script/dom/vrdisplay.rs index 97e126db4edf..a17666e625ea 100644 --- a/components/script/dom/vrdisplay.rs +++ b/components/script/dom/vrdisplay.rs @@ -15,10 +15,10 @@ use dom::bindings::codegen::Bindings::WebGLRenderingContextBinding::WebGLRenderi use dom::bindings::codegen::Bindings::WindowBinding::FrameRequestCallback; use dom::bindings::codegen::Bindings::WindowBinding::WindowBinding::WindowMethods; use dom::bindings::inheritance::Castable; -use dom::bindings::js::{MutNullableJS, MutJS, Root}; use dom::bindings::num::Finite; use dom::bindings::refcounted::Trusted; use dom::bindings::reflector::{DomObject, reflect_dom_object}; +use dom::bindings::root::{MutJS, MutNullableJS, Root}; use dom::bindings::str::DOMString; use dom::event::Event; use dom::eventtarget::EventTarget; diff --git a/components/script/dom/vrdisplaycapabilities.rs b/components/script/dom/vrdisplaycapabilities.rs index 349fd2721406..39e8dabc854c 100644 --- a/components/script/dom/vrdisplaycapabilities.rs +++ b/components/script/dom/vrdisplaycapabilities.rs @@ -5,8 +5,8 @@ use dom::bindings::cell::DOMRefCell; use dom::bindings::codegen::Bindings::VRDisplayCapabilitiesBinding; use dom::bindings::codegen::Bindings::VRDisplayCapabilitiesBinding::VRDisplayCapabilitiesMethods; -use dom::bindings::js::Root; use dom::bindings::reflector::{Reflector, reflect_dom_object}; +use dom::bindings::root::Root; use dom::globalscope::GlobalScope; use dom_struct::dom_struct; use webvr_traits::WebVRDisplayCapabilities; diff --git a/components/script/dom/vrdisplayevent.rs b/components/script/dom/vrdisplayevent.rs index 1e931f6983d6..d7fb88d8bdc4 100644 --- a/components/script/dom/vrdisplayevent.rs +++ b/components/script/dom/vrdisplayevent.rs @@ -8,8 +8,8 @@ use dom::bindings::codegen::Bindings::VRDisplayEventBinding::VRDisplayEventMetho use dom::bindings::codegen::Bindings::VRDisplayEventBinding::VRDisplayEventReason; use dom::bindings::error::Fallible; use dom::bindings::inheritance::Castable; -use dom::bindings::js::{JS, Root}; use dom::bindings::reflector::{DomObject, reflect_dom_object}; +use dom::bindings::root::{JS, Root}; use dom::bindings::str::DOMString; use dom::event::Event; use dom::globalscope::GlobalScope; diff --git a/components/script/dom/vreyeparameters.rs b/components/script/dom/vreyeparameters.rs index d77350ae1402..33e737c6265c 100644 --- a/components/script/dom/vreyeparameters.rs +++ b/components/script/dom/vreyeparameters.rs @@ -6,8 +6,8 @@ use core::nonzero::NonZero; use dom::bindings::cell::DOMRefCell; use dom::bindings::codegen::Bindings::VREyeParametersBinding; use dom::bindings::codegen::Bindings::VREyeParametersBinding::VREyeParametersMethods; -use dom::bindings::js::{JS, Root}; use dom::bindings::reflector::{Reflector, reflect_dom_object}; +use dom::bindings::root::{JS, Root}; use dom::globalscope::GlobalScope; use dom::vrfieldofview::VRFieldOfView; use dom_struct::dom_struct; diff --git a/components/script/dom/vrfieldofview.rs b/components/script/dom/vrfieldofview.rs index 80a2f767d81e..a91bb13fa83b 100644 --- a/components/script/dom/vrfieldofview.rs +++ b/components/script/dom/vrfieldofview.rs @@ -5,9 +5,9 @@ use dom::bindings::cell::DOMRefCell; use dom::bindings::codegen::Bindings::VRFieldOfViewBinding; use dom::bindings::codegen::Bindings::VRFieldOfViewBinding::VRFieldOfViewMethods; -use dom::bindings::js::Root; use dom::bindings::num::Finite; use dom::bindings::reflector::{Reflector, reflect_dom_object}; +use dom::bindings::root::Root; use dom::globalscope::GlobalScope; use dom_struct::dom_struct; use webvr_traits::WebVRFieldOfView; diff --git a/components/script/dom/vrframedata.rs b/components/script/dom/vrframedata.rs index 70e238e9fb5f..2a98da00f916 100644 --- a/components/script/dom/vrframedata.rs +++ b/components/script/dom/vrframedata.rs @@ -6,9 +6,9 @@ use core::nonzero::NonZero; use dom::bindings::codegen::Bindings::VRFrameDataBinding; use dom::bindings::codegen::Bindings::VRFrameDataBinding::VRFrameDataMethods; use dom::bindings::error::Fallible; -use dom::bindings::js::{JS, Root}; use dom::bindings::num::Finite; use dom::bindings::reflector::{DomObject, Reflector, reflect_dom_object}; +use dom::bindings::root::{JS, Root}; use dom::globalscope::GlobalScope; use dom::vrpose::VRPose; use dom::window::Window; diff --git a/components/script/dom/vrpose.rs b/components/script/dom/vrpose.rs index 539a42e5e3bc..fb41149cd830 100644 --- a/components/script/dom/vrpose.rs +++ b/components/script/dom/vrpose.rs @@ -5,8 +5,8 @@ use core::nonzero::NonZero; use dom::bindings::codegen::Bindings::VRPoseBinding; use dom::bindings::codegen::Bindings::VRPoseBinding::VRPoseMethods; -use dom::bindings::js::Root; use dom::bindings::reflector::{DomObject, Reflector, reflect_dom_object}; +use dom::bindings::root::Root; use dom::globalscope::GlobalScope; use dom_struct::dom_struct; use js::jsapi::{Heap, JSContext, JSObject}; diff --git a/components/script/dom/vrstageparameters.rs b/components/script/dom/vrstageparameters.rs index 7bfaa95ea76d..2161b215560e 100644 --- a/components/script/dom/vrstageparameters.rs +++ b/components/script/dom/vrstageparameters.rs @@ -6,9 +6,9 @@ use core::nonzero::NonZero; use dom::bindings::cell::DOMRefCell; use dom::bindings::codegen::Bindings::VRStageParametersBinding; use dom::bindings::codegen::Bindings::VRStageParametersBinding::VRStageParametersMethods; -use dom::bindings::js::Root; use dom::bindings::num::Finite; use dom::bindings::reflector::{DomObject, Reflector, reflect_dom_object}; +use dom::bindings::root::Root; use dom::globalscope::GlobalScope; use dom_struct::dom_struct; use js::jsapi::{Heap, JSContext, JSObject}; diff --git a/components/script/dom/webgl_extensions/ext/oesstandardderivatives.rs b/components/script/dom/webgl_extensions/ext/oesstandardderivatives.rs index 573ebe8387d2..1d2ccb34d9ff 100644 --- a/components/script/dom/webgl_extensions/ext/oesstandardderivatives.rs +++ b/components/script/dom/webgl_extensions/ext/oesstandardderivatives.rs @@ -4,8 +4,8 @@ use dom::bindings::codegen::Bindings::OESStandardDerivativesBinding; use dom::bindings::codegen::Bindings::OESStandardDerivativesBinding::OESStandardDerivativesConstants; -use dom::bindings::js::Root; use dom::bindings::reflector::{DomObject, Reflector, reflect_dom_object}; +use dom::bindings::root::Root; use dom::webglrenderingcontext::WebGLRenderingContext; use dom_struct::dom_struct; use super::{WebGLExtension, WebGLExtensions}; diff --git a/components/script/dom/webgl_extensions/ext/oestexturefloat.rs b/components/script/dom/webgl_extensions/ext/oestexturefloat.rs index 58983c46caf1..c048b2d7f847 100644 --- a/components/script/dom/webgl_extensions/ext/oestexturefloat.rs +++ b/components/script/dom/webgl_extensions/ext/oestexturefloat.rs @@ -3,8 +3,8 @@ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ use dom::bindings::codegen::Bindings::OESTextureFloatBinding; -use dom::bindings::js::Root; use dom::bindings::reflector::{DomObject, Reflector, reflect_dom_object}; +use dom::bindings::root::Root; use dom::webglrenderingcontext::WebGLRenderingContext; use dom_struct::dom_struct; use super::{constants as webgl, ext_constants as gl, WebGLExtension, WebGLExtensions}; diff --git a/components/script/dom/webgl_extensions/ext/oestexturefloatlinear.rs b/components/script/dom/webgl_extensions/ext/oestexturefloatlinear.rs index d9bd061a7f11..12d04195a593 100644 --- a/components/script/dom/webgl_extensions/ext/oestexturefloatlinear.rs +++ b/components/script/dom/webgl_extensions/ext/oestexturefloatlinear.rs @@ -3,8 +3,8 @@ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ use dom::bindings::codegen::Bindings::OESTextureFloatLinearBinding; -use dom::bindings::js::Root; use dom::bindings::reflector::{DomObject, Reflector, reflect_dom_object}; +use dom::bindings::root::Root; use dom::webglrenderingcontext::WebGLRenderingContext; use dom_struct::dom_struct; use super::{constants as webgl, WebGLExtension, WebGLExtensions}; diff --git a/components/script/dom/webgl_extensions/ext/oestexturehalffloat.rs b/components/script/dom/webgl_extensions/ext/oestexturehalffloat.rs index 7fe58f9b6b98..15a9fad531e1 100644 --- a/components/script/dom/webgl_extensions/ext/oestexturehalffloat.rs +++ b/components/script/dom/webgl_extensions/ext/oestexturehalffloat.rs @@ -3,8 +3,8 @@ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ use dom::bindings::codegen::Bindings::OESTextureHalfFloatBinding::{self, OESTextureHalfFloatConstants}; -use dom::bindings::js::Root; use dom::bindings::reflector::{DomObject, Reflector, reflect_dom_object}; +use dom::bindings::root::Root; use dom::webglrenderingcontext::WebGLRenderingContext; use dom_struct::dom_struct; use super::{constants as webgl, ext_constants as gl, WebGLExtension, WebGLExtensions}; diff --git a/components/script/dom/webgl_extensions/ext/oestexturehalffloatlinear.rs b/components/script/dom/webgl_extensions/ext/oestexturehalffloatlinear.rs index 3bf9869b26a3..afaeedd5a0c0 100644 --- a/components/script/dom/webgl_extensions/ext/oestexturehalffloatlinear.rs +++ b/components/script/dom/webgl_extensions/ext/oestexturehalffloatlinear.rs @@ -4,8 +4,8 @@ use dom::bindings::codegen::Bindings::OESTextureHalfFloatBinding::OESTextureHalfFloatConstants; use dom::bindings::codegen::Bindings::OESTextureHalfFloatLinearBinding; -use dom::bindings::js::Root; use dom::bindings::reflector::{DomObject, Reflector, reflect_dom_object}; +use dom::bindings::root::Root; use dom::webglrenderingcontext::WebGLRenderingContext; use dom_struct::dom_struct; use super::{WebGLExtension, WebGLExtensions}; diff --git a/components/script/dom/webgl_extensions/ext/oesvertexarrayobject.rs b/components/script/dom/webgl_extensions/ext/oesvertexarrayobject.rs index 48385a3d50fa..b3b5a958997f 100644 --- a/components/script/dom/webgl_extensions/ext/oesvertexarrayobject.rs +++ b/components/script/dom/webgl_extensions/ext/oesvertexarrayobject.rs @@ -5,8 +5,8 @@ use canvas_traits::webgl::{webgl_channel, WebGLCommand, WebGLError}; use dom::bindings::codegen::Bindings::OESVertexArrayObjectBinding::{self, OESVertexArrayObjectMethods}; use dom::bindings::codegen::Bindings::OESVertexArrayObjectBinding::OESVertexArrayObjectConstants; -use dom::bindings::js::{JS, MutNullableJS, Root}; use dom::bindings::reflector::{DomObject, Reflector, reflect_dom_object}; +use dom::bindings::root::{JS, MutNullableJS, Root}; use dom::webglrenderingcontext::WebGLRenderingContext; use dom::webglvertexarrayobjectoes::WebGLVertexArrayObjectOES; use dom_struct::dom_struct; diff --git a/components/script/dom/webgl_extensions/ext/webglvertexarrayobjectoes.rs b/components/script/dom/webgl_extensions/ext/webglvertexarrayobjectoes.rs index 2fe109cafa68..eeca0a247072 100644 --- a/components/script/dom/webgl_extensions/ext/webglvertexarrayobjectoes.rs +++ b/components/script/dom/webgl_extensions/ext/webglvertexarrayobjectoes.rs @@ -7,9 +7,8 @@ use core::cell::Ref; use core::iter::FromIterator; use dom::bindings::cell::DOMRefCell; use dom::bindings::codegen::Bindings::WebGLVertexArrayObjectOESBinding; -use dom::bindings::js::{JS, MutNullableJS}; -use dom::bindings::js::Root; use dom::bindings::reflector::reflect_dom_object; +use dom::bindings::root::{JS, MutNullableJS, Root}; use dom::globalscope::GlobalScope; use dom::webglbuffer::WebGLBuffer; use dom::webglobject::WebGLObject; diff --git a/components/script/dom/webgl_extensions/extension.rs b/components/script/dom/webgl_extensions/extension.rs index 3463a1d32732..7cb4e5b4d257 100644 --- a/components/script/dom/webgl_extensions/extension.rs +++ b/components/script/dom/webgl_extensions/extension.rs @@ -2,8 +2,8 @@ * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ -use dom::bindings::js::Root; use dom::bindings::reflector::DomObject; +use dom::bindings::root::Root; use dom::bindings::trace::JSTraceable; use dom::webglrenderingcontext::WebGLRenderingContext; use super::WebGLExtensions; diff --git a/components/script/dom/webgl_extensions/extensions.rs b/components/script/dom/webgl_extensions/extensions.rs index 62ee5f260864..1eca2aac3ca2 100644 --- a/components/script/dom/webgl_extensions/extensions.rs +++ b/components/script/dom/webgl_extensions/extensions.rs @@ -9,7 +9,7 @@ use dom::bindings::cell::DOMRefCell; use dom::bindings::codegen::Bindings::OESStandardDerivativesBinding::OESStandardDerivativesConstants; use dom::bindings::codegen::Bindings::OESTextureHalfFloatBinding::OESTextureHalfFloatConstants; use dom::bindings::codegen::Bindings::WebGLRenderingContextBinding::WebGLRenderingContextConstants as constants; -use dom::bindings::js::Root; +use dom::bindings::root::Root; use dom::bindings::trace::JSTraceable; use dom::webglrenderingcontext::WebGLRenderingContext; use fnv::{FnvHashMap, FnvHashSet}; diff --git a/components/script/dom/webgl_extensions/wrapper.rs b/components/script/dom/webgl_extensions/wrapper.rs index 3d3f8128e338..53aba5ed4626 100644 --- a/components/script/dom/webgl_extensions/wrapper.rs +++ b/components/script/dom/webgl_extensions/wrapper.rs @@ -3,8 +3,8 @@ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ use core::nonzero::NonZero; -use dom::bindings::js::{MutNullableJS, Root}; use dom::bindings::reflector::DomObject; +use dom::bindings::root::{MutNullableJS, Root}; use dom::bindings::trace::JSTraceable; use dom::webglrenderingcontext::WebGLRenderingContext; use heapsize::HeapSizeOf; diff --git a/components/script/dom/webgl_validations/tex_image_2d.rs b/components/script/dom/webgl_validations/tex_image_2d.rs index cd5320453c74..7392dae0ae11 100644 --- a/components/script/dom/webgl_validations/tex_image_2d.rs +++ b/components/script/dom/webgl_validations/tex_image_2d.rs @@ -3,7 +3,7 @@ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ use canvas_traits::webgl::WebGLError::*; -use dom::bindings::js::Root; +use dom::bindings::root::Root; use dom::webglrenderingcontext::WebGLRenderingContext; use dom::webgltexture::WebGLTexture; use std::{self, fmt}; diff --git a/components/script/dom/webglactiveinfo.rs b/components/script/dom/webglactiveinfo.rs index 359a772a2683..596729b15fe5 100644 --- a/components/script/dom/webglactiveinfo.rs +++ b/components/script/dom/webglactiveinfo.rs @@ -5,8 +5,8 @@ // https://www.khronos.org/registry/webgl/specs/latest/1.0/webgl.idl use dom::bindings::codegen::Bindings::WebGLActiveInfoBinding; use dom::bindings::codegen::Bindings::WebGLActiveInfoBinding::WebGLActiveInfoMethods; -use dom::bindings::js::Root; use dom::bindings::reflector::{Reflector, reflect_dom_object}; +use dom::bindings::root::Root; use dom::bindings::str::DOMString; use dom::window::Window; use dom_struct::dom_struct; diff --git a/components/script/dom/webglbuffer.rs b/components/script/dom/webglbuffer.rs index 96db4466d56b..4a3e26344534 100644 --- a/components/script/dom/webglbuffer.rs +++ b/components/script/dom/webglbuffer.rs @@ -7,8 +7,8 @@ use canvas_traits::webgl::{WebGLBufferId, WebGLCommand, WebGLError, WebGLMsgSend use canvas_traits::webgl::webgl_channel; use dom::bindings::cell::DOMRefCell; use dom::bindings::codegen::Bindings::WebGLBufferBinding; -use dom::bindings::js::Root; use dom::bindings::reflector::reflect_dom_object; +use dom::bindings::root::Root; use dom::webglobject::WebGLObject; use dom::window::Window; use dom_struct::dom_struct; diff --git a/components/script/dom/webglcontextevent.rs b/components/script/dom/webglcontextevent.rs index ce569ee8cbc5..494740a96979 100644 --- a/components/script/dom/webglcontextevent.rs +++ b/components/script/dom/webglcontextevent.rs @@ -8,8 +8,8 @@ use dom::bindings::codegen::Bindings::WebGLContextEventBinding::WebGLContextEven use dom::bindings::codegen::Bindings::WebGLContextEventBinding::WebGLContextEventMethods; use dom::bindings::error::Fallible; use dom::bindings::inheritance::Castable; -use dom::bindings::js::Root; use dom::bindings::reflector::reflect_dom_object; +use dom::bindings::root::Root; use dom::bindings::str::DOMString; use dom::event::{Event, EventBubbles, EventCancelable}; use dom::window::Window; diff --git a/components/script/dom/webglframebuffer.rs b/components/script/dom/webglframebuffer.rs index d4f524521781..750bc5edfdc8 100644 --- a/components/script/dom/webglframebuffer.rs +++ b/components/script/dom/webglframebuffer.rs @@ -9,8 +9,8 @@ use canvas_traits::webgl::webgl_channel; use dom::bindings::cell::DOMRefCell; use dom::bindings::codegen::Bindings::WebGLFramebufferBinding; use dom::bindings::codegen::Bindings::WebGLRenderingContextBinding::WebGLRenderingContextConstants as constants; -use dom::bindings::js::{JS, Root}; use dom::bindings::reflector::reflect_dom_object; +use dom::bindings::root::{JS, Root}; use dom::webglobject::WebGLObject; use dom::webglrenderbuffer::WebGLRenderbuffer; use dom::webgltexture::WebGLTexture; diff --git a/components/script/dom/webglprogram.rs b/components/script/dom/webglprogram.rs index 6c298bb83fbb..cc2425036076 100644 --- a/components/script/dom/webglprogram.rs +++ b/components/script/dom/webglprogram.rs @@ -7,8 +7,8 @@ use canvas_traits::webgl::{WebGLCommand, WebGLError, WebGLMsgSender, WebGLParame use canvas_traits::webgl::webgl_channel; use dom::bindings::codegen::Bindings::WebGLProgramBinding; use dom::bindings::codegen::Bindings::WebGLRenderingContextBinding::WebGLRenderingContextConstants as constants; -use dom::bindings::js::{MutNullableJS, Root}; use dom::bindings::reflector::{DomObject, reflect_dom_object}; +use dom::bindings::root::{MutNullableJS, Root}; use dom::bindings::str::DOMString; use dom::webglactiveinfo::WebGLActiveInfo; use dom::webglobject::WebGLObject; diff --git a/components/script/dom/webglrenderbuffer.rs b/components/script/dom/webglrenderbuffer.rs index 9a855651cc92..be324d5e9052 100644 --- a/components/script/dom/webglrenderbuffer.rs +++ b/components/script/dom/webglrenderbuffer.rs @@ -6,8 +6,8 @@ use canvas_traits::webgl::{webgl_channel, WebGLCommand, WebGLError, WebGLMsgSender, WebGLRenderbufferId, WebGLResult}; use dom::bindings::codegen::Bindings::WebGLRenderbufferBinding; use dom::bindings::codegen::Bindings::WebGLRenderingContextBinding::WebGLRenderingContextConstants as constants; -use dom::bindings::js::Root; use dom::bindings::reflector::reflect_dom_object; +use dom::bindings::root::Root; use dom::webglobject::WebGLObject; use dom::window::Window; use dom_struct::dom_struct; diff --git a/components/script/dom/webglrenderingcontext.rs b/components/script/dom/webglrenderingcontext.rs index c9112ddc9ff9..a2ef298589f6 100644 --- a/components/script/dom/webglrenderingcontext.rs +++ b/components/script/dom/webglrenderingcontext.rs @@ -19,8 +19,8 @@ use dom::bindings::codegen::UnionTypes::ImageDataOrHTMLImageElementOrHTMLCanvasE use dom::bindings::conversions::{ConversionResult, FromJSValConvertible, ToJSValConvertible}; use dom::bindings::error::{Error, Fallible}; use dom::bindings::inheritance::Castable; -use dom::bindings::js::{JS, LayoutJS, MutNullableJS, Root}; use dom::bindings::reflector::{DomObject, Reflector, reflect_dom_object}; +use dom::bindings::root::{JS, LayoutJS, MutNullableJS, Root}; use dom::bindings::str::DOMString; use dom::event::{Event, EventBubbles, EventCancelable}; use dom::htmlcanvaselement::HTMLCanvasElement; diff --git a/components/script/dom/webglshader.rs b/components/script/dom/webglshader.rs index cd33092f26e1..8f9c0f78f3b1 100644 --- a/components/script/dom/webglshader.rs +++ b/components/script/dom/webglshader.rs @@ -7,8 +7,8 @@ use angle::hl::{BuiltInResources, Output, ShaderValidator}; use canvas_traits::webgl::{webgl_channel, WebGLCommand, WebGLMsgSender, WebGLParameter, WebGLResult, WebGLShaderId}; use dom::bindings::cell::DOMRefCell; use dom::bindings::codegen::Bindings::WebGLShaderBinding; -use dom::bindings::js::Root; use dom::bindings::reflector::reflect_dom_object; +use dom::bindings::root::Root; use dom::bindings::str::DOMString; use dom::webgl_extensions::WebGLExtensions; use dom::webgl_extensions::ext::oesstandardderivatives::OESStandardDerivatives; diff --git a/components/script/dom/webglshaderprecisionformat.rs b/components/script/dom/webglshaderprecisionformat.rs index 10a76b73fe1b..befad009bb5f 100644 --- a/components/script/dom/webglshaderprecisionformat.rs +++ b/components/script/dom/webglshaderprecisionformat.rs @@ -7,8 +7,8 @@ // https://www.khronos.org/registry/webgl/specs/latest/1.0/webgl.idl use dom::bindings::codegen::Bindings::WebGLShaderPrecisionFormatBinding; use dom::bindings::codegen::Bindings::WebGLShaderPrecisionFormatBinding::WebGLShaderPrecisionFormatMethods; -use dom::bindings::js::Root; use dom::bindings::reflector::{Reflector, reflect_dom_object}; +use dom::bindings::root::Root; use dom::window::Window; use dom_struct::dom_struct; diff --git a/components/script/dom/webgltexture.rs b/components/script/dom/webgltexture.rs index b4466ee93965..22800430a6b0 100644 --- a/components/script/dom/webgltexture.rs +++ b/components/script/dom/webgltexture.rs @@ -8,8 +8,8 @@ use canvas_traits::webgl::{webgl_channel, WebGLCommand, WebGLError, WebGLMsgSend use dom::bindings::cell::DOMRefCell; use dom::bindings::codegen::Bindings::WebGLRenderingContextBinding::WebGLRenderingContextConstants as constants; use dom::bindings::codegen::Bindings::WebGLTextureBinding; -use dom::bindings::js::Root; use dom::bindings::reflector::reflect_dom_object; +use dom::bindings::root::Root; use dom::webgl_validations::types::{TexImageTarget, TexFormat, TexDataType}; use dom::webglobject::WebGLObject; use dom::window::Window; diff --git a/components/script/dom/webgluniformlocation.rs b/components/script/dom/webgluniformlocation.rs index 47292adeb18b..ded74593c678 100644 --- a/components/script/dom/webgluniformlocation.rs +++ b/components/script/dom/webgluniformlocation.rs @@ -5,8 +5,8 @@ // https://www.khronos.org/registry/webgl/specs/latest/1.0/webgl.idl use canvas_traits::webgl::WebGLProgramId; use dom::bindings::codegen::Bindings::WebGLUniformLocationBinding; -use dom::bindings::js::Root; use dom::bindings::reflector::{Reflector, reflect_dom_object}; +use dom::bindings::root::Root; use dom::window::Window; use dom_struct::dom_struct; diff --git a/components/script/dom/websocket.rs b/components/script/dom/websocket.rs index 3d482bb4fa56..4e25a64fce70 100644 --- a/components/script/dom/websocket.rs +++ b/components/script/dom/websocket.rs @@ -10,9 +10,9 @@ use dom::bindings::codegen::UnionTypes::StringOrStringSequence; use dom::bindings::conversions::ToJSValConvertible; use dom::bindings::error::{Error, ErrorResult, Fallible}; use dom::bindings::inheritance::Castable; -use dom::bindings::js::Root; use dom::bindings::refcounted::Trusted; use dom::bindings::reflector::{DomObject, reflect_dom_object}; +use dom::bindings::root::Root; use dom::bindings::str::{DOMString, USVString, is_token}; use dom::blob::{Blob, BlobImpl}; use dom::closeevent::CloseEvent; diff --git a/components/script/dom/window.rs b/components/script/dom/window.rs index 7ad5d0c02ace..590591a070a3 100644 --- a/components/script/dom/window.rs +++ b/components/script/dom/window.rs @@ -18,10 +18,10 @@ use dom::bindings::codegen::Bindings::WindowBinding::{ScrollBehavior, ScrollToOp use dom::bindings::codegen::UnionTypes::RequestOrUSVString; use dom::bindings::error::{Error, ErrorResult, Fallible}; use dom::bindings::inheritance::Castable; -use dom::bindings::js::{JS, MutNullableJS, Root}; use dom::bindings::num::Finite; use dom::bindings::refcounted::Trusted; use dom::bindings::reflector::DomObject; +use dom::bindings::root::{JS, MutNullableJS, Root}; use dom::bindings::str::DOMString; use dom::bindings::structuredclone::StructuredCloneData; use dom::bindings::trace::RootedTraceableBox; diff --git a/components/script/dom/windowproxy.rs b/components/script/dom/windowproxy.rs index 2578bb3b46c6..e76435818d93 100644 --- a/components/script/dom/windowproxy.rs +++ b/components/script/dom/windowproxy.rs @@ -5,9 +5,9 @@ use dom::bindings::conversions::{ToJSValConvertible, root_from_handleobject}; use dom::bindings::error::{Error, throw_dom_exception}; use dom::bindings::inheritance::Castable; -use dom::bindings::js::{JS, Root, RootedReference}; use dom::bindings::proxyhandler::{fill_property_descriptor, get_property_descriptor}; use dom::bindings::reflector::{DomObject, Reflector}; +use dom::bindings::root::{JS, Root, RootedReference}; use dom::bindings::trace::JSTraceable; use dom::bindings::utils::{WindowProxyHandler, get_array_index_from_id, AsVoidPtr}; use dom::dissimilaroriginwindow::DissimilarOriginWindow; diff --git a/components/script/dom/worker.rs b/components/script/dom/worker.rs index 7d9a3875f1b2..31e65c563b36 100644 --- a/components/script/dom/worker.rs +++ b/components/script/dom/worker.rs @@ -9,9 +9,9 @@ use dom::bindings::codegen::Bindings::WorkerBinding; use dom::bindings::codegen::Bindings::WorkerBinding::WorkerMethods; use dom::bindings::error::{Error, ErrorResult, Fallible}; use dom::bindings::inheritance::Castable; -use dom::bindings::js::Root; use dom::bindings::refcounted::Trusted; use dom::bindings::reflector::{DomObject, reflect_dom_object}; +use dom::bindings::root::Root; use dom::bindings::str::DOMString; use dom::bindings::structuredclone::StructuredCloneData; use dom::dedicatedworkerglobalscope::DedicatedWorkerGlobalScope; diff --git a/components/script/dom/workerglobalscope.rs b/components/script/dom/workerglobalscope.rs index 8ea1a49ccbec..6817a466400c 100644 --- a/components/script/dom/workerglobalscope.rs +++ b/components/script/dom/workerglobalscope.rs @@ -9,8 +9,8 @@ use dom::bindings::codegen::Bindings::WorkerGlobalScopeBinding::WorkerGlobalScop use dom::bindings::codegen::UnionTypes::RequestOrUSVString; use dom::bindings::error::{Error, ErrorResult, Fallible, report_pending_exception}; use dom::bindings::inheritance::Castable; -use dom::bindings::js::{MutNullableJS, Root}; use dom::bindings::reflector::DomObject; +use dom::bindings::root::{MutNullableJS, Root}; use dom::bindings::settings_stack::AutoEntryScript; use dom::bindings::str::DOMString; use dom::bindings::trace::RootedTraceableBox; diff --git a/components/script/dom/workerlocation.rs b/components/script/dom/workerlocation.rs index f52e0efb69a1..d7ceda40531a 100644 --- a/components/script/dom/workerlocation.rs +++ b/components/script/dom/workerlocation.rs @@ -4,8 +4,8 @@ use dom::bindings::codegen::Bindings::WorkerLocationBinding; use dom::bindings::codegen::Bindings::WorkerLocationBinding::WorkerLocationMethods; -use dom::bindings::js::Root; use dom::bindings::reflector::{Reflector, reflect_dom_object}; +use dom::bindings::root::Root; use dom::bindings::str::{DOMString, USVString}; use dom::urlhelper::UrlHelper; use dom::workerglobalscope::WorkerGlobalScope; diff --git a/components/script/dom/workernavigator.rs b/components/script/dom/workernavigator.rs index dafa3325b388..165deaf5b5d0 100644 --- a/components/script/dom/workernavigator.rs +++ b/components/script/dom/workernavigator.rs @@ -4,8 +4,8 @@ use dom::bindings::codegen::Bindings::WorkerNavigatorBinding; use dom::bindings::codegen::Bindings::WorkerNavigatorBinding::WorkerNavigatorMethods; -use dom::bindings::js::{MutNullableJS, Root}; use dom::bindings::reflector::{DomObject, Reflector, reflect_dom_object}; +use dom::bindings::root::{MutNullableJS, Root}; use dom::bindings::str::DOMString; use dom::navigatorinfo; use dom::permissions::Permissions; diff --git a/components/script/dom/worklet.rs b/components/script/dom/worklet.rs index 6049f7cf0e00..cc96618ae7a7 100644 --- a/components/script/dom/worklet.rs +++ b/components/script/dom/worklet.rs @@ -17,12 +17,10 @@ use dom::bindings::codegen::Bindings::WorkletBinding::WorkletOptions; use dom::bindings::codegen::Bindings::WorkletBinding::Wrap; use dom::bindings::error::Error; use dom::bindings::inheritance::Castable; -use dom::bindings::js::JS; -use dom::bindings::js::Root; -use dom::bindings::js::RootCollection; use dom::bindings::refcounted::TrustedPromise; use dom::bindings::reflector::Reflector; use dom::bindings::reflector::reflect_dom_object; +use dom::bindings::root::{JS, Root, RootCollection}; use dom::bindings::str::USVString; use dom::bindings::trace::JSTraceable; use dom::bindings::trace::RootedTraceableBox; diff --git a/components/script/dom/workletglobalscope.rs b/components/script/dom/workletglobalscope.rs index 210ede4172e6..a699a0e326b6 100644 --- a/components/script/dom/workletglobalscope.rs +++ b/components/script/dom/workletglobalscope.rs @@ -4,7 +4,7 @@ use devtools_traits::ScriptToDevtoolsControlMsg; use dom::bindings::inheritance::Castable; -use dom::bindings::js::Root; +use dom::bindings::root::Root; use dom::globalscope::GlobalScope; use dom::paintworkletglobalscope::PaintWorkletGlobalScope; use dom::paintworkletglobalscope::PaintWorkletTask; diff --git a/components/script/dom/xmldocument.rs b/components/script/dom/xmldocument.rs index 59c6739fb2d8..182cf65f2e2e 100644 --- a/components/script/dom/xmldocument.rs +++ b/components/script/dom/xmldocument.rs @@ -7,8 +7,8 @@ use document_loader::DocumentLoader; use dom::bindings::codegen::Bindings::DocumentBinding::DocumentMethods; use dom::bindings::codegen::Bindings::XMLDocumentBinding::{self, XMLDocumentMethods}; use dom::bindings::inheritance::Castable; -use dom::bindings::js::Root; use dom::bindings::reflector::reflect_dom_object; +use dom::bindings::root::Root; use dom::bindings::str::DOMString; use dom::document::{Document, DocumentSource, HasBrowsingContext, IsHTMLDocument}; use dom::location::Location; diff --git a/components/script/dom/xmlhttprequest.rs b/components/script/dom/xmlhttprequest.rs index 559c7ef31a6b..3d74870f275e 100644 --- a/components/script/dom/xmlhttprequest.rs +++ b/components/script/dom/xmlhttprequest.rs @@ -14,9 +14,9 @@ use dom::bindings::codegen::UnionTypes::DocumentOrBodyInit; use dom::bindings::conversions::ToJSValConvertible; use dom::bindings::error::{Error, ErrorResult, Fallible}; use dom::bindings::inheritance::Castable; -use dom::bindings::js::{JS, MutNullableJS, Root}; use dom::bindings::refcounted::Trusted; use dom::bindings::reflector::{DomObject, reflect_dom_object}; +use dom::bindings::root::{JS, MutNullableJS, Root}; use dom::bindings::str::{ByteString, DOMString, USVString, is_token}; use dom::blob::{Blob, BlobImpl}; use dom::document::{Document, HasBrowsingContext, IsHTMLDocument}; diff --git a/components/script/dom/xmlhttprequestupload.rs b/components/script/dom/xmlhttprequestupload.rs index 02a54001388e..e390caa5a05c 100644 --- a/components/script/dom/xmlhttprequestupload.rs +++ b/components/script/dom/xmlhttprequestupload.rs @@ -3,8 +3,8 @@ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ use dom::bindings::codegen::Bindings::XMLHttpRequestUploadBinding; -use dom::bindings::js::Root; use dom::bindings::reflector::reflect_dom_object; +use dom::bindings::root::Root; use dom::globalscope::GlobalScope; use dom::xmlhttprequesteventtarget::XMLHttpRequestEventTarget; use dom_struct::dom_struct; diff --git a/components/script/fetch.rs b/components/script/fetch.rs index 47be4ced1309..babd4c7e9426 100644 --- a/components/script/fetch.rs +++ b/components/script/fetch.rs @@ -8,9 +8,9 @@ use dom::bindings::codegen::Bindings::ResponseBinding::ResponseBinding::Response use dom::bindings::codegen::Bindings::ResponseBinding::ResponseType as DOMResponseType; use dom::bindings::error::Error; use dom::bindings::inheritance::Castable; -use dom::bindings::js::Root; use dom::bindings::refcounted::{Trusted, TrustedPromise}; use dom::bindings::reflector::DomObject; +use dom::bindings::root::Root; use dom::bindings::trace::RootedTraceableBox; use dom::globalscope::GlobalScope; use dom::headers::Guard; diff --git a/components/script/lib.rs b/components/script/lib.rs index 0e63fef2a02b..d382e95ced80 100644 --- a/components/script/lib.rs +++ b/components/script/lib.rs @@ -141,7 +141,7 @@ mod webdriver_handlers; pub mod layout_exports { pub use dom::bindings::inheritance::{CharacterDataTypeId, ElementTypeId}; pub use dom::bindings::inheritance::{HTMLElementTypeId, NodeTypeId}; - pub use dom::bindings::js::LayoutJS; + pub use dom::bindings::root::LayoutJS; pub use dom::characterdata::LayoutCharacterDataHelpers; pub use dom::document::{Document, LayoutDocumentHelpers, PendingRestyle}; pub use dom::element::{Element, LayoutElementHelpers, RawLayoutElementHelpers}; diff --git a/components/script/microtask.rs b/components/script/microtask.rs index 23288fefc8cd..f88f6e8fa4c7 100644 --- a/components/script/microtask.rs +++ b/components/script/microtask.rs @@ -9,7 +9,7 @@ use dom::bindings::callback::ExceptionHandling; use dom::bindings::cell::DOMRefCell; use dom::bindings::codegen::Bindings::PromiseBinding::PromiseJobCallback; -use dom::bindings::js::Root; +use dom::bindings::root::Root; use dom::globalscope::GlobalScope; use dom::htmlimageelement::ImageElementMicrotask; use dom::htmlmediaelement::MediaElementMicrotask; diff --git a/components/script/script_runtime.rs b/components/script/script_runtime.rs index be5acd33a6ac..e437e1a60019 100644 --- a/components/script/script_runtime.rs +++ b/components/script/script_runtime.rs @@ -6,8 +6,8 @@ //! script thread, the dom, and the worker threads. use dom::bindings::codegen::Bindings::PromiseBinding::PromiseJobCallback; -use dom::bindings::js::{RootCollection, RootCollectionPtr, trace_roots}; use dom::bindings::refcounted::{LiveDOMReferences, trace_refcounted_objects}; +use dom::bindings::root::{RootCollection, RootCollectionPtr, trace_roots}; use dom::bindings::settings_stack; use dom::bindings::trace::{JSTraceable, trace_traceables}; use dom::bindings::utils::DOM_CALLBACKS; diff --git a/components/script/script_thread.rs b/components/script/script_thread.rs index b9bcf5be7c88..ff4ce058ce0e 100644 --- a/components/script/script_thread.rs +++ b/components/script/script_thread.rs @@ -32,10 +32,10 @@ use dom::bindings::codegen::Bindings::TransitionEventBinding::TransitionEventIni use dom::bindings::codegen::Bindings::WindowBinding::WindowMethods; use dom::bindings::conversions::{ConversionResult, FromJSValConvertible, StringificationBehavior}; use dom::bindings::inheritance::Castable; -use dom::bindings::js::{JS, MutNullableJS, Root, RootCollection}; -use dom::bindings::js::{RootCollectionPtr, RootedReference}; use dom::bindings::num::Finite; use dom::bindings::reflector::DomObject; +use dom::bindings::root::{JS, MutNullableJS, Root, RootCollection}; +use dom::bindings::root::{RootCollectionPtr, RootedReference}; use dom::bindings::str::DOMString; use dom::bindings::structuredclone::StructuredCloneData; use dom::bindings::trace::JSTraceable; diff --git a/components/script/serviceworkerjob.rs b/components/script/serviceworkerjob.rs index 879b2b81e291..54af84ad9c01 100644 --- a/components/script/serviceworkerjob.rs +++ b/components/script/serviceworkerjob.rs @@ -9,9 +9,9 @@ use dom::bindings::cell::DOMRefCell; use dom::bindings::error::Error; -use dom::bindings::js::JS; use dom::bindings::refcounted::{Trusted, TrustedPromise}; use dom::bindings::reflector::DomObject; +use dom::bindings::root::JS; use dom::client::Client; use dom::promise::Promise; use dom::serviceworkerregistration::ServiceWorkerRegistration; diff --git a/components/script/test.rs b/components/script/test.rs index bdd84d681b86..556ef4b95ffd 100644 --- a/components/script/test.rs +++ b/components/script/test.rs @@ -7,7 +7,7 @@ pub use dom::headers::normalize_value; // For compile-fail tests only. pub use dom::bindings::cell::DOMRefCell; -pub use dom::bindings::js::JS; +pub use dom::bindings::root::JS; pub use dom::node::Node; pub use dom::bindings::refcounted::TrustedPromise; diff --git a/components/script/webdriver_handlers.rs b/components/script/webdriver_handlers.rs index c01a7d9a51a8..66ee6fe4eb49 100644 --- a/components/script/webdriver_handlers.rs +++ b/components/script/webdriver_handlers.rs @@ -13,7 +13,7 @@ use dom::bindings::codegen::Bindings::NodeBinding::NodeMethods; use dom::bindings::codegen::Bindings::WindowBinding::WindowMethods; use dom::bindings::conversions::{ConversionResult, FromJSValConvertible, StringificationBehavior}; use dom::bindings::inheritance::Castable; -use dom::bindings::js::Root; +use dom::bindings::root::Root; use dom::bindings::str::DOMString; use dom::element::Element; use dom::globalscope::GlobalScope; From 7be32fb2371a14ba61b008a37e79761f66c073c7 Mon Sep 17 00:00:00 2001 From: Anthony Ramine Date: Mon, 25 Sep 2017 23:56:32 +0200 Subject: [PATCH 3/9] Rename JS to Dom --- components/script/docs/JS-Servos-only-GC.md | 30 +++---- components/script/document_loader.rs | 6 +- components/script/dom/bindings/callback.rs | 8 +- .../dom/bindings/codegen/CodegenRust.py | 8 +- components/script/dom/bindings/iterable.rs | 6 +- components/script/dom/bindings/root.rs | 90 +++++++++---------- .../script/dom/bindings/settings_stack.rs | 8 +- components/script/dom/bindings/trace.rs | 14 +-- components/script/dom/blob.rs | 8 +- components/script/dom/bluetooth.rs | 10 +-- .../script/dom/bluetoothadvertisingevent.rs | 6 +- components/script/dom/bluetoothdevice.rs | 18 ++-- .../script/dom/bluetoothpermissionresult.rs | 12 +-- .../dom/bluetoothremotegattcharacteristic.rs | 10 +-- .../dom/bluetoothremotegattdescriptor.rs | 6 +- .../script/dom/bluetoothremotegattserver.rs | 6 +- .../script/dom/bluetoothremotegattservice.rs | 6 +- .../script/dom/canvasrenderingcontext2d.rs | 18 ++-- components/script/dom/csskeyframerule.rs | 4 +- components/script/dom/cssrule.rs | 6 +- components/script/dom/cssrulelist.rs | 6 +- components/script/dom/cssstyledeclaration.rs | 6 +- components/script/dom/cssstylerule.rs | 4 +- components/script/dom/cssstylesheet.rs | 6 +- .../script/dom/customelementregistry.rs | 12 +-- .../script/dom/dedicatedworkerglobalscope.rs | 2 +- .../script/dom/dissimilaroriginlocation.rs | 6 +- .../script/dom/dissimilaroriginwindow.rs | 6 +- components/script/dom/document.rs | 54 +++++------ components/script/dom/domimplementation.rs | 6 +- components/script/dom/domparser.rs | 6 +- components/script/dom/domquad.rs | 18 ++-- components/script/dom/domstringmap.rs | 6 +- components/script/dom/domtokenlist.rs | 6 +- components/script/dom/element.rs | 10 +-- components/script/dom/event.rs | 6 +- components/script/dom/filelist.rs | 10 +-- components/script/dom/gamepad.rs | 10 +-- components/script/dom/gamepadbuttonlist.rs | 6 +- components/script/dom/gamepadevent.rs | 6 +- components/script/dom/gamepadlist.rs | 8 +- components/script/dom/globalscope.rs | 4 +- components/script/dom/history.rs | 6 +- components/script/dom/htmlcanvaselement.rs | 10 +-- components/script/dom/htmlcollection.rs | 6 +- components/script/dom/htmlelement.rs | 4 +- components/script/dom/htmlformelement.rs | 4 +- components/script/dom/htmlinputelement.rs | 6 +- components/script/dom/htmlscriptelement.rs | 6 +- components/script/dom/htmltableelement.rs | 6 +- components/script/dom/location.rs | 6 +- components/script/dom/medialist.rs | 6 +- components/script/dom/mediaquerylist.rs | 8 +- components/script/dom/mod.rs | 4 +- components/script/dom/mutationrecord.rs | 14 +-- components/script/dom/namednodemap.rs | 6 +- components/script/dom/node.rs | 16 ++-- components/script/dom/nodeiterator.rs | 6 +- components/script/dom/nodelist.rs | 14 +-- .../script/dom/paintworkletglobalscope.rs | 6 +- components/script/dom/performance.rs | 6 +- components/script/dom/performancetiming.rs | 6 +- components/script/dom/radionodelist.rs | 4 +- components/script/dom/range.rs | 4 +- components/script/dom/request.rs | 2 +- .../script/dom/serviceworkercontainer.rs | 6 +- .../script/dom/serviceworkerregistration.rs | 10 +-- .../script/dom/servoparser/async_html.rs | 30 +++---- components/script/dom/servoparser/html.rs | 16 ++-- components/script/dom/servoparser/mod.rs | 68 +++++++------- components/script/dom/servoparser/xml.rs | 12 +-- .../script/dom/stylepropertymapreadonly.rs | 8 +- components/script/dom/stylesheetlist.rs | 8 +- components/script/dom/testworklet.rs | 6 +- components/script/dom/touchlist.rs | 6 +- components/script/dom/treewalker.rs | 16 ++-- components/script/dom/validitystate.rs | 6 +- components/script/dom/vr.rs | 12 +-- components/script/dom/vrdisplayevent.rs | 6 +- components/script/dom/vreyeparameters.rs | 6 +- components/script/dom/vrframedata.rs | 6 +- .../ext/oesvertexarrayobject.rs | 6 +- .../ext/webglvertexarrayobjectoes.rs | 8 +- components/script/dom/webglframebuffer.rs | 10 +-- .../script/dom/webglrenderingcontext.rs | 14 +-- components/script/dom/window.rs | 8 +- components/script/dom/windowproxy.rs | 10 +-- components/script/dom/worklet.rs | 10 +-- components/script/dom/workletglobalscope.rs | 2 +- components/script/dom/xmlhttprequest.rs | 6 +- components/script/script_thread.rs | 30 +++---- components/script/serviceworkerjob.rs | 6 +- components/script/test.rs | 2 +- python/tidy/servo_tidy/tidy.py | 6 +- .../tidy/servo_tidy_tests/ban-domrefcell.rs | 6 +- python/tidy/servo_tidy_tests/test_tidy.py | 2 +- 96 files changed, 494 insertions(+), 494 deletions(-) diff --git a/components/script/docs/JS-Servos-only-GC.md b/components/script/docs/JS-Servos-only-GC.md index aa8f72e4f415..0f38e4fadfde 100644 --- a/components/script/docs/JS-Servos-only-GC.md +++ b/components/script/docs/JS-Servos-only-GC.md @@ -143,7 +143,7 @@ use dom_struct::dom_struct; #[dom_struct] pub struct Document { node: Node, - window: JS, + window: Dom, is_html_document: bool, ... } @@ -164,11 +164,11 @@ relationship. The `Document` just has a pointer to a `Window`, one of many pointers to that object, which can live in native DOM data structures or in JavaScript objects. These are precisely the pointers we need to tell the garbage collector about. We do this with a -[custom type for traced pointers: `JS`][js] (for example, the `JS` -above). The implementation of `trace` for `JS` is not auto-generated; this +[custom type for traced pointers: `Dom`][dom] (for example, the `Dom` +above). The implementation of `trace` for `Dom` is not auto-generated; this is where we actually call the SpiderMonkey trace hooks: -[js]: http://doc.servo.org/script/dom/bindings/root/struct.JS.html +[dom]: http://doc.servo.org/script/dom/bindings/root/struct.Dom.html ```rust pub fn trace_reflector(tracer: *mut JSTracer, description: &str, reflector: &Reflector) { @@ -183,7 +183,7 @@ pub fn trace_reflector(tracer: *mut JSTracer, description: &str, reflector: &Ref } } -impl JSTraceable for JS { +impl JSTraceable for Dom { unsafe fn trace(&self, trc: *mut JSTracer) { trace_reflector(trc, "", unsafe { (**self.ptr).reflector() }); } @@ -257,11 +257,11 @@ through a `Root`. [deref]: https://doc.rust-lang.org/std/ops/trait.Deref.html -A third way to obtain a reference is from the `JS` struct we encountered -earlier. Whenever we have a reference to a `JS`, we know that the DOM struct +A third way to obtain a reference is from the `Dom` struct we encountered +earlier. Whenever we have a reference to a `Dom`, we know that the DOM struct that contains it is already rooted, and thus that the garbage collector is -aware of the `JS`, and will keep the DOM object it points to alive. -This allows us to implement the `Deref` trait on `JS` as well. +aware of the `Dom`, and will keep the DOM object it points to alive. +This allows us to implement the `Deref` trait on `Dom` as well. The correctness of these APIs is heavily dependent on the fact that the reference cannot outlive the smart pointer it was retrieved from, and the fact @@ -298,10 +298,10 @@ To recapitulate, the safety of our system depends on two major parts: from Rust without telling SpiderMonkey about our temporary reference. But there's a hole in this scheme. We could copy an unrooted pointer — a -`JS` — to a local variable on the stack, and then at some later point, root +`Dom` — to a local variable on the stack, and then at some later point, root it and use the DOM object. In the meantime, SpiderMonkey's garbage collector -won't know about that `JS` on the stack, so it might free the DOM object. -To really be safe, we need to make sure that `JS` *only* appears in places +won't know about that `Dom` on the stack, so it might free the DOM object. +To really be safe, we need to make sure that `Dom` *only* appears in places where it will be traced, such as DOM structs, and never in local variables, function arguments, and so forth. @@ -315,10 +315,10 @@ Developing the Servo Web Browser Engine using Rust][lints]. [lints]: http://arxiv.org/pdf/1505.07383v1.pdf We have already [implemented a plugin][js-lint] which effectively forbids -`JS` from appearing on the [stack][stack]. Because lint plugins are part of +`Dom` from appearing on the [stack][stack]. Because lint plugins are part of the usual [warnings infrastructure][warnings], we can use the `allow` attribute -in places where it's okay to use `JS`, like DOM struct definitions and the -implementation of `JS` itself. +in places where it's okay to use `Dom`, like DOM struct definitions and the +implementation of `Dom` itself. [js-lint]: http://doc.servo.org/plugins/lints/unrooted_must_root/struct.UnrootedPass.html [stack]: https://en.wikipedia.org/wiki/Stack-based_memory_allocation diff --git a/components/script/document_loader.rs b/components/script/document_loader.rs index 4138debf2d3f..c541882f6219 100644 --- a/components/script/document_loader.rs +++ b/components/script/document_loader.rs @@ -5,7 +5,7 @@ //! Tracking of pending loads in a document. //! https://html.spec.whatwg.org/multipage/#the-end -use dom::bindings::root::JS; +use dom::bindings::root::Dom; use dom::document::Document; use ipc_channel::ipc::IpcSender; use net_traits::{CoreResourceMsg, FetchResponseMsg, ResourceThreads, IpcSend}; @@ -43,7 +43,7 @@ impl LoadType { #[must_root] pub struct LoadBlocker { /// The document whose load event is blocked by this object existing. - doc: JS, + doc: Dom, /// The load that is blocking the document's load event. load: Option, } @@ -53,7 +53,7 @@ impl LoadBlocker { pub fn new(doc: &Document, load: LoadType) -> LoadBlocker { doc.loader_mut().add_blocking_load(load.clone()); LoadBlocker { - doc: JS::from_ref(doc), + doc: Dom::from_ref(doc), load: Some(load), } } diff --git a/components/script/dom/bindings/callback.rs b/components/script/dom/bindings/callback.rs index 5b2adfe2b99b..15458499782b 100644 --- a/components/script/dom/bindings/callback.rs +++ b/components/script/dom/bindings/callback.rs @@ -6,7 +6,7 @@ use dom::bindings::error::{Error, Fallible, report_pending_exception}; use dom::bindings::reflector::DomObject; -use dom::bindings::root::{JS, Root}; +use dom::bindings::root::{Dom, Root}; use dom::bindings::settings_stack::{AutoEntryScript, AutoIncumbentScript}; use dom::bindings::utils::AsCCharPtrPtr; use dom::globalscope::GlobalScope; @@ -53,7 +53,7 @@ pub struct CallbackObject { /// /// ["callback context"]: https://heycam.github.io/webidl/#dfn-callback-context /// [sometimes]: https://github.com/whatwg/html/issues/2248 - incumbent: Option> + incumbent: Option> } impl Default for CallbackObject { @@ -69,7 +69,7 @@ impl CallbackObject { CallbackObject { callback: Heap::default(), permanent_js_root: Heap::default(), - incumbent: GlobalScope::incumbent().map(|i| JS::from_ref(&*i)), + incumbent: GlobalScope::incumbent().map(|i| Dom::from_ref(&*i)), } } @@ -120,7 +120,7 @@ pub trait CallbackContainer { /// /// ["callback context"]: https://heycam.github.io/webidl/#dfn-callback-context fn incumbent(&self) -> Option<&GlobalScope> { - self.callback_holder().incumbent.as_ref().map(JS::deref) + self.callback_holder().incumbent.as_ref().map(Dom::deref) } } diff --git a/components/script/dom/bindings/codegen/CodegenRust.py b/components/script/dom/bindings/codegen/CodegenRust.py index 03c2076951b3..3f99ea37a417 100644 --- a/components/script/dom/bindings/codegen/CodegenRust.py +++ b/components/script/dom/bindings/codegen/CodegenRust.py @@ -1272,7 +1272,7 @@ def __init__(self, argument, index, args, argc, descriptorProvider, arg = "arg%d" % index if argument.type.isGeckoInterface(): init = "rooted_vec!(let mut %s)" % arg - innerConverter.append(CGGeneric("%s.push(JS::from_ref(&*slot));" % arg)) + innerConverter.append(CGGeneric("%s.push(Dom::from_ref(&*slot));" % arg)) else: init = "let mut %s = vec![]" % arg innerConverter.append(CGGeneric("%s.push(slot);" % arg)) @@ -5712,7 +5712,7 @@ def generate_imports(config, cgthings, descriptors, callbacks=None, dictionaries 'dom::bindings::namespace::create_namespace_object', 'dom::bindings::reflector::MutDomObject', 'dom::bindings::reflector::DomObject', - 'dom::bindings::root::JS', + 'dom::bindings::root::Dom', 'dom::bindings::root::OptionalHeapSetter', 'dom::bindings::root::Root', 'dom::bindings::root::RootedReference', @@ -6961,7 +6961,7 @@ def __init__(self, attr, descriptor): needThisHandling=False) def getRvalDecl(self): - return "JS::Rooted rval(cx, JS::UndefinedValue());\n" + return "Dom::Rooted rval(cx, JS::UndefinedValue());\n" def getCall(self): replacements = { @@ -7195,7 +7195,7 @@ def InheritTypes(config): imports = [CGGeneric("use dom::types::*;\n"), CGGeneric("use dom::bindings::conversions::{DerivedFrom, get_dom_class};\n"), CGGeneric("use dom::bindings::inheritance::Castable;\n"), - CGGeneric("use dom::bindings::root::{JS, LayoutJS, Root};\n"), + CGGeneric("use dom::bindings::root::{Dom, LayoutJS, Root};\n"), CGGeneric("use dom::bindings::trace::JSTraceable;\n"), CGGeneric("use dom::bindings::reflector::DomObject;\n"), CGGeneric("use js::jsapi::JSTracer;\n\n"), diff --git a/components/script/dom/bindings/iterable.rs b/components/script/dom/bindings/iterable.rs index ec8daf36dcff..a7bf937b5b75 100644 --- a/components/script/dom/bindings/iterable.rs +++ b/components/script/dom/bindings/iterable.rs @@ -11,7 +11,7 @@ use dom::bindings::codegen::Bindings::IterableIteratorBinding::IterableKeyAndVal use dom::bindings::codegen::Bindings::IterableIteratorBinding::IterableKeyOrValueResult; use dom::bindings::error::Fallible; use dom::bindings::reflector::{DomObject, Reflector, reflect_dom_object}; -use dom::bindings::root::{JS, Root}; +use dom::bindings::root::{Dom, Root}; use dom::bindings::trace::JSTraceable; use dom::globalscope::GlobalScope; use dom_struct::dom_struct; @@ -51,7 +51,7 @@ pub trait Iterable { #[dom_struct] pub struct IterableIterator { reflector: Reflector, - iterable: JS, + iterable: Dom, type_: IteratorType, index: Cell, } @@ -65,7 +65,7 @@ impl IterableIterator { let iterator = box IterableIterator { reflector: Reflector::new(), type_: type_, - iterable: JS::from_ref(iterable), + iterable: Dom::from_ref(iterable), index: Cell::new(0), }; reflect_dom_object(iterator, &*iterable.global(), wrap) diff --git a/components/script/dom/bindings/root.rs b/components/script/dom/bindings/root.rs index 07dc4d747784..32c3e5c7eaa7 100644 --- a/components/script/dom/bindings/root.rs +++ b/components/script/dom/bindings/root.rs @@ -12,10 +12,10 @@ //! Here is a brief overview of the important types: //! //! - `Root`: a stack-based reference to a rooted DOM object. -//! - `JS`: a reference to a DOM object that can automatically be traced by +//! - `Dom`: a reference to a DOM object that can automatically be traced by //! the GC when encountered as a field of a Rust structure. //! -//! `JS` does not allow access to their inner value without explicitly +//! `Dom` does not allow access to their inner value without explicitly //! creating a stack-based root via the `root` method. This returns a `Root`, //! which causes the JS-owned value to be uncollectable for the duration of the //! `Root` object's lifetime. A reference to the object can then be obtained @@ -50,24 +50,24 @@ use style::thread_state; /// A traced reference to a DOM object /// /// This type is critical to making garbage collection work with the DOM, -/// but it is very dangerous; if garbage collection happens with a `JS` -/// on the stack, the `JS` can point to freed memory. +/// but it is very dangerous; if garbage collection happens with a `Dom` +/// on the stack, the `Dom` can point to freed memory. /// /// This should only be used as a field in other DOM objects. #[must_root] -pub struct JS { +pub struct Dom { ptr: NonZero<*const T>, } -// JS is similar to Rc, in that it's not always clear how to avoid double-counting. +// Dom is similar to Rc, in that it's not always clear how to avoid double-counting. // For now, we choose not to follow any such pointers. -impl HeapSizeOf for JS { +impl HeapSizeOf for Dom { fn heap_size_of_children(&self) -> usize { 0 } } -impl JS { +impl Dom { /// Returns `LayoutJS` containing the same pointer. pub unsafe fn to_layout(&self) -> LayoutJS { debug_assert!(thread_state::get().is_layout()); @@ -77,36 +77,36 @@ impl JS { } } -impl JS { - /// Create a JS from a &T +impl Dom { + /// Create a Dom from a &T #[allow(unrooted_must_root)] - pub fn from_ref(obj: &T) -> JS { + pub fn from_ref(obj: &T) -> Dom { debug_assert!(thread_state::get().is_script()); - JS { + Dom { ptr: unsafe { NonZero::new_unchecked(&*obj) }, } } } -impl<'root, T: DomObject + 'root> RootedReference<'root> for JS { +impl<'root, T: DomObject + 'root> RootedReference<'root> for Dom { type Ref = &'root T; fn r(&'root self) -> &'root T { &self } } -impl Deref for JS { +impl Deref for Dom { type Target = T; fn deref(&self) -> &T { debug_assert!(thread_state::get().is_script()); - // We can only have &JS from a rooted thing, so it's safe to deref + // We can only have &Dom from a rooted thing, so it's safe to deref // it to &T. unsafe { &*self.ptr.get() } } } -unsafe impl JSTraceable for JS { +unsafe impl JSTraceable for Dom { unsafe fn trace(&self, trc: *mut JSTracer) { #[cfg(debug_assertions)] let trace_str = format!("for {} on heap", type_name::()); @@ -169,13 +169,13 @@ impl LayoutJS { impl Copy for LayoutJS {} -impl PartialEq for JS { - fn eq(&self, other: &JS) -> bool { +impl PartialEq for Dom { + fn eq(&self, other: &Dom) -> bool { self.ptr == other.ptr } } -impl Eq for JS {} +impl Eq for Dom {} impl PartialEq for LayoutJS { fn eq(&self, other: &LayoutJS) -> bool { @@ -185,7 +185,7 @@ impl PartialEq for LayoutJS { impl Eq for LayoutJS {} -impl Hash for JS { +impl Hash for Dom { fn hash(&self, state: &mut H) { self.ptr.hash(state) } @@ -197,12 +197,12 @@ impl Hash for LayoutJS { } } -impl Clone for JS { +impl Clone for Dom { #[inline] #[allow(unrooted_must_root)] - fn clone(&self) -> JS { + fn clone(&self) -> Dom { debug_assert!(thread_state::get().is_script()); - JS { + Dom { ptr: self.ptr.clone(), } } @@ -231,14 +231,14 @@ impl LayoutJS { } /// A holder that provides interior mutability for GC-managed values such as -/// `JS`. Essentially a `Cell>`, but safer. +/// `Dom`. Essentially a `Cell>`, but safer. /// /// This should only be used as a field in other DOM objects; see warning -/// on `JS`. +/// on `Dom`. #[must_root] #[derive(JSTraceable)] pub struct MutJS { - val: UnsafeCell>, + val: UnsafeCell>, } impl MutJS { @@ -246,7 +246,7 @@ impl MutJS { pub fn new(initial: &T) -> MutJS { debug_assert!(thread_state::get().is_script()); MutJS { - val: UnsafeCell::new(JS::from_ref(initial)), + val: UnsafeCell::new(Dom::from_ref(initial)), } } @@ -254,7 +254,7 @@ impl MutJS { pub fn set(&self, val: &T) { debug_assert!(thread_state::get().is_script()); unsafe { - *self.val.get() = JS::from_ref(val); + *self.val.get() = Dom::from_ref(val); } } @@ -269,7 +269,7 @@ impl MutJS { impl HeapSizeOf for MutJS { fn heap_size_of_children(&self) -> usize { - // See comment on HeapSizeOf for JS. + // See comment on HeapSizeOf for Dom. 0 } } @@ -291,15 +291,15 @@ impl PartialEq for MutJS { } /// A holder that provides interior mutability for GC-managed values such as -/// `JS`, with nullability represented by an enclosing Option wrapper. -/// Essentially a `Cell>>`, but safer. +/// `Dom`, with nullability represented by an enclosing Option wrapper. +/// Essentially a `Cell>>`, but safer. /// /// This should only be used as a field in other DOM objects; see warning -/// on `JS`. +/// on `Dom`. #[must_root] #[derive(JSTraceable)] pub struct MutNullableJS { - ptr: UnsafeCell>>, + ptr: UnsafeCell>>, } impl MutNullableJS { @@ -307,7 +307,7 @@ impl MutNullableJS { pub fn new(initial: Option<&T>) -> MutNullableJS { debug_assert!(thread_state::get().is_script()); MutNullableJS { - ptr: UnsafeCell::new(initial.map(JS::from_ref)), + ptr: UnsafeCell::new(initial.map(Dom::from_ref)), } } @@ -327,7 +327,7 @@ impl MutNullableJS { } } - /// Retrieve a copy of the inner optional `JS` as `LayoutJS`. + /// Retrieve a copy of the inner optional `Dom` as `LayoutJS`. /// For use by layout, which can't use safe types like Temporary. #[allow(unrooted_must_root)] pub unsafe fn get_inner_as_layout(&self) -> Option> { @@ -348,7 +348,7 @@ impl MutNullableJS { pub fn set(&self, val: Option<&T>) { debug_assert!(thread_state::get().is_script()); unsafe { - *self.ptr.get() = val.map(|p| JS::from_ref(p)); + *self.ptr.get() = val.map(|p| Dom::from_ref(p)); } } @@ -371,7 +371,7 @@ impl PartialEq for MutNullableJS { impl<'a, T: DomObject> PartialEq> for MutNullableJS { fn eq(&self, other: &Option<&T>) -> bool { unsafe { - *self.ptr.get() == other.map(JS::from_ref) + *self.ptr.get() == other.map(Dom::from_ref) } } } @@ -388,20 +388,20 @@ impl Default for MutNullableJS { impl HeapSizeOf for MutNullableJS { fn heap_size_of_children(&self) -> usize { - // See comment on HeapSizeOf for JS. + // See comment on HeapSizeOf for Dom. 0 } } /// A holder that allows to lazily initialize the value only once -/// `JS`, using OnceCell -/// Essentially a `OnceCell>`. +/// `Dom`, using OnceCell +/// Essentially a `OnceCell>`. /// /// This should only be used as a field in other DOM objects; see warning -/// on `JS`. +/// on `Dom`. #[must_root] pub struct OnceCellJS { - ptr: OnceCell>, + ptr: OnceCell>, } impl OnceCellJS { @@ -412,7 +412,7 @@ impl OnceCellJS { where F: FnOnce() -> Root { debug_assert!(thread_state::get().is_script()); - &self.ptr.init_once(|| JS::from_ref(&cb())) + &self.ptr.init_once(|| Dom::from_ref(&cb())) } } @@ -428,7 +428,7 @@ impl Default for OnceCellJS { impl HeapSizeOf for OnceCellJS { fn heap_size_of_children(&self) -> usize { - // See comment on HeapSizeOf for JS. + // See comment on HeapSizeOf for Dom. 0 } } @@ -468,7 +468,7 @@ pub trait RootedReference<'root> { fn r(&'root self) -> Self::Ref; } -impl<'root, T: JSTraceable + DomObject + 'root> RootedReference<'root> for [JS] { +impl<'root, T: JSTraceable + DomObject + 'root> RootedReference<'root> for [Dom] { type Ref = &'root [&'root T]; fn r(&'root self) -> &'root [&'root T] { unsafe { mem::transmute(self) } diff --git a/components/script/dom/bindings/settings_stack.rs b/components/script/dom/bindings/settings_stack.rs index 73b74f7055d4..0d747cca2051 100644 --- a/components/script/dom/bindings/settings_stack.rs +++ b/components/script/dom/bindings/settings_stack.rs @@ -2,7 +2,7 @@ * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ -use dom::bindings::root::{JS, Root}; +use dom::bindings::root::{Dom, Root}; use dom::bindings::trace::JSTraceable; use dom::globalscope::GlobalScope; use js::jsapi::GetScriptedCallerGlobal; @@ -24,7 +24,7 @@ enum StackEntryKind { #[allow(unrooted_must_root)] #[derive(JSTraceable)] struct StackEntry { - global: JS, + global: Dom, kind: StackEntryKind, } @@ -47,7 +47,7 @@ impl AutoEntryScript { trace!("Prepare to run script with {:p}", global); let mut stack = stack.borrow_mut(); stack.push(StackEntry { - global: JS::from_ref(global), + global: Dom::from_ref(global), kind: StackEntryKind::Entry, }); AutoEntryScript { @@ -109,7 +109,7 @@ impl AutoIncumbentScript { // Step 1. let mut stack = stack.borrow_mut(); stack.push(StackEntry { - global: JS::from_ref(global), + global: Dom::from_ref(global), kind: StackEntryKind::Incumbent, }); AutoIncumbentScript { diff --git a/components/script/dom/bindings/trace.rs b/components/script/dom/bindings/trace.rs index 40945fad3e3a..74b78fa013aa 100644 --- a/components/script/dom/bindings/trace.rs +++ b/components/script/dom/bindings/trace.rs @@ -18,9 +18,9 @@ //! achieved via `unsafe_no_jsmanaged_fields!` or similar. //! 3. For all fields, `Foo::trace()` //! calls `trace()` on the field. -//! For example, for fields of type `JS`, `JS::trace()` calls +//! For example, for fields of type `Dom`, `Dom::trace()` calls //! `trace_reflector()`. -//! 4. `trace_reflector()` calls `JS::TraceEdge()` with a +//! 4. `trace_reflector()` calls `Dom::TraceEdge()` with a //! pointer to the `JSObject` for the reflector. This notifies the GC, which //! will add the object to the graph, and will trace that object as well. //! 5. When the GC finishes tracing, it [`finalizes`](../index.html#destruction) @@ -42,7 +42,7 @@ use dom::bindings::cell::DOMRefCell; use dom::bindings::error::Error; use dom::bindings::refcounted::{Trusted, TrustedPromise}; use dom::bindings::reflector::{DomObject, Reflector}; -use dom::bindings::root::{JS, Root}; +use dom::bindings::root::{Dom, Root}; use dom::bindings::str::{DOMString, USVString}; use dom::bindings::utils::WindowProxyHandler; use dom::document::PendingRestyle; @@ -840,16 +840,16 @@ impl<'a, T: 'static + JSTraceable> RootedVec<'a, T> { } } -impl<'a, T: 'static + JSTraceable + DomObject> RootedVec<'a, JS> { - /// Create a vector of items of type JS that is rooted for +impl<'a, T: 'static + JSTraceable + DomObject> RootedVec<'a, Dom> { + /// Create a vector of items of type Dom that is rooted for /// the lifetime of this struct - pub fn from_iter(root: &'a mut RootableVec>, iter: I) -> Self + pub fn from_iter(root: &'a mut RootableVec>, iter: I) -> Self where I: Iterator> { unsafe { RootedTraceableSet::add(root); } - root.v.extend(iter.map(|item| JS::from_ref(&*item))); + root.v.extend(iter.map(|item| Dom::from_ref(&*item))); RootedVec { root: root, } diff --git a/components/script/dom/blob.rs b/components/script/dom/blob.rs index 5bb9109118a4..835c17c9334c 100644 --- a/components/script/dom/blob.rs +++ b/components/script/dom/blob.rs @@ -8,7 +8,7 @@ use dom::bindings::codegen::Bindings::BlobBinding::BlobMethods; use dom::bindings::codegen::UnionTypes::BlobOrString; use dom::bindings::error::{Error, Fallible}; use dom::bindings::reflector::{DomObject, Reflector, reflect_dom_object}; -use dom::bindings::root::{JS, Root}; +use dom::bindings::root::{Dom, Root}; use dom::bindings::str::DOMString; use dom::globalscope::GlobalScope; use dom_struct::dom_struct; @@ -44,7 +44,7 @@ pub enum BlobImpl { /// relative positions of current slicing range, /// IMPORTANT: The depth of tree is only two, i.e. the parent Blob must be /// either File-based or Memory-based - Sliced(JS, RelativePos), + Sliced(Dom, RelativePos), } impl BlobImpl { @@ -101,11 +101,11 @@ impl Blob { let blob_impl = match *parent.blob_impl.borrow() { BlobImpl::File(_) => { // Create new parent node - BlobImpl::Sliced(JS::from_ref(parent), rel_pos) + BlobImpl::Sliced(Dom::from_ref(parent), rel_pos) } BlobImpl::Memory(_) => { // Create new parent node - BlobImpl::Sliced(JS::from_ref(parent), rel_pos) + BlobImpl::Sliced(Dom::from_ref(parent), rel_pos) } BlobImpl::Sliced(ref grandparent, ref old_rel_pos) => { // Adjust the slicing position, using same parent diff --git a/components/script/dom/bluetooth.rs b/components/script/dom/bluetooth.rs index d0a35547c988..34f5e37ba616 100644 --- a/components/script/dom/bluetooth.rs +++ b/components/script/dom/bluetooth.rs @@ -20,7 +20,7 @@ use dom::bindings::error::Error::{self, Network, Security, Type}; use dom::bindings::error::Fallible; use dom::bindings::refcounted::{Trusted, TrustedPromise}; use dom::bindings::reflector::{DomObject, reflect_dom_object}; -use dom::bindings::root::{JS, Root}; +use dom::bindings::root::{Dom, Root}; use dom::bindings::str::DOMString; use dom::bluetoothdevice::BluetoothDevice; use dom::bluetoothpermissionresult::BluetoothPermissionResult; @@ -120,7 +120,7 @@ where #[dom_struct] pub struct Bluetooth { eventtarget: EventTarget, - device_instance_map: DOMRefCell>>, + device_instance_map: DOMRefCell>>, } impl Bluetooth { @@ -141,7 +141,7 @@ impl Bluetooth { self.global().as_window().bluetooth_thread() } - pub fn get_device_map(&self) -> &DOMRefCell>> { + pub fn get_device_map(&self) -> &DOMRefCell>> { &self.device_instance_map } @@ -520,7 +520,7 @@ impl AsyncBluetoothListener for Bluetooth { DOMString::from(device.id.clone()), device.name.map(DOMString::from), &self); - device_instance_map.insert(device.id.clone(), JS::from_ref(&bt_device)); + device_instance_map.insert(device.id.clone(), Dom::from_ref(&bt_device)); self.global().as_window().bluetooth_extra_permission_data().add_new_allowed_device( AllowedBluetoothDevice { @@ -631,7 +631,7 @@ impl PermissionAlgorithm for Bluetooth { // TODO: Implement this correctly, not just using device ids here. // https://webbluetoothcg.github.io/web-bluetooth/#get-the-bluetoothdevice-representing if let Some(device) = device_map.get(&device_id) { - matching_devices.push(JS::from_ref(&**device)); + matching_devices.push(Dom::from_ref(&**device)); } } diff --git a/components/script/dom/bluetoothadvertisingevent.rs b/components/script/dom/bluetoothadvertisingevent.rs index f1a00457d14d..e266cc01d157 100644 --- a/components/script/dom/bluetoothadvertisingevent.rs +++ b/components/script/dom/bluetoothadvertisingevent.rs @@ -8,7 +8,7 @@ use dom::bindings::codegen::Bindings::EventBinding::EventBinding::EventMethods; use dom::bindings::error::Fallible; use dom::bindings::inheritance::Castable; use dom::bindings::reflector::reflect_dom_object; -use dom::bindings::root::{JS, Root, RootedReference}; +use dom::bindings::root::{Dom, Root, RootedReference}; use dom::bindings::str::DOMString; use dom::bluetoothdevice::BluetoothDevice; use dom::event::{Event, EventBubbles, EventCancelable}; @@ -21,7 +21,7 @@ use servo_atoms::Atom; #[dom_struct] pub struct BluetoothAdvertisingEvent { event: Event, - device: JS, + device: Dom, name: Option, appearance: Option, tx_power: Option, @@ -37,7 +37,7 @@ impl BluetoothAdvertisingEvent { -> BluetoothAdvertisingEvent { BluetoothAdvertisingEvent { event: Event::new_inherited(), - device: JS::from_ref(device), + device: Dom::from_ref(device), name: name, appearance: appearance, tx_power: tx_power, diff --git a/components/script/dom/bluetoothdevice.rs b/components/script/dom/bluetoothdevice.rs index d3ade32120bf..c07852f78538 100644 --- a/components/script/dom/bluetoothdevice.rs +++ b/components/script/dom/bluetoothdevice.rs @@ -12,7 +12,7 @@ use dom::bindings::error::Error; use dom::bindings::error::ErrorResult; use dom::bindings::inheritance::Castable; use dom::bindings::reflector::{DomObject, reflect_dom_object}; -use dom::bindings::root::{JS, MutNullableJS, Root}; +use dom::bindings::root::{Dom, MutNullableJS, Root}; use dom::bindings::str::DOMString; use dom::bluetooth::{AsyncBluetoothListener, Bluetooth, response_async}; use dom::bluetoothcharacteristicproperties::BluetoothCharacteristicProperties; @@ -36,10 +36,10 @@ pub struct BluetoothDevice { id: DOMString, name: Option, gatt: MutNullableJS, - context: JS, - attribute_instance_map: (DOMRefCell>>, - DOMRefCell>>, - DOMRefCell>>), + context: Dom, + attribute_instance_map: (DOMRefCell>>, + DOMRefCell>>, + DOMRefCell>>), watching_advertisements: Cell, } @@ -53,7 +53,7 @@ impl BluetoothDevice { id: id, name: name, gatt: Default::default(), - context: JS::from_ref(context), + context: Dom::from_ref(context), attribute_instance_map: (DOMRefCell::new(HashMap::new()), DOMRefCell::new(HashMap::new()), DOMRefCell::new(HashMap::new())), @@ -97,7 +97,7 @@ impl BluetoothDevice { DOMString::from(service.uuid.clone()), service.is_primary, service.instance_id.clone()); - service_map.insert(service.instance_id.clone(), JS::from_ref(&bt_service)); + service_map.insert(service.instance_id.clone(), Dom::from_ref(&bt_service)); return bt_service; } @@ -126,7 +126,7 @@ impl BluetoothDevice { DOMString::from(characteristic.uuid.clone()), &properties, characteristic.instance_id.clone()); - characteristic_map.insert(characteristic.instance_id.clone(), JS::from_ref(&bt_characteristic)); + characteristic_map.insert(characteristic.instance_id.clone(), Dom::from_ref(&bt_characteristic)); return bt_characteristic; } @@ -150,7 +150,7 @@ impl BluetoothDevice { characteristic, DOMString::from(descriptor.uuid.clone()), descriptor.instance_id.clone()); - descriptor_map.insert(descriptor.instance_id.clone(), JS::from_ref(&bt_descriptor)); + descriptor_map.insert(descriptor.instance_id.clone(), Dom::from_ref(&bt_descriptor)); return bt_descriptor; } diff --git a/components/script/dom/bluetoothpermissionresult.rs b/components/script/dom/bluetoothpermissionresult.rs index ad5ec2fa3a30..05aeaf065203 100644 --- a/components/script/dom/bluetoothpermissionresult.rs +++ b/components/script/dom/bluetoothpermissionresult.rs @@ -11,7 +11,7 @@ use dom::bindings::codegen::Bindings::PermissionStatusBinding::PermissionStatusB use dom::bindings::codegen::Bindings::WindowBinding::WindowBinding::WindowMethods; use dom::bindings::error::Error; use dom::bindings::reflector::{DomObject, reflect_dom_object}; -use dom::bindings::root::{JS, Root}; +use dom::bindings::root::{Dom, Root}; use dom::bindings::str::DOMString; use dom::bluetooth::{AsyncBluetoothListener, Bluetooth, AllowedBluetoothDevice}; use dom::bluetoothdevice::BluetoothDevice; @@ -26,7 +26,7 @@ use std::rc::Rc; #[dom_struct] pub struct BluetoothPermissionResult { status: PermissionStatus, - devices: DOMRefCell>>, + devices: DOMRefCell>>, } impl BluetoothPermissionResult { @@ -67,7 +67,7 @@ impl BluetoothPermissionResult { } #[allow(unrooted_must_root)] - pub fn set_devices(&self, devices: Vec>) { + pub fn set_devices(&self, devices: Vec>) { *self.devices.borrow_mut() = devices; } } @@ -93,7 +93,7 @@ impl AsyncBluetoothListener for BluetoothPermissionResult { if let Some(ref existing_device) = device_instance_map.get(&device.id) { // https://webbluetoothcg.github.io/web-bluetooth/#request-the-bluetooth-permission // Step 3. - self.set_devices(vec!(JS::from_ref(&*existing_device))); + self.set_devices(vec!(Dom::from_ref(&*existing_device))); // https://w3c.github.io/permissions/#dom-permissions-request // Step 8. @@ -103,7 +103,7 @@ impl AsyncBluetoothListener for BluetoothPermissionResult { DOMString::from(device.id.clone()), device.name.map(DOMString::from), &bluetooth); - device_instance_map.insert(device.id.clone(), JS::from_ref(&bt_device)); + device_instance_map.insert(device.id.clone(), Dom::from_ref(&bt_device)); self.global().as_window().bluetooth_extra_permission_data().add_new_allowed_device( AllowedBluetoothDevice { deviceId: DOMString::from(device.id), @@ -112,7 +112,7 @@ impl AsyncBluetoothListener for BluetoothPermissionResult { ); // https://webbluetoothcg.github.io/web-bluetooth/#request-the-bluetooth-permission // Step 3. - self.set_devices(vec!(JS::from_ref(&bt_device))); + self.set_devices(vec!(Dom::from_ref(&bt_device))); // https://w3c.github.io/permissions/#dom-permissions-request // Step 8. diff --git a/components/script/dom/bluetoothremotegattcharacteristic.rs b/components/script/dom/bluetoothremotegattcharacteristic.rs index 569eb5115387..276afafa7bcb 100644 --- a/components/script/dom/bluetoothremotegattcharacteristic.rs +++ b/components/script/dom/bluetoothremotegattcharacteristic.rs @@ -15,7 +15,7 @@ use dom::bindings::codegen::Bindings::BluetoothRemoteGATTServiceBinding::Bluetoo use dom::bindings::error::Error::{self, InvalidModification, Network, NotSupported, Security}; use dom::bindings::inheritance::Castable; use dom::bindings::reflector::{DomObject, reflect_dom_object}; -use dom::bindings::root::{JS, Root}; +use dom::bindings::root::{Dom, Root}; use dom::bindings::str::{ByteString, DOMString}; use dom::bluetooth::{AsyncBluetoothListener, get_gatt_children, response_async}; use dom::bluetoothcharacteristicproperties::BluetoothCharacteristicProperties; @@ -36,9 +36,9 @@ pub const MAXIMUM_ATTRIBUTE_LENGTH: usize = 512; #[dom_struct] pub struct BluetoothRemoteGATTCharacteristic { eventtarget: EventTarget, - service: JS, + service: Dom, uuid: DOMString, - properties: JS, + properties: Dom, value: DOMRefCell>, instance_id: String, } @@ -51,9 +51,9 @@ impl BluetoothRemoteGATTCharacteristic { -> BluetoothRemoteGATTCharacteristic { BluetoothRemoteGATTCharacteristic { eventtarget: EventTarget::new_inherited(), - service: JS::from_ref(service), + service: Dom::from_ref(service), uuid: uuid, - properties: JS::from_ref(properties), + properties: Dom::from_ref(properties), value: DOMRefCell::new(None), instance_id: instance_id, } diff --git a/components/script/dom/bluetoothremotegattdescriptor.rs b/components/script/dom/bluetoothremotegattdescriptor.rs index fbe96c6963b1..b9f33b0313e4 100644 --- a/components/script/dom/bluetoothremotegattdescriptor.rs +++ b/components/script/dom/bluetoothremotegattdescriptor.rs @@ -13,7 +13,7 @@ use dom::bindings::codegen::Bindings::BluetoothRemoteGATTServerBinding::Bluetoot use dom::bindings::codegen::Bindings::BluetoothRemoteGATTServiceBinding::BluetoothRemoteGATTServiceMethods; use dom::bindings::error::Error::{self, InvalidModification, Network, Security}; use dom::bindings::reflector::{DomObject, Reflector, reflect_dom_object}; -use dom::bindings::root::{JS, Root}; +use dom::bindings::root::{Dom, Root}; use dom::bindings::str::{ByteString, DOMString}; use dom::bluetooth::{AsyncBluetoothListener, response_async}; use dom::bluetoothremotegattcharacteristic::{BluetoothRemoteGATTCharacteristic, MAXIMUM_ATTRIBUTE_LENGTH}; @@ -27,7 +27,7 @@ use std::rc::Rc; #[dom_struct] pub struct BluetoothRemoteGATTDescriptor { reflector_: Reflector, - characteristic: JS, + characteristic: Dom, uuid: DOMString, value: DOMRefCell>, instance_id: String, @@ -40,7 +40,7 @@ impl BluetoothRemoteGATTDescriptor { -> BluetoothRemoteGATTDescriptor { BluetoothRemoteGATTDescriptor { reflector_: Reflector::new(), - characteristic: JS::from_ref(characteristic), + characteristic: Dom::from_ref(characteristic), uuid: uuid, value: DOMRefCell::new(None), instance_id: instance_id, diff --git a/components/script/dom/bluetoothremotegattserver.rs b/components/script/dom/bluetoothremotegattserver.rs index 7d533114e290..99777f87b850 100644 --- a/components/script/dom/bluetoothremotegattserver.rs +++ b/components/script/dom/bluetoothremotegattserver.rs @@ -9,7 +9,7 @@ use dom::bindings::codegen::Bindings::BluetoothRemoteGATTServerBinding::Bluetoot use dom::bindings::error::Error; use dom::bindings::error::ErrorResult; use dom::bindings::reflector::{DomObject, Reflector, reflect_dom_object}; -use dom::bindings::root::{JS, Root}; +use dom::bindings::root::{Dom, Root}; use dom::bluetooth::{AsyncBluetoothListener, get_gatt_children, response_async}; use dom::bluetoothdevice::BluetoothDevice; use dom::bluetoothuuid::{BluetoothServiceUUID, BluetoothUUID}; @@ -24,7 +24,7 @@ use std::rc::Rc; #[dom_struct] pub struct BluetoothRemoteGATTServer { reflector_: Reflector, - device: JS, + device: Dom, connected: Cell, } @@ -32,7 +32,7 @@ impl BluetoothRemoteGATTServer { pub fn new_inherited(device: &BluetoothDevice) -> BluetoothRemoteGATTServer { BluetoothRemoteGATTServer { reflector_: Reflector::new(), - device: JS::from_ref(device), + device: Dom::from_ref(device), connected: Cell::new(false), } } diff --git a/components/script/dom/bluetoothremotegattservice.rs b/components/script/dom/bluetoothremotegattservice.rs index 4d2f0cfdb834..ca9f8b3286c5 100644 --- a/components/script/dom/bluetoothremotegattservice.rs +++ b/components/script/dom/bluetoothremotegattservice.rs @@ -8,7 +8,7 @@ use dom::bindings::codegen::Bindings::BluetoothRemoteGATTServiceBinding; use dom::bindings::codegen::Bindings::BluetoothRemoteGATTServiceBinding::BluetoothRemoteGATTServiceMethods; use dom::bindings::error::Error; use dom::bindings::reflector::reflect_dom_object; -use dom::bindings::root::{JS, Root}; +use dom::bindings::root::{Dom, Root}; use dom::bindings::str::DOMString; use dom::bluetooth::{AsyncBluetoothListener, get_gatt_children}; use dom::bluetoothdevice::BluetoothDevice; @@ -23,7 +23,7 @@ use std::rc::Rc; #[dom_struct] pub struct BluetoothRemoteGATTService { eventtarget: EventTarget, - device: JS, + device: Dom, uuid: DOMString, is_primary: bool, instance_id: String, @@ -37,7 +37,7 @@ impl BluetoothRemoteGATTService { -> BluetoothRemoteGATTService { BluetoothRemoteGATTService { eventtarget: EventTarget::new_inherited(), - device: JS::from_ref(device), + device: Dom::from_ref(device), uuid: uuid, is_primary: is_primary, instance_id: instance_id, diff --git a/components/script/dom/canvasrenderingcontext2d.rs b/components/script/dom/canvasrenderingcontext2d.rs index 4e98345eb07a..4eafb0907e8f 100644 --- a/components/script/dom/canvasrenderingcontext2d.rs +++ b/components/script/dom/canvasrenderingcontext2d.rs @@ -23,7 +23,7 @@ use dom::bindings::error::{Error, ErrorResult, Fallible}; use dom::bindings::inheritance::Castable; use dom::bindings::num::Finite; use dom::bindings::reflector::{DomObject, Reflector, reflect_dom_object}; -use dom::bindings::root::{JS, LayoutJS, Root}; +use dom::bindings::root::{Dom, LayoutJS, Root}; use dom::bindings::str::DOMString; use dom::canvasgradient::{CanvasGradient, CanvasGradientStyle, ToFillOrStrokeStyle}; use dom::canvaspattern::CanvasPattern; @@ -55,8 +55,8 @@ use unpremultiplytable::UNPREMULTIPLY_TABLE; #[allow(dead_code)] enum CanvasFillOrStrokeStyle { Color(RGBA), - Gradient(JS), - Pattern(JS), + Gradient(Dom), + Pattern(Dom), } // https://html.spec.whatwg.org/multipage/#canvasrenderingcontext2d @@ -67,7 +67,7 @@ pub struct CanvasRenderingContext2D { ipc_renderer: IpcSender, /// For rendering contexts created by an HTML canvas element, this is Some, /// for ones created by a paint worklet, this is None. - canvas: Option>, + canvas: Option>, #[ignore_heap_size_of = "Arc"] image_cache: Arc, /// Any missing image URLs. @@ -138,7 +138,7 @@ impl CanvasRenderingContext2D { CanvasRenderingContext2D { reflector_: Reflector::new(), ipc_renderer: ipc_renderer, - canvas: canvas.map(JS::from_ref), + canvas: canvas.map(Dom::from_ref), image_cache: image_cache, missing_image_urls: DOMRefCell::new(Vec::new()), base_url: base_url, @@ -1019,14 +1019,14 @@ impl CanvasRenderingContext2DMethods for CanvasRenderingContext2D { }, StringOrCanvasGradientOrCanvasPattern::CanvasGradient(gradient) => { self.state.borrow_mut().stroke_style = - CanvasFillOrStrokeStyle::Gradient(JS::from_ref(&*gradient)); + CanvasFillOrStrokeStyle::Gradient(Dom::from_ref(&*gradient)); let msg = CanvasMsg::Canvas2d( Canvas2dMsg::SetStrokeStyle(gradient.to_fill_or_stroke_style())); self.ipc_renderer.send(msg).unwrap(); }, StringOrCanvasGradientOrCanvasPattern::CanvasPattern(pattern) => { self.state.borrow_mut().stroke_style = - CanvasFillOrStrokeStyle::Pattern(JS::from_ref(&*pattern)); + CanvasFillOrStrokeStyle::Pattern(Dom::from_ref(&*pattern)); let msg = CanvasMsg::Canvas2d( Canvas2dMsg::SetStrokeStyle(pattern.to_fill_or_stroke_style())); self.ipc_renderer.send(msg).unwrap(); @@ -1068,14 +1068,14 @@ impl CanvasRenderingContext2DMethods for CanvasRenderingContext2D { } StringOrCanvasGradientOrCanvasPattern::CanvasGradient(gradient) => { self.state.borrow_mut().fill_style = - CanvasFillOrStrokeStyle::Gradient(JS::from_ref(&*gradient)); + CanvasFillOrStrokeStyle::Gradient(Dom::from_ref(&*gradient)); let msg = CanvasMsg::Canvas2d( Canvas2dMsg::SetFillStyle(gradient.to_fill_or_stroke_style())); self.ipc_renderer.send(msg).unwrap(); } StringOrCanvasGradientOrCanvasPattern::CanvasPattern(pattern) => { self.state.borrow_mut().fill_style = - CanvasFillOrStrokeStyle::Pattern(JS::from_ref(&*pattern)); + CanvasFillOrStrokeStyle::Pattern(Dom::from_ref(&*pattern)); let msg = CanvasMsg::Canvas2d( Canvas2dMsg::SetFillStyle(pattern.to_fill_or_stroke_style())); self.ipc_renderer.send(msg).unwrap(); diff --git a/components/script/dom/csskeyframerule.rs b/components/script/dom/csskeyframerule.rs index 6bfe052d775c..0b8329ccf1bd 100644 --- a/components/script/dom/csskeyframerule.rs +++ b/components/script/dom/csskeyframerule.rs @@ -5,7 +5,7 @@ use dom::bindings::codegen::Bindings::CSSKeyframeRuleBinding::{self, CSSKeyframeRuleMethods}; use dom::bindings::inheritance::Castable; use dom::bindings::reflector::{DomObject, reflect_dom_object}; -use dom::bindings::root::{JS, MutNullableJS, Root}; +use dom::bindings::root::{Dom, MutNullableJS, Root}; use dom::bindings::str::DOMString; use dom::cssrule::{CSSRule, SpecificCSSRule}; use dom::cssstyledeclaration::{CSSModificationAccess, CSSStyleDeclaration, CSSStyleOwner}; @@ -51,7 +51,7 @@ impl CSSKeyframeRuleMethods for CSSKeyframeRule { CSSStyleDeclaration::new( self.global().as_window(), CSSStyleOwner::CSSRule( - JS::from_ref(self.upcast()), + Dom::from_ref(self.upcast()), self.keyframerule.read_with(&guard).block.clone(), ), None, diff --git a/components/script/dom/cssrule.rs b/components/script/dom/cssrule.rs index 36c6b2187a22..928762abb3ce 100644 --- a/components/script/dom/cssrule.rs +++ b/components/script/dom/cssrule.rs @@ -5,7 +5,7 @@ use dom::bindings::codegen::Bindings::CSSRuleBinding::CSSRuleMethods; use dom::bindings::inheritance::Castable; use dom::bindings::reflector::Reflector; -use dom::bindings::root::{JS, Root}; +use dom::bindings::root::{Dom, Root}; use dom::bindings::str::DOMString; use dom::cssfontfacerule::CSSFontFaceRule; use dom::cssimportrule::CSSImportRule; @@ -27,7 +27,7 @@ use style::stylesheets::CssRule as StyleCssRule; #[dom_struct] pub struct CSSRule { reflector_: Reflector, - parent_stylesheet: JS, + parent_stylesheet: Dom, /// Whether the parentStyleSheet attribute should return null. /// We keep parent_stylesheet in that case because insertRule needs it @@ -40,7 +40,7 @@ impl CSSRule { pub fn new_inherited(parent_stylesheet: &CSSStyleSheet) -> CSSRule { CSSRule { reflector_: Reflector::new(), - parent_stylesheet: JS::from_ref(parent_stylesheet), + parent_stylesheet: Dom::from_ref(parent_stylesheet), parent_stylesheet_removed: Cell::new(false), } } diff --git a/components/script/dom/cssrulelist.rs b/components/script/dom/cssrulelist.rs index b20156060d39..4500405869e2 100644 --- a/components/script/dom/cssrulelist.rs +++ b/components/script/dom/cssrulelist.rs @@ -7,7 +7,7 @@ use dom::bindings::codegen::Bindings::CSSRuleListBinding; use dom::bindings::codegen::Bindings::CSSRuleListBinding::CSSRuleListMethods; use dom::bindings::error::{Error, ErrorResult, Fallible}; use dom::bindings::reflector::{DomObject, Reflector, reflect_dom_object}; -use dom::bindings::root::{JS, MutNullableJS, Root}; +use dom::bindings::root::{Dom, MutNullableJS, Root}; use dom::csskeyframerule::CSSKeyframeRule; use dom::cssrule::CSSRule; use dom::cssstylesheet::CSSStyleSheet; @@ -36,7 +36,7 @@ impl From for Error { #[dom_struct] pub struct CSSRuleList { reflector_: Reflector, - parent_stylesheet: JS, + parent_stylesheet: Dom, #[ignore_heap_size_of = "Arc"] rules: RulesSource, dom_rules: DOMRefCell>> @@ -62,7 +62,7 @@ impl CSSRuleList { CSSRuleList { reflector_: Reflector::new(), - parent_stylesheet: JS::from_ref(parent_stylesheet), + parent_stylesheet: Dom::from_ref(parent_stylesheet), rules: rules, dom_rules: DOMRefCell::new(dom_rules), } diff --git a/components/script/dom/cssstyledeclaration.rs b/components/script/dom/cssstyledeclaration.rs index 3230f9e920f9..dc2bf64d166f 100644 --- a/components/script/dom/cssstyledeclaration.rs +++ b/components/script/dom/cssstyledeclaration.rs @@ -7,7 +7,7 @@ use dom::bindings::codegen::Bindings::WindowBinding::WindowMethods; use dom::bindings::error::{Error, ErrorResult, Fallible}; use dom::bindings::inheritance::Castable; use dom::bindings::reflector::{DomObject, Reflector, reflect_dom_object}; -use dom::bindings::root::{JS, Root}; +use dom::bindings::root::{Dom, Root}; use dom::bindings::str::DOMString; use dom::cssrule::CSSRule; use dom::element::Element; @@ -36,8 +36,8 @@ pub struct CSSStyleDeclaration { #[derive(HeapSizeOf, JSTraceable)] #[must_root] pub enum CSSStyleOwner { - Element(JS), - CSSRule(JS, + Element(Dom), + CSSRule(Dom, #[ignore_heap_size_of = "Arc"] Arc>), } diff --git a/components/script/dom/cssstylerule.rs b/components/script/dom/cssstylerule.rs index 4a61905bfa19..5004a4f909b0 100644 --- a/components/script/dom/cssstylerule.rs +++ b/components/script/dom/cssstylerule.rs @@ -8,7 +8,7 @@ use dom::bindings::codegen::Bindings::CSSStyleRuleBinding::{self, CSSStyleRuleMe use dom::bindings::codegen::Bindings::WindowBinding::WindowBinding::WindowMethods; use dom::bindings::inheritance::Castable; use dom::bindings::reflector::{DomObject, reflect_dom_object}; -use dom::bindings::root::{JS, MutNullableJS, Root}; +use dom::bindings::root::{Dom, MutNullableJS, Root}; use dom::bindings::str::DOMString; use dom::cssrule::{CSSRule, SpecificCSSRule}; use dom::cssstyledeclaration::{CSSModificationAccess, CSSStyleDeclaration, CSSStyleOwner}; @@ -69,7 +69,7 @@ impl CSSStyleRuleMethods for CSSStyleRule { CSSStyleDeclaration::new( self.global().as_window(), CSSStyleOwner::CSSRule( - JS::from_ref(self.upcast()), + Dom::from_ref(self.upcast()), self.stylerule.read_with(&guard).block.clone() ), None, diff --git a/components/script/dom/cssstylesheet.rs b/components/script/dom/cssstylesheet.rs index 92434022fdd9..26396c964391 100644 --- a/components/script/dom/cssstylesheet.rs +++ b/components/script/dom/cssstylesheet.rs @@ -7,7 +7,7 @@ use dom::bindings::codegen::Bindings::CSSStyleSheetBinding::CSSStyleSheetMethods use dom::bindings::codegen::Bindings::WindowBinding::WindowBinding::WindowMethods; use dom::bindings::error::{Error, ErrorResult, Fallible}; use dom::bindings::reflector::{reflect_dom_object, DomObject}; -use dom::bindings::root::{JS, MutNullableJS, Root}; +use dom::bindings::root::{Dom, MutNullableJS, Root}; use dom::bindings::str::DOMString; use dom::cssrulelist::{CSSRuleList, RulesSource}; use dom::element::Element; @@ -22,7 +22,7 @@ use style::stylesheets::Stylesheet as StyleStyleSheet; #[dom_struct] pub struct CSSStyleSheet { stylesheet: StyleSheet, - owner: JS, + owner: Dom, rulelist: MutNullableJS, #[ignore_heap_size_of = "Arc"] style_stylesheet: Arc, @@ -37,7 +37,7 @@ impl CSSStyleSheet { stylesheet: Arc) -> CSSStyleSheet { CSSStyleSheet { stylesheet: StyleSheet::new_inherited(type_, href, title), - owner: JS::from_ref(owner), + owner: Dom::from_ref(owner), rulelist: MutNullableJS::new(None), style_stylesheet: stylesheet, origin_clean: Cell::new(true), diff --git a/components/script/dom/customelementregistry.rs b/components/script/dom/customelementregistry.rs index 62d54548755d..25a824c5d78a 100644 --- a/components/script/dom/customelementregistry.rs +++ b/components/script/dom/customelementregistry.rs @@ -14,7 +14,7 @@ use dom::bindings::conversions::{ConversionResult, FromJSValConvertible, Stringi use dom::bindings::error::{Error, ErrorResult, Fallible, report_pending_exception, throw_dom_exception}; use dom::bindings::inheritance::Castable; use dom::bindings::reflector::{DomObject, Reflector, reflect_dom_object}; -use dom::bindings::root::{JS, Root}; +use dom::bindings::root::{Dom, Root}; use dom::bindings::str::DOMString; use dom::document::Document; use dom::domexception::{DOMErrorName, DOMException}; @@ -45,7 +45,7 @@ use std::rc::Rc; pub struct CustomElementRegistry { reflector_: Reflector, - window: JS, + window: Dom, #[ignore_heap_size_of = "Rc"] when_defined: DOMRefCell>>, @@ -60,7 +60,7 @@ impl CustomElementRegistry { fn new_inherited(window: &Window) -> CustomElementRegistry { CustomElementRegistry { reflector_: Reflector::new(), - window: JS::from_ref(window), + window: Dom::from_ref(window), when_defined: DOMRefCell::new(HashMap::new()), element_definition_is_running: Cell::new(false), definitions: DOMRefCell::new(HashMap::new()), @@ -776,7 +776,7 @@ impl CustomElementReactionStack { #[derive(HeapSizeOf, JSTraceable)] #[must_root] struct ElementQueue { - queue: DOMRefCell>>, + queue: DOMRefCell>>, } impl ElementQueue { @@ -796,11 +796,11 @@ impl ElementQueue { } fn next_element(&self) -> Option> { - self.queue.borrow_mut().pop_front().as_ref().map(JS::deref).map(Root::from_ref) + self.queue.borrow_mut().pop_front().as_ref().map(Dom::deref).map(Root::from_ref) } fn append_element(&self, element: &Element) { - self.queue.borrow_mut().push_back(JS::from_ref(element)); + self.queue.borrow_mut().push_back(Dom::from_ref(element)); } } diff --git a/components/script/dom/dedicatedworkerglobalscope.rs b/components/script/dom/dedicatedworkerglobalscope.rs index b492bf9f6570..c77c857db5f9 100644 --- a/components/script/dom/dedicatedworkerglobalscope.rs +++ b/components/script/dom/dedicatedworkerglobalscope.rs @@ -86,7 +86,7 @@ pub struct DedicatedWorkerGlobalScope { own_sender: Sender<(TrustedWorkerAddress, WorkerScriptMsg)>, #[ignore_heap_size_of = "Defined in std"] timer_event_port: Receiver<(TrustedWorkerAddress, TimerEvent)>, - #[ignore_heap_size_of = "Trusted has unclear ownership like JS"] + #[ignore_heap_size_of = "Trusted has unclear ownership like Dom"] worker: DOMRefCell>, #[ignore_heap_size_of = "Can't measure trait objects"] /// Sender to the parent thread. diff --git a/components/script/dom/dissimilaroriginlocation.rs b/components/script/dom/dissimilaroriginlocation.rs index 34dc8b91fd96..249e960ff07e 100644 --- a/components/script/dom/dissimilaroriginlocation.rs +++ b/components/script/dom/dissimilaroriginlocation.rs @@ -7,7 +7,7 @@ use dom::bindings::codegen::Bindings::DissimilarOriginLocationBinding::Dissimila use dom::bindings::error::{Error, ErrorResult, Fallible}; use dom::bindings::reflector::Reflector; use dom::bindings::reflector::reflect_dom_object; -use dom::bindings::root::{JS, Root}; +use dom::bindings::root::{Dom, Root}; use dom::bindings::str::DOMString; use dom::bindings::str::USVString; use dom::dissimilaroriginwindow::DissimilarOriginWindow; @@ -27,7 +27,7 @@ pub struct DissimilarOriginLocation { reflector: Reflector, /// The window associated with this location. - window: JS, + window: Dom, } impl DissimilarOriginLocation { @@ -35,7 +35,7 @@ impl DissimilarOriginLocation { fn new_inherited(window: &DissimilarOriginWindow) -> DissimilarOriginLocation { DissimilarOriginLocation { reflector: Reflector::new(), - window: JS::from_ref(window), + window: Dom::from_ref(window), } } diff --git a/components/script/dom/dissimilaroriginwindow.rs b/components/script/dom/dissimilaroriginwindow.rs index f6979e672b51..174446b6098f 100644 --- a/components/script/dom/dissimilaroriginwindow.rs +++ b/components/script/dom/dissimilaroriginwindow.rs @@ -6,7 +6,7 @@ use dom::bindings::codegen::Bindings::DissimilarOriginWindowBinding; use dom::bindings::codegen::Bindings::DissimilarOriginWindowBinding::DissimilarOriginWindowMethods; use dom::bindings::error::{Error, ErrorResult}; use dom::bindings::inheritance::Castable; -use dom::bindings::root::{JS, MutNullableJS, Root}; +use dom::bindings::root::{Dom, MutNullableJS, Root}; use dom::bindings::str::DOMString; use dom::bindings::structuredclone::StructuredCloneData; use dom::dissimilaroriginlocation::DissimilarOriginLocation; @@ -37,7 +37,7 @@ pub struct DissimilarOriginWindow { globalscope: GlobalScope, /// The window proxy for this window. - window_proxy: JS, + window_proxy: Dom, /// The location of this window, initialized lazily. location: MutNullableJS, @@ -67,7 +67,7 @@ impl DissimilarOriginWindow { // here, but this whole DOM interface is a hack anyway. global_to_clone_from.microtask_queue().clone(), ), - window_proxy: JS::from_ref(window_proxy), + window_proxy: Dom::from_ref(window_proxy), location: Default::default(), }; unsafe { DissimilarOriginWindowBinding::Wrap(cx, win) } diff --git a/components/script/dom/document.rs b/components/script/dom/document.rs index 7937ba7729d8..3075dcfc54df 100644 --- a/components/script/dom/document.rs +++ b/components/script/dom/document.rs @@ -27,7 +27,7 @@ use dom::bindings::inheritance::{Castable, ElementTypeId, HTMLElementTypeId, Nod use dom::bindings::num::Finite; use dom::bindings::refcounted::{Trusted, TrustedPromise}; use dom::bindings::reflector::{DomObject, reflect_dom_object}; -use dom::bindings::root::{JS, LayoutJS, MutNullableJS, Root, RootedReference}; +use dom::bindings::root::{Dom, LayoutJS, MutNullableJS, Root, RootedReference}; use dom::bindings::str::{DOMString, USVString}; use dom::bindings::xmlname::{namespace_from_domstring, validate_and_extract, xml_name_type}; use dom::bindings::xmlname::XMLName::InvalidXMLName; @@ -196,7 +196,7 @@ impl PendingRestyle { struct StyleSheetInDocument { #[ignore_heap_size_of = "Arc"] sheet: Arc, - owner: JS, + owner: Dom, } impl PartialEq for StyleSheetInDocument { @@ -223,7 +223,7 @@ impl ::style::stylesheets::StylesheetInDocument for StyleSheetInDocument { #[dom_struct] pub struct Document { node: Node, - window: JS, + window: Dom, implementation: MutNullableJS, content_type: DOMString, last_modified: Option, @@ -235,10 +235,10 @@ pub struct Document { #[ignore_heap_size_of = "defined in selectors"] quirks_mode: Cell, /// Caches for the getElement methods - id_map: DOMRefCell>>>, - tag_map: DOMRefCell>>, - tagns_map: DOMRefCell>>, - classes_map: DOMRefCell, JS>>, + id_map: DOMRefCell>>>, + tag_map: DOMRefCell>>, + tagns_map: DOMRefCell>>, + classes_map: DOMRefCell, Dom>>, images: MutNullableJS, embeds: MutNullableJS, links: MutNullableJS, @@ -270,7 +270,7 @@ pub struct Document { /// https://html.spec.whatwg.org/multipage/#list-of-scripts-that-will-execute-in-order-as-soon-as-possible asap_in_order_scripts_list: PendingInOrderScriptVec, /// https://html.spec.whatwg.org/multipage/#set-of-scripts-that-will-execute-as-soon-as-possible - asap_scripts_set: DOMRefCell>>, + asap_scripts_set: DOMRefCell>>, /// https://html.spec.whatwg.org/multipage/#concept-n-noscript /// True if scripting is enabled for all scripts in this document scripting_enabled: bool, @@ -298,12 +298,12 @@ pub struct Document { appropriate_template_contents_owner_document: MutNullableJS, /// Information on elements needing restyle to ship over to the layout thread when the /// time comes. - pending_restyles: DOMRefCell, PendingRestyle>>, + pending_restyles: DOMRefCell, PendingRestyle>>, /// This flag will be true if layout suppressed a reflow attempt that was /// needed in order for the page to be painted. needs_paint: Cell, /// http://w3c.github.io/touch-events/#dfn-active-touch-point - active_touch_points: DOMRefCell>>, + active_touch_points: DOMRefCell>>, /// Navigation Timing properties: /// https://w3c.github.io/navigation-timing/#sec-PerformanceNavigationTiming dom_loading: Cell, @@ -347,7 +347,7 @@ pub struct Document { /// whenever any element with the same ID as the form attribute /// is inserted or removed from the document. /// See https://html.spec.whatwg.org/multipage/#form-owner - form_id_listener_map: DOMRefCell>>>, + form_id_listener_map: DOMRefCell>>>, } #[derive(HeapSizeOf, JSTraceable)] @@ -659,13 +659,13 @@ impl Document { let mut map = self.form_id_listener_map.borrow_mut(); let listener = listener.to_element(); let set = map.entry(Atom::from(id)).or_insert(HashSet::new()); - set.insert(JS::from_ref(listener)); + set.insert(Dom::from_ref(listener)); } pub fn unregister_form_id_listener(&self, id: DOMString, listener: &T) { let mut map = self.form_id_listener_map.borrow_mut(); if let Occupied(mut entry) = map.entry(Atom::from(id)) { - entry.get_mut().remove(&JS::from_ref(listener.to_element())); + entry.get_mut().remove(&Dom::from_ref(listener.to_element())); if entry.get().is_empty() { entry.remove(); } @@ -1274,13 +1274,13 @@ impl Document { match event_type { TouchEventType::Down => { // Add a new touch point - self.active_touch_points.borrow_mut().push(JS::from_ref(&*touch)); + self.active_touch_points.borrow_mut().push(Dom::from_ref(&*touch)); } TouchEventType::Move => { // Replace an existing touch point let mut active_touch_points = self.active_touch_points.borrow_mut(); match active_touch_points.iter_mut().find(|t| t.Identifier() == identifier) { - Some(t) => *t = JS::from_ref(&*touch), + Some(t) => *t = Dom::from_ref(&*touch), None => warn!("Got a touchmove event for a non-active touch point"), } } @@ -1820,7 +1820,7 @@ impl Document { // https://html.spec.whatwg.org/multipage/#set-of-scripts-that-will-execute-as-soon-as-possible pub fn add_asap_script(&self, script: &HTMLScriptElement) { - self.asap_scripts_set.borrow_mut().push(JS::from_ref(script)); + self.asap_scripts_set.borrow_mut().push(Dom::from_ref(script)); } /// https://html.spec.whatwg.org/multipage/#the-end step 5. @@ -2217,7 +2217,7 @@ impl Document { Document { node: Node::new_document_node(), - window: JS::from_ref(window), + window: Dom::from_ref(window), has_browsing_context: has_browsing_context == HasBrowsingContext::Yes, implementation: Default::default(), content_type: match content_type { @@ -2426,7 +2426,7 @@ impl Document { None, StyleSheetInDocument { sheet: s.clone(), - owner: JS::from_ref(owner), + owner: Dom::from_ref(owner), }, &guard, ); @@ -2461,7 +2461,7 @@ impl Document { let sheet = StyleSheetInDocument { sheet, - owner: JS::from_ref(owner), + owner: Dom::from_ref(owner), }; let lock = self.style_shared_lock(); @@ -2522,7 +2522,7 @@ impl Document { pub fn ensure_pending_restyle(&self, el: &Element) -> RefMut { let map = self.pending_restyles.borrow_mut(); - RefMut::map(map, |m| m.entry(JS::from_ref(el)).or_insert_with(PendingRestyle::new)) + RefMut::map(map, |m| m.entry(Dom::from_ref(el)).or_insert_with(PendingRestyle::new)) } pub fn element_state_will_change(&self, el: &Element) { @@ -2748,7 +2748,7 @@ impl Element { impl DocumentMethods for Document { // https://drafts.csswg.org/cssom/#dom-document-stylesheets fn StyleSheets(&self) -> Root { - self.stylesheet_list.or_init(|| StyleSheetList::new(&self.window, JS::from_ref(&self))) + self.stylesheet_list.or_init(|| StyleSheetList::new(&self.window, Dom::from_ref(&self))) } // https://dom.spec.whatwg.org/#dom-document-implementation @@ -2916,7 +2916,7 @@ impl DocumentMethods for Document { Vacant(entry) => { let result = HTMLCollection::by_qualified_name( &self.window, self.upcast(), qualified_name); - entry.insert(JS::from_ref(&*result)); + entry.insert(Dom::from_ref(&*result)); result } } @@ -2934,7 +2934,7 @@ impl DocumentMethods for Document { Occupied(entry) => Root::from_ref(entry.get()), Vacant(entry) => { let result = HTMLCollection::by_qual_tag_name(&self.window, self.upcast(), qname); - entry.insert(JS::from_ref(&*result)); + entry.insert(Dom::from_ref(&*result)); result } } @@ -2951,7 +2951,7 @@ impl DocumentMethods for Document { let result = HTMLCollection::by_atomic_class_name(&self.window, self.upcast(), class_atoms); - entry.insert(JS::from_ref(&*result)); + entry.insert(Dom::from_ref(&*result)); result } } @@ -4117,17 +4117,17 @@ impl PendingInOrderScriptVec { #[derive(HeapSizeOf, JSTraceable)] #[must_root] struct PendingScript { - element: JS, + element: Dom, load: Option, } impl PendingScript { fn new(element: &HTMLScriptElement) -> Self { - Self { element: JS::from_ref(element), load: None } + Self { element: Dom::from_ref(element), load: None } } fn new_with_load(element: &HTMLScriptElement, load: Option) -> Self { - Self { element: JS::from_ref(element), load } + Self { element: Dom::from_ref(element), load } } fn loaded(&mut self, result: ScriptResult) { diff --git a/components/script/dom/domimplementation.rs b/components/script/dom/domimplementation.rs index 1346c52690f6..189a10412c35 100644 --- a/components/script/dom/domimplementation.rs +++ b/components/script/dom/domimplementation.rs @@ -10,7 +10,7 @@ use dom::bindings::codegen::Bindings::NodeBinding::NodeMethods; use dom::bindings::error::Fallible; use dom::bindings::inheritance::Castable; use dom::bindings::reflector::{Reflector, reflect_dom_object}; -use dom::bindings::root::{JS, Root}; +use dom::bindings::root::{Dom, Root}; use dom::bindings::str::DOMString; use dom::bindings::xmlname::{namespace_from_domstring, validate_qualified_name}; use dom::document::{Document, HasBrowsingContext, IsHTMLDocument}; @@ -30,14 +30,14 @@ use script_traits::DocumentActivity; #[dom_struct] pub struct DOMImplementation { reflector_: Reflector, - document: JS, + document: Dom, } impl DOMImplementation { fn new_inherited(document: &Document) -> DOMImplementation { DOMImplementation { reflector_: Reflector::new(), - document: JS::from_ref(document), + document: Dom::from_ref(document), } } diff --git a/components/script/dom/domparser.rs b/components/script/dom/domparser.rs index f82dea49f80a..6181087acd7d 100644 --- a/components/script/dom/domparser.rs +++ b/components/script/dom/domparser.rs @@ -13,7 +13,7 @@ use dom::bindings::codegen::Bindings::DocumentBinding::DocumentReadyState; use dom::bindings::codegen::Bindings::WindowBinding::WindowMethods; use dom::bindings::error::Fallible; use dom::bindings::reflector::{Reflector, reflect_dom_object}; -use dom::bindings::root::{JS, Root}; +use dom::bindings::root::{Dom, Root}; use dom::bindings::str::DOMString; use dom::document::{Document, HasBrowsingContext, IsHTMLDocument}; use dom::document::DocumentSource; @@ -25,14 +25,14 @@ use script_traits::DocumentActivity; #[dom_struct] pub struct DOMParser { reflector_: Reflector, - window: JS, // XXXjdm Document instead? + window: Dom, // XXXjdm Document instead? } impl DOMParser { fn new_inherited(window: &Window) -> DOMParser { DOMParser { reflector_: Reflector::new(), - window: JS::from_ref(window), + window: Dom::from_ref(window), } } diff --git a/components/script/dom/domquad.rs b/components/script/dom/domquad.rs index b6c186d05dbb..f31cfc3e05e9 100644 --- a/components/script/dom/domquad.rs +++ b/components/script/dom/domquad.rs @@ -7,7 +7,7 @@ use dom::bindings::codegen::Bindings::DOMQuadBinding::{DOMQuadInit, DOMQuadMetho use dom::bindings::codegen::Bindings::DOMRectReadOnlyBinding::DOMRectInit; use dom::bindings::error::Fallible; use dom::bindings::reflector::{DomObject, Reflector, reflect_dom_object}; -use dom::bindings::root::{Root, JS}; +use dom::bindings::root::{Root, Dom}; use dom::dompoint::DOMPoint; use dom::domrect::DOMRect; use dom::globalscope::GlobalScope; @@ -17,10 +17,10 @@ use dom_struct::dom_struct; #[dom_struct] pub struct DOMQuad { reflector_: Reflector, - p1: JS, - p2: JS, - p3: JS, - p4: JS, + p1: Dom, + p2: Dom, + p3: Dom, + p4: Dom, } impl DOMQuad { @@ -31,10 +31,10 @@ impl DOMQuad { -> DOMQuad { DOMQuad { reflector_: Reflector::new(), - p1: JS::from_ref(p1), - p2: JS::from_ref(p2), - p3: JS::from_ref(p3), - p4: JS::from_ref(p4), + p1: Dom::from_ref(p1), + p2: Dom::from_ref(p2), + p3: Dom::from_ref(p3), + p4: Dom::from_ref(p4), } } diff --git a/components/script/dom/domstringmap.rs b/components/script/dom/domstringmap.rs index 50c81c9d3b5d..ae7387c28255 100644 --- a/components/script/dom/domstringmap.rs +++ b/components/script/dom/domstringmap.rs @@ -6,7 +6,7 @@ use dom::bindings::codegen::Bindings::DOMStringMapBinding; use dom::bindings::codegen::Bindings::DOMStringMapBinding::DOMStringMapMethods; use dom::bindings::error::ErrorResult; use dom::bindings::reflector::{Reflector, reflect_dom_object}; -use dom::bindings::root::{JS, Root}; +use dom::bindings::root::{Dom, Root}; use dom::bindings::str::DOMString; use dom::htmlelement::HTMLElement; use dom::node::window_from_node; @@ -15,14 +15,14 @@ use dom_struct::dom_struct; #[dom_struct] pub struct DOMStringMap { reflector_: Reflector, - element: JS, + element: Dom, } impl DOMStringMap { fn new_inherited(element: &HTMLElement) -> DOMStringMap { DOMStringMap { reflector_: Reflector::new(), - element: JS::from_ref(element), + element: Dom::from_ref(element), } } diff --git a/components/script/dom/domtokenlist.rs b/components/script/dom/domtokenlist.rs index 16523a489fc9..96fd12269502 100644 --- a/components/script/dom/domtokenlist.rs +++ b/components/script/dom/domtokenlist.rs @@ -7,7 +7,7 @@ use dom::bindings::codegen::Bindings::DOMTokenListBinding; use dom::bindings::codegen::Bindings::DOMTokenListBinding::DOMTokenListMethods; use dom::bindings::error::{Error, ErrorResult, Fallible}; use dom::bindings::reflector::{Reflector, reflect_dom_object}; -use dom::bindings::root::{JS, Root}; +use dom::bindings::root::{Dom, Root}; use dom::bindings::str::DOMString; use dom::element::Element; use dom::node::window_from_node; @@ -19,7 +19,7 @@ use style::str::HTML_SPACE_CHARACTERS; #[dom_struct] pub struct DOMTokenList { reflector_: Reflector, - element: JS, + element: Dom, local_name: LocalName, } @@ -27,7 +27,7 @@ impl DOMTokenList { pub fn new_inherited(element: &Element, local_name: LocalName) -> DOMTokenList { DOMTokenList { reflector_: Reflector::new(), - element: JS::from_ref(element), + element: Dom::from_ref(element), local_name: local_name, } } diff --git a/components/script/dom/element.rs b/components/script/dom/element.rs index d62bd03896b5..03c09c36df82 100644 --- a/components/script/dom/element.rs +++ b/components/script/dom/element.rs @@ -24,7 +24,7 @@ use dom::bindings::error::{Error, ErrorResult, Fallible}; use dom::bindings::inheritance::{Castable, ElementTypeId, HTMLElementTypeId, NodeTypeId}; use dom::bindings::refcounted::{Trusted, TrustedPromise}; use dom::bindings::reflector::DomObject; -use dom::bindings::root::{JS, LayoutJS, MutNullableJS, Root, RootedReference}; +use dom::bindings::root::{Dom, LayoutJS, MutNullableJS, Root, RootedReference}; use dom::bindings::str::DOMString; use dom::bindings::xmlname::{namespace_from_domstring, validate_and_extract, xml_name_type}; use dom::bindings::xmlname::XMLName::InvalidXMLName; @@ -131,7 +131,7 @@ pub struct Element { tag_name: TagName, namespace: Namespace, prefix: DOMRefCell>, - attrs: DOMRefCell>>, + attrs: DOMRefCell>>, id_attribute: DOMRefCell>, is: DOMRefCell>, #[ignore_heap_size_of = "Arc"] @@ -912,7 +912,7 @@ impl Element { *self.prefix.borrow_mut() = prefix; } - pub fn attrs(&self) -> Ref<[JS]> { + pub fn attrs(&self) -> Ref<[Dom]> { Ref::map(self.attrs.borrow(), |attrs| &**attrs) } @@ -1118,7 +1118,7 @@ impl Element { assert!(attr.GetOwnerElement().r() == Some(self)); self.will_mutate_attr(attr); - self.attrs.borrow_mut().push(JS::from_ref(attr)); + self.attrs.borrow_mut().push(Dom::from_ref(attr)); if attr.namespace() == &ns!() { vtable_for(self.upcast()).attribute_mutated(attr, AttributeMutation::Set(None)); } @@ -1692,7 +1692,7 @@ impl ElementMethods for Element { } self.will_mutate_attr(attr); attr.set_owner(Some(self)); - self.attrs.borrow_mut()[position] = JS::from_ref(attr); + self.attrs.borrow_mut()[position] = Dom::from_ref(attr); old_attr.set_owner(None); if attr.namespace() == &ns!() { vtable.attribute_mutated( diff --git a/components/script/dom/event.rs b/components/script/dom/event.rs index 7dfd9e80409b..58c4a503c8e5 100644 --- a/components/script/dom/event.rs +++ b/components/script/dom/event.rs @@ -11,7 +11,7 @@ use dom::bindings::error::Fallible; use dom::bindings::inheritance::Castable; use dom::bindings::refcounted::Trusted; use dom::bindings::reflector::{DomObject, Reflector, reflect_dom_object}; -use dom::bindings::root::{JS, MutNullableJS, Root, RootedReference}; +use dom::bindings::root::{Dom, MutNullableJS, Root, RootedReference}; use dom::bindings::str::DOMString; use dom::document::Document; use dom::eventtarget::{CompiledEventListener, EventTarget, ListenerPhase}; @@ -137,13 +137,13 @@ impl Event { // Step 4. if let Some(target_node) = target.downcast::() { for ancestor in target_node.ancestors() { - event_path.push(JS::from_ref(ancestor.upcast::())); + event_path.push(Dom::from_ref(ancestor.upcast::())); } let top_most_ancestor_or_target = Root::from_ref(event_path.r().last().cloned().unwrap_or(target)); if let Some(document) = Root::downcast::(top_most_ancestor_or_target) { if self.type_() != atom!("load") && document.browsing_context().is_some() { - event_path.push(JS::from_ref(document.window().upcast())); + event_path.push(Dom::from_ref(document.window().upcast())); } } } diff --git a/components/script/dom/filelist.rs b/components/script/dom/filelist.rs index d6e6dcd7158b..2591419c4906 100644 --- a/components/script/dom/filelist.rs +++ b/components/script/dom/filelist.rs @@ -5,7 +5,7 @@ use dom::bindings::codegen::Bindings::FileListBinding; use dom::bindings::codegen::Bindings::FileListBinding::FileListMethods; use dom::bindings::reflector::{Reflector, reflect_dom_object}; -use dom::bindings::root::{JS, Root}; +use dom::bindings::root::{Dom, Root}; use dom::file::File; use dom::window::Window; use dom_struct::dom_struct; @@ -15,12 +15,12 @@ use std::slice::Iter; #[dom_struct] pub struct FileList { reflector_: Reflector, - list: Vec> + list: Vec> } impl FileList { #[allow(unrooted_must_root)] - fn new_inherited(files: Vec>) -> FileList { + fn new_inherited(files: Vec>) -> FileList { FileList { reflector_: Reflector::new(), list: files @@ -29,12 +29,12 @@ impl FileList { #[allow(unrooted_must_root)] pub fn new(window: &Window, files: Vec>) -> Root { - reflect_dom_object(box FileList::new_inherited(files.iter().map(|r| JS::from_ref(&**r)).collect()), + reflect_dom_object(box FileList::new_inherited(files.iter().map(|r| Dom::from_ref(&**r)).collect()), window, FileListBinding::Wrap) } - pub fn iter_files(&self) -> Iter> { + pub fn iter_files(&self) -> Iter> { self.list.iter() } } diff --git a/components/script/dom/gamepad.rs b/components/script/dom/gamepad.rs index 96da458d98bb..0b6dd7af6f52 100644 --- a/components/script/dom/gamepad.rs +++ b/components/script/dom/gamepad.rs @@ -8,7 +8,7 @@ use dom::bindings::codegen::Bindings::GamepadBinding::GamepadMethods; use dom::bindings::inheritance::Castable; use dom::bindings::num::Finite; use dom::bindings::reflector::{DomObject, Reflector, reflect_dom_object}; -use dom::bindings::root::{JS, Root}; +use dom::bindings::root::{Dom, Root}; use dom::bindings::str::DOMString; use dom::event::Event; use dom::eventtarget::EventTarget; @@ -33,8 +33,8 @@ pub struct Gamepad { timestamp: Cell, mapping_type: String, axes: Heap<*mut JSObject>, - buttons: JS, - pose: Option>, + buttons: Dom, + pose: Option>, #[ignore_heap_size_of = "Defined in rust-webvr"] hand: WebVRGamepadHand, display_id: u32 @@ -60,8 +60,8 @@ impl Gamepad { timestamp: Cell::new(timestamp), mapping_type: mapping_type, axes: Heap::default(), - buttons: JS::from_ref(buttons), - pose: pose.map(JS::from_ref), + buttons: Dom::from_ref(buttons), + pose: pose.map(Dom::from_ref), hand: hand, display_id: display_id } diff --git a/components/script/dom/gamepadbuttonlist.rs b/components/script/dom/gamepadbuttonlist.rs index 0e26875fcc39..aa741efc59ea 100644 --- a/components/script/dom/gamepadbuttonlist.rs +++ b/components/script/dom/gamepadbuttonlist.rs @@ -5,7 +5,7 @@ use dom::bindings::codegen::Bindings::GamepadButtonListBinding; use dom::bindings::codegen::Bindings::GamepadButtonListBinding::GamepadButtonListMethods; use dom::bindings::reflector::{Reflector, reflect_dom_object}; -use dom::bindings::root::{JS, Root, RootedReference}; +use dom::bindings::root::{Dom, Root, RootedReference}; use dom::gamepadbutton::GamepadButton; use dom::globalscope::GlobalScope; use dom_struct::dom_struct; @@ -15,7 +15,7 @@ use webvr_traits::WebVRGamepadButton; #[dom_struct] pub struct GamepadButtonList { reflector_: Reflector, - list: Vec> + list: Vec> } impl GamepadButtonList { @@ -23,7 +23,7 @@ impl GamepadButtonList { fn new_inherited(list: &[&GamepadButton]) -> GamepadButtonList { GamepadButtonList { reflector_: Reflector::new(), - list: list.iter().map(|button| JS::from_ref(*button)).collect(), + list: list.iter().map(|button| Dom::from_ref(*button)).collect(), } } diff --git a/components/script/dom/gamepadevent.rs b/components/script/dom/gamepadevent.rs index 7e4f899f00c5..807cdc427696 100644 --- a/components/script/dom/gamepadevent.rs +++ b/components/script/dom/gamepadevent.rs @@ -8,7 +8,7 @@ use dom::bindings::codegen::Bindings::GamepadEventBinding::GamepadEventMethods; use dom::bindings::error::Fallible; use dom::bindings::inheritance::Castable; use dom::bindings::reflector::{DomObject, reflect_dom_object}; -use dom::bindings::root::{JS, Root}; +use dom::bindings::root::{Dom, Root}; use dom::bindings::str::DOMString; use dom::event::Event; use dom::gamepad::Gamepad; @@ -20,7 +20,7 @@ use servo_atoms::Atom; #[dom_struct] pub struct GamepadEvent { event: Event, - gamepad: JS, + gamepad: Dom, } pub enum GamepadEventType { @@ -32,7 +32,7 @@ impl GamepadEvent { fn new_inherited(gamepad: &Gamepad) -> GamepadEvent { GamepadEvent { event: Event::new_inherited(), - gamepad: JS::from_ref(gamepad), + gamepad: Dom::from_ref(gamepad), } } diff --git a/components/script/dom/gamepadlist.rs b/components/script/dom/gamepadlist.rs index 9c84a0597030..dec21410c9da 100644 --- a/components/script/dom/gamepadlist.rs +++ b/components/script/dom/gamepadlist.rs @@ -6,7 +6,7 @@ use dom::bindings::cell::DOMRefCell; use dom::bindings::codegen::Bindings::GamepadListBinding; use dom::bindings::codegen::Bindings::GamepadListBinding::GamepadListMethods; use dom::bindings::reflector::{Reflector, reflect_dom_object}; -use dom::bindings::root::{JS, Root}; +use dom::bindings::root::{Dom, Root}; use dom::gamepad::Gamepad; use dom::globalscope::GlobalScope; use dom_struct::dom_struct; @@ -15,14 +15,14 @@ use dom_struct::dom_struct; #[dom_struct] pub struct GamepadList { reflector_: Reflector, - list: DOMRefCell>> + list: DOMRefCell>> } impl GamepadList { fn new_inherited(list: &[&Gamepad]) -> GamepadList { GamepadList { reflector_: Reflector::new(), - list: DOMRefCell::new(list.iter().map(|g| JS::from_ref(&**g)).collect()) + list: DOMRefCell::new(list.iter().map(|g| Dom::from_ref(&**g)).collect()) } } @@ -35,7 +35,7 @@ impl GamepadList { pub fn add_if_not_exists(&self, gamepads: &[Root]) { for gamepad in gamepads { if !self.list.borrow().iter().any(|g| g.gamepad_id() == gamepad.gamepad_id()) { - self.list.borrow_mut().push(JS::from_ref(&*gamepad)); + self.list.borrow_mut().push(Dom::from_ref(&*gamepad)); // Ensure that the gamepad has the correct index gamepad.update_index(self.list.borrow().len() as i32 - 1); } diff --git a/components/script/dom/globalscope.rs b/components/script/dom/globalscope.rs index 11196102af03..16e47e0396f0 100644 --- a/components/script/dom/globalscope.rs +++ b/components/script/dom/globalscope.rs @@ -409,7 +409,7 @@ impl GlobalScope { let _aes = AutoEntryScript::new(self); let options = CompileOptionsWrapper::new(cx, filename.as_ptr(), line_number); - debug!("evaluating JS string"); + debug!("evaluating Dom string"); let result = unsafe { Evaluate2(cx, options.ptr, code.as_ptr(), code.len() as libc::size_t, @@ -417,7 +417,7 @@ impl GlobalScope { }; if !result { - debug!("error evaluating JS string"); + debug!("error evaluating Dom string"); unsafe { report_pending_exception(cx, true) }; } diff --git a/components/script/dom/history.rs b/components/script/dom/history.rs index bc22a3e3af27..7cca59380b6d 100644 --- a/components/script/dom/history.rs +++ b/components/script/dom/history.rs @@ -9,7 +9,7 @@ use dom::bindings::codegen::Bindings::WindowBinding::WindowMethods; use dom::bindings::error::{Error, ErrorResult, Fallible}; use dom::bindings::inheritance::Castable; use dom::bindings::reflector::{Reflector, reflect_dom_object}; -use dom::bindings::root::{JS, Root}; +use dom::bindings::root::{Dom, Root}; use dom::globalscope::GlobalScope; use dom::window::Window; use dom_struct::dom_struct; @@ -21,14 +21,14 @@ use script_traits::ScriptMsg; #[dom_struct] pub struct History { reflector_: Reflector, - window: JS, + window: Dom, } impl History { pub fn new_inherited(window: &Window) -> History { History { reflector_: Reflector::new(), - window: JS::from_ref(&window), + window: Dom::from_ref(&window), } } diff --git a/components/script/dom/htmlcanvaselement.rs b/components/script/dom/htmlcanvaselement.rs index e870a3195010..0e376f63b2d1 100644 --- a/components/script/dom/htmlcanvaselement.rs +++ b/components/script/dom/htmlcanvaselement.rs @@ -15,7 +15,7 @@ use dom::bindings::conversions::ConversionResult; use dom::bindings::error::{Error, Fallible}; use dom::bindings::inheritance::Castable; use dom::bindings::num::Finite; -use dom::bindings::root::{JS, LayoutJS, Root}; +use dom::bindings::root::{Dom, LayoutJS, Root}; use dom::bindings::str::DOMString; use dom::canvasrenderingcontext2d::{CanvasRenderingContext2D, LayoutCanvasRenderingContext2DHelpers}; use dom::document::Document; @@ -44,8 +44,8 @@ const DEFAULT_HEIGHT: u32 = 150; #[must_root] #[derive(Clone, HeapSizeOf, JSTraceable)] pub enum CanvasContext { - Context2d(JS), - WebGL(JS), + Context2d(Dom), + WebGL(Dom), } #[dom_struct] @@ -156,7 +156,7 @@ impl HTMLCanvasElement { let window = window_from_node(self); let size = self.get_size(); let context = CanvasRenderingContext2D::new(window.upcast::(), self, size); - *self.context.borrow_mut() = Some(CanvasContext::Context2d(JS::from_ref(&*context))); + *self.context.borrow_mut() = Some(CanvasContext::Context2d(Dom::from_ref(&*context))); } match *self.context.borrow().as_ref().unwrap() { @@ -192,7 +192,7 @@ impl HTMLCanvasElement { let maybe_ctx = WebGLRenderingContext::new(&window, self, size, attrs); - *self.context.borrow_mut() = maybe_ctx.map( |ctx| CanvasContext::WebGL(JS::from_ref(&*ctx))); + *self.context.borrow_mut() = maybe_ctx.map( |ctx| CanvasContext::WebGL(Dom::from_ref(&*ctx))); } if let Some(CanvasContext::WebGL(ref context)) = *self.context.borrow() { diff --git a/components/script/dom/htmlcollection.rs b/components/script/dom/htmlcollection.rs index 533659be4b94..c99e794a0e5b 100644 --- a/components/script/dom/htmlcollection.rs +++ b/components/script/dom/htmlcollection.rs @@ -6,7 +6,7 @@ use dom::bindings::codegen::Bindings::HTMLCollectionBinding; use dom::bindings::codegen::Bindings::HTMLCollectionBinding::HTMLCollectionMethods; use dom::bindings::inheritance::Castable; use dom::bindings::reflector::{Reflector, reflect_dom_object}; -use dom::bindings::root::{JS, Root, MutNullableJS}; +use dom::bindings::root::{Dom, Root, MutNullableJS}; use dom::bindings::str::DOMString; use dom::bindings::trace::JSTraceable; use dom::bindings::xmlname::namespace_from_domstring; @@ -53,7 +53,7 @@ impl OptionU32 { #[dom_struct] pub struct HTMLCollection { reflector_: Reflector, - root: JS, + root: Dom, #[ignore_heap_size_of = "Contains a trait object; can't measure due to #6870"] filter: Box, // We cache the version of the root node and all its decendents, @@ -70,7 +70,7 @@ impl HTMLCollection { pub fn new_inherited(root: &Node, filter: Box) -> HTMLCollection { HTMLCollection { reflector_: Reflector::new(), - root: JS::from_ref(root), + root: Dom::from_ref(root), filter: filter, // Default values for the cache cached_version: Cell::new(root.inclusive_descendants_version()), diff --git a/components/script/dom/htmlelement.rs b/components/script/dom/htmlelement.rs index 5fc6023eebae..946696863dc6 100644 --- a/components/script/dom/htmlelement.rs +++ b/components/script/dom/htmlelement.rs @@ -12,7 +12,7 @@ use dom::bindings::codegen::Bindings::WindowBinding::WindowMethods; use dom::bindings::error::{Error, ErrorResult}; use dom::bindings::inheritance::{ElementTypeId, HTMLElementTypeId, NodeTypeId}; use dom::bindings::inheritance::Castable; -use dom::bindings::root::{JS, MutNullableJS, Root, RootedReference}; +use dom::bindings::root::{Dom, MutNullableJS, Root, RootedReference}; use dom::bindings::str::DOMString; use dom::cssstyledeclaration::{CSSModificationAccess, CSSStyleDeclaration, CSSStyleOwner}; use dom::document::{Document, FocusType}; @@ -115,7 +115,7 @@ impl HTMLElementMethods for HTMLElement { self.style_decl.or_init(|| { let global = window_from_node(self); CSSStyleDeclaration::new(&global, - CSSStyleOwner::Element(JS::from_ref(self.upcast())), + CSSStyleOwner::Element(Dom::from_ref(self.upcast())), None, CSSModificationAccess::ReadWrite) }) diff --git a/components/script/dom/htmlformelement.rs b/components/script/dom/htmlformelement.rs index 82f9d35997ee..5f553d1d4331 100755 --- a/components/script/dom/htmlformelement.rs +++ b/components/script/dom/htmlformelement.rs @@ -15,7 +15,7 @@ use dom::bindings::codegen::Bindings::HTMLTextAreaElementBinding::HTMLTextAreaEl use dom::bindings::inheritance::{Castable, ElementTypeId, HTMLElementTypeId, NodeTypeId}; use dom::bindings::refcounted::Trusted; use dom::bindings::reflector::DomObject; -use dom::bindings::root::{JS, OnceCellJS, Root, RootedReference}; +use dom::bindings::root::{Dom, OnceCellJS, Root, RootedReference}; use dom::bindings::str::DOMString; use dom::blob::Blob; use dom::document::Document; @@ -66,7 +66,7 @@ pub struct HTMLFormElement { marked_for_reset: Cell, elements: OnceCellJS, generation_id: Cell, - controls: DOMRefCell>>, + controls: DOMRefCell>>, } impl HTMLFormElement { diff --git a/components/script/dom/htmlinputelement.rs b/components/script/dom/htmlinputelement.rs index 27b401c81e22..2cb872e4908f 100755 --- a/components/script/dom/htmlinputelement.rs +++ b/components/script/dom/htmlinputelement.rs @@ -15,7 +15,7 @@ use dom::bindings::codegen::Bindings::MouseEventBinding::MouseEventMethods; use dom::bindings::codegen::Bindings::WindowBinding::WindowMethods; use dom::bindings::error::{Error, ErrorResult}; use dom::bindings::inheritance::Castable; -use dom::bindings::root::{JS, LayoutJS, MutNullableJS, Root, RootedReference}; +use dom::bindings::root::{Dom, LayoutJS, MutNullableJS, Root, RootedReference}; use dom::bindings::str::DOMString; use dom::document::Document; use dom::element::{AttributeMutation, Element, LayoutElementHelpers, RawLayoutElementHelpers}; @@ -110,7 +110,7 @@ struct InputActivationState { indeterminate: bool, checked: bool, checked_changed: bool, - checked_radio: Option>, + checked_radio: Option>, // In case mutability changed was_mutable: bool, // In case the type changed @@ -1251,7 +1251,7 @@ impl Activatable for HTMLInputElement { in_same_group(&*r, owner.r(), group.as_ref()) && r.Checked() }); - cache.checked_radio = checked_member.r().map(JS::from_ref); + cache.checked_radio = checked_member.r().map(Dom::from_ref); cache.checked_changed = self.checked_changed.get(); self.SetChecked(true); } diff --git a/components/script/dom/htmlscriptelement.rs b/components/script/dom/htmlscriptelement.rs index eea87ffe7950..c6c21329dbfe 100644 --- a/components/script/dom/htmlscriptelement.rs +++ b/components/script/dom/htmlscriptelement.rs @@ -11,7 +11,7 @@ use dom::bindings::codegen::Bindings::NodeBinding::NodeMethods; use dom::bindings::inheritance::Castable; use dom::bindings::refcounted::Trusted; use dom::bindings::reflector::DomObject; -use dom::bindings::root::{JS, Root, RootedReference}; +use dom::bindings::root::{Dom, Root, RootedReference}; use dom::bindings::str::DOMString; use dom::document::Document; use dom::element::{AttributeMutation, Element, ElementCreator}; @@ -61,7 +61,7 @@ pub struct HTMLScriptElement { non_blocking: Cell, /// Document of the parser that created this element - parser_document: JS, + parser_document: Dom, /// Track line line_number line_number: u64, @@ -76,7 +76,7 @@ impl HTMLScriptElement { already_started: Cell::new(false), parser_inserted: Cell::new(creator.is_parser_created()), non_blocking: Cell::new(!creator.is_parser_created()), - parser_document: JS::from_ref(document), + parser_document: Dom::from_ref(document), line_number: creator.return_line_number(), } } diff --git a/components/script/dom/htmltableelement.rs b/components/script/dom/htmltableelement.rs index e7982476982b..5e9a80f07904 100644 --- a/components/script/dom/htmltableelement.rs +++ b/components/script/dom/htmltableelement.rs @@ -10,7 +10,7 @@ use dom::bindings::codegen::Bindings::HTMLTableElementBinding::HTMLTableElementM use dom::bindings::codegen::Bindings::NodeBinding::NodeMethods; use dom::bindings::error::{Error, ErrorResult, Fallible}; use dom::bindings::inheritance::Castable; -use dom::bindings::root::{JS, LayoutJS, MutNullableJS, Root, RootedReference}; +use dom::bindings::root::{Dom, LayoutJS, MutNullableJS, Root, RootedReference}; use dom::bindings::str::DOMString; use dom::document::Document; use dom::element::{AttributeMutation, Element, RawLayoutElementHelpers}; @@ -38,7 +38,7 @@ pub struct HTMLTableElement { #[allow(unrooted_must_root)] #[derive(HeapSizeOf, JSTraceable)] struct TableRowFilter { - sections: Vec>, + sections: Vec>, } impl CollectionFilter for TableRowFilter { @@ -141,7 +141,7 @@ impl HTMLTableElement { sections: self.upcast::() .children() .filter_map(|ref node| - node.downcast::().map(|_| JS::from_ref(&**node))) + node.downcast::().map(|_| Dom::from_ref(&**node))) .collect() } } diff --git a/components/script/dom/location.rs b/components/script/dom/location.rs index dd8f6405610c..839e709d71cb 100644 --- a/components/script/dom/location.rs +++ b/components/script/dom/location.rs @@ -7,7 +7,7 @@ use dom::bindings::codegen::Bindings::LocationBinding::LocationMethods; use dom::bindings::codegen::Bindings::WindowBinding::WindowBinding::WindowMethods; use dom::bindings::error::{Error, ErrorResult, Fallible}; use dom::bindings::reflector::{Reflector, reflect_dom_object}; -use dom::bindings::root::{JS, Root}; +use dom::bindings::root::{Dom, Root}; use dom::bindings::str::{DOMString, USVString}; use dom::globalscope::GlobalScope; use dom::urlhelper::UrlHelper; @@ -18,14 +18,14 @@ use servo_url::{MutableOrigin, ServoUrl}; #[dom_struct] pub struct Location { reflector_: Reflector, - window: JS, + window: Dom, } impl Location { fn new_inherited(window: &Window) -> Location { Location { reflector_: Reflector::new(), - window: JS::from_ref(window) + window: Dom::from_ref(window) } } diff --git a/components/script/dom/medialist.rs b/components/script/dom/medialist.rs index 41599f08a3d0..e707dd428cf5 100644 --- a/components/script/dom/medialist.rs +++ b/components/script/dom/medialist.rs @@ -7,7 +7,7 @@ use dom::bindings::codegen::Bindings::MediaListBinding; use dom::bindings::codegen::Bindings::MediaListBinding::MediaListMethods; use dom::bindings::codegen::Bindings::WindowBinding::WindowBinding::WindowMethods; use dom::bindings::reflector::{DomObject, Reflector, reflect_dom_object}; -use dom::bindings::root::{JS, Root}; +use dom::bindings::root::{Dom, Root}; use dom::bindings::str::DOMString; use dom::cssstylesheet::CSSStyleSheet; use dom::window::Window; @@ -23,7 +23,7 @@ use style_traits::{PARSING_MODE_DEFAULT, ToCss}; #[dom_struct] pub struct MediaList { reflector_: Reflector, - parent_stylesheet: JS, + parent_stylesheet: Dom, #[ignore_heap_size_of = "Arc"] media_queries: Arc>, } @@ -33,7 +33,7 @@ impl MediaList { pub fn new_inherited(parent_stylesheet: &CSSStyleSheet, media_queries: Arc>) -> MediaList { MediaList { - parent_stylesheet: JS::from_ref(parent_stylesheet), + parent_stylesheet: Dom::from_ref(parent_stylesheet), reflector_: Reflector::new(), media_queries: media_queries, } diff --git a/components/script/dom/mediaquerylist.rs b/components/script/dom/mediaquerylist.rs index 044f83af3124..b60632e7ebf1 100644 --- a/components/script/dom/mediaquerylist.rs +++ b/components/script/dom/mediaquerylist.rs @@ -9,7 +9,7 @@ use dom::bindings::codegen::Bindings::MediaQueryListBinding::{self, MediaQueryLi use dom::bindings::inheritance::Castable; use dom::bindings::reflector::DomObject; use dom::bindings::reflector::reflect_dom_object; -use dom::bindings::root::{JS, Root}; +use dom::bindings::root::{Dom, Root}; use dom::bindings::str::DOMString; use dom::bindings::trace::JSTraceable; use dom::bindings::weakref::{WeakRef, WeakRefVec}; @@ -32,7 +32,7 @@ pub enum MediaQueryListMatchState { #[dom_struct] pub struct MediaQueryList { eventtarget: EventTarget, - document: JS, + document: Dom, media_query_list: MediaList, last_match_state: Cell> } @@ -41,7 +41,7 @@ impl MediaQueryList { fn new_inherited(document: &Document, media_query_list: MediaList) -> MediaQueryList { MediaQueryList { eventtarget: EventTarget::new_inherited(), - document: JS::from_ref(document), + document: Dom::from_ref(document), media_query_list: media_query_list, last_match_state: Cell::new(None), } @@ -134,7 +134,7 @@ impl WeakMediaQueryListVec { let mql = mql.root().unwrap(); if let MediaQueryListMatchState::Changed(_) = mql.evaluate_changes() { // Recording list of changed Media Queries - mql_list.push(JS::from_ref(&*mql)); + mql_list.push(Dom::from_ref(&*mql)); } }); // Sending change events for all changed Media Queries diff --git a/components/script/dom/mod.rs b/components/script/dom/mod.rs index 5b049c0cb29e..8020d832ab9b 100644 --- a/components/script/dom/mod.rs +++ b/components/script/dom/mod.rs @@ -31,7 +31,7 @@ //! //! * rooting pointers on the stack: //! the [`Root`](bindings/root/struct.Root.html) smart pointer; -//! * tracing pointers in member fields: the [`JS`](bindings/root/struct.JS.html), +//! * tracing pointers in member fields: the [`Dom`](bindings/root/struct.Dom.html), //! [`MutNullableJS`](bindings/root/struct.MutNullableJS.html) and //! [`MutJS`](bindings/root/struct.MutJS.html) smart pointers and //! [the tracing implementation](bindings/trace/index.html); @@ -44,7 +44,7 @@ //! Rust does not support struct inheritance, as would be used for the //! object-oriented DOM APIs. To work around this issue, Servo stores an //! instance of the superclass in the first field of its subclasses. (Note that -//! it is stored by value, rather than in a smart pointer such as `JS`.) +//! it is stored by value, rather than in a smart pointer such as `Dom`.) //! //! This implies that a pointer to an object can safely be cast to a pointer //! to all its classes. diff --git a/components/script/dom/mutationrecord.rs b/components/script/dom/mutationrecord.rs index fd2037790492..a5d21663b997 100644 --- a/components/script/dom/mutationrecord.rs +++ b/components/script/dom/mutationrecord.rs @@ -5,7 +5,7 @@ use dom::bindings::codegen::Bindings::MutationRecordBinding::MutationRecordBinding; use dom::bindings::codegen::Bindings::MutationRecordBinding::MutationRecordBinding::MutationRecordMethods; use dom::bindings::reflector::{Reflector, reflect_dom_object}; -use dom::bindings::root::{JS, MutNullableJS, Root}; +use dom::bindings::root::{Dom, MutNullableJS, Root}; use dom::bindings::str::DOMString; use dom::node::{Node, window_from_node}; use dom::nodelist::NodeList; @@ -16,14 +16,14 @@ use html5ever::{LocalName, Namespace}; pub struct MutationRecord { reflector_: Reflector, record_type: DOMString, - target: JS, + target: Dom, attribute_name: Option, attribute_namespace: Option, old_value: Option, added_nodes: MutNullableJS, removed_nodes: MutNullableJS, - next_sibling: Option>, - prev_sibling: Option>, + next_sibling: Option>, + prev_sibling: Option>, } impl MutationRecord { @@ -73,14 +73,14 @@ impl MutationRecord { MutationRecord { reflector_: Reflector::new(), record_type: DOMString::from(record_type), - target: JS::from_ref(target), + target: Dom::from_ref(target), attribute_name: attribute_name, attribute_namespace: attribute_namespace, old_value: old_value, added_nodes: MutNullableJS::new(added_nodes), removed_nodes: MutNullableJS::new(removed_nodes), - next_sibling: next_sibling.map(JS::from_ref), - prev_sibling: prev_sibling.map(JS::from_ref), + next_sibling: next_sibling.map(Dom::from_ref), + prev_sibling: prev_sibling.map(Dom::from_ref), } } } diff --git a/components/script/dom/namednodemap.rs b/components/script/dom/namednodemap.rs index 297c9df9a98a..9c2c0c163ad5 100644 --- a/components/script/dom/namednodemap.rs +++ b/components/script/dom/namednodemap.rs @@ -8,7 +8,7 @@ use dom::bindings::codegen::Bindings::NamedNodeMapBinding; use dom::bindings::codegen::Bindings::NamedNodeMapBinding::NamedNodeMapMethods; use dom::bindings::error::{Error, Fallible}; use dom::bindings::reflector::{Reflector, reflect_dom_object}; -use dom::bindings::root::{JS, Root}; +use dom::bindings::root::{Dom, Root}; use dom::bindings::str::DOMString; use dom::bindings::xmlname::namespace_from_domstring; use dom::element::Element; @@ -20,14 +20,14 @@ use std::ascii::AsciiExt; #[dom_struct] pub struct NamedNodeMap { reflector_: Reflector, - owner: JS, + owner: Dom, } impl NamedNodeMap { fn new_inherited(elem: &Element) -> NamedNodeMap { NamedNodeMap { reflector_: Reflector::new(), - owner: JS::from_ref(elem), + owner: Dom::from_ref(elem), } } diff --git a/components/script/dom/node.rs b/components/script/dom/node.rs index a6bfcb398da1..f3cf9728b727 100644 --- a/components/script/dom/node.rs +++ b/components/script/dom/node.rs @@ -23,7 +23,7 @@ use dom::bindings::inheritance::{Castable, CharacterDataTypeId, ElementTypeId}; use dom::bindings::inheritance::{EventTargetTypeId, HTMLElementTypeId, NodeTypeId}; use dom::bindings::inheritance::{SVGElementTypeId, SVGGraphicsElementTypeId}; use dom::bindings::reflector::{DomObject, reflect_dom_object}; -use dom::bindings::root::{JS, LayoutJS, MutNullableJS, Root, RootedReference}; +use dom::bindings::root::{Dom, LayoutJS, MutNullableJS, Root, RootedReference}; use dom::bindings::str::{DOMString, USVString}; use dom::bindings::xmlname::namespace_from_domstring; use dom::characterdata::{CharacterData, LayoutCharacterDataHelpers}; @@ -989,7 +989,7 @@ pub unsafe fn from_untrusted_node_address(_runtime: *mut JSRuntime, candidate: U // candidate); let object: *mut JSObject = mem::transmute(candidate); if object.is_null() { - panic!("Attempted to create a `JS` from an invalid pointer!") + panic!("Attempted to create a `Dom` from an invalid pointer!") } let boxed_node = conversions::private_from_object(object) as *const Node; Root::from_ref(&*boxed_node) @@ -1612,7 +1612,7 @@ impl Node { rooted_vec!(let mut new_nodes); let new_nodes = if let NodeTypeId::DocumentFragment = node.type_id() { // Step 3. - new_nodes.extend(node.children().map(|kid| JS::from_ref(&*kid))); + new_nodes.extend(node.children().map(|kid| Dom::from_ref(&*kid))); // Step 4. for kid in new_nodes.r() { Node::remove(*kid, node, SuppressObserver::Suppressed); @@ -1687,7 +1687,7 @@ impl Node { rooted_vec!(let mut added_nodes); let added_nodes = if let Some(node) = node.as_ref() { if let NodeTypeId::DocumentFragment = node.type_id() { - added_nodes.extend(node.children().map(|child| JS::from_ref(&*child))); + added_nodes.extend(node.children().map(|child| Dom::from_ref(&*child))); added_nodes.r() } else { ref_slice(node) @@ -2216,7 +2216,7 @@ impl NodeMethods for Node { // Step 12. rooted_vec!(let mut nodes); let nodes = if node.type_id() == NodeTypeId::DocumentFragment { - nodes.extend(node.children().map(|node| JS::from_ref(&*node))); + nodes.extend(node.children().map(|node| Dom::from_ref(&*node))); nodes.r() } else { ref_slice(&node) @@ -2786,7 +2786,7 @@ pub trait VecPreOrderInsertionHelper { fn insert_pre_order(&mut self, elem: &T, tree_root: &Node); } -impl VecPreOrderInsertionHelper for Vec> +impl VecPreOrderInsertionHelper for Vec> where T: DerivedFrom + DomObject { /// This algorithm relies on the following assumptions: @@ -2800,7 +2800,7 @@ impl VecPreOrderInsertionHelper for Vec> /// the traversal. fn insert_pre_order(&mut self, elem: &T, tree_root: &Node) { if self.is_empty() { - self.push(JS::from_ref(elem)); + self.push(Dom::from_ref(elem)); return; } @@ -2815,6 +2815,6 @@ impl VecPreOrderInsertionHelper for Vec> break; } } - self.insert(head, JS::from_ref(elem)); + self.insert(head, Dom::from_ref(elem)); } } diff --git a/components/script/dom/nodeiterator.rs b/components/script/dom/nodeiterator.rs index 1fce57699103..0ab8c54360b0 100644 --- a/components/script/dom/nodeiterator.rs +++ b/components/script/dom/nodeiterator.rs @@ -10,7 +10,7 @@ use dom::bindings::codegen::Bindings::NodeIteratorBinding; use dom::bindings::codegen::Bindings::NodeIteratorBinding::NodeIteratorMethods; use dom::bindings::error::Fallible; use dom::bindings::reflector::{Reflector, reflect_dom_object}; -use dom::bindings::root::{JS, MutJS, Root}; +use dom::bindings::root::{Dom, MutJS, Root}; use dom::document::Document; use dom::node::Node; use dom_struct::dom_struct; @@ -20,7 +20,7 @@ use std::rc::Rc; #[dom_struct] pub struct NodeIterator { reflector_: Reflector, - root_node: JS, + root_node: Dom, #[ignore_heap_size_of = "Defined in rust-mozjs"] reference_node: MutJS, pointer_before_reference_node: Cell, @@ -35,7 +35,7 @@ impl NodeIterator { filter: Filter) -> NodeIterator { NodeIterator { reflector_: Reflector::new(), - root_node: JS::from_ref(root_node), + root_node: Dom::from_ref(root_node), reference_node: MutJS::new(root_node), pointer_before_reference_node: Cell::new(true), what_to_show: what_to_show, diff --git a/components/script/dom/nodelist.rs b/components/script/dom/nodelist.rs index c0d962adab6c..14d1e533ef56 100644 --- a/components/script/dom/nodelist.rs +++ b/components/script/dom/nodelist.rs @@ -6,7 +6,7 @@ use dom::bindings::codegen::Bindings::NodeBinding::NodeMethods; use dom::bindings::codegen::Bindings::NodeListBinding; use dom::bindings::codegen::Bindings::NodeListBinding::NodeListMethods; use dom::bindings::reflector::{Reflector, reflect_dom_object}; -use dom::bindings::root::{JS, MutNullableJS, Root, RootedReference}; +use dom::bindings::root::{Dom, MutNullableJS, Root, RootedReference}; use dom::node::{ChildrenMutation, Node}; use dom::window::Window; use dom_struct::dom_struct; @@ -15,7 +15,7 @@ use std::cell::Cell; #[derive(HeapSizeOf, JSTraceable)] #[must_root] pub enum NodeListType { - Simple(Vec>), + Simple(Vec>), Children(ChildrenList), } @@ -44,11 +44,11 @@ impl NodeList { pub fn new_simple_list(window: &Window, iter: T) -> Root where T: Iterator> { - NodeList::new(window, NodeListType::Simple(iter.map(|r| JS::from_ref(&*r)).collect())) + NodeList::new(window, NodeListType::Simple(iter.map(|r| Dom::from_ref(&*r)).collect())) } pub fn new_simple_list_slice(window: &Window, slice: &[&Node]) -> Root { - NodeList::new(window, NodeListType::Simple(slice.iter().map(|r| JS::from_ref(*r)).collect())) + NodeList::new(window, NodeListType::Simple(slice.iter().map(|r| Dom::from_ref(*r)).collect())) } pub fn new_child_list(window: &Window, node: &Node) -> Root { @@ -95,7 +95,7 @@ impl NodeList { } } - pub fn as_simple_list(&self) -> &Vec> { + pub fn as_simple_list(&self) -> &Vec> { if let NodeListType::Simple(ref list) = self.list_type { list } else { @@ -112,7 +112,7 @@ impl NodeList { #[derive(HeapSizeOf, JSTraceable)] #[must_root] pub struct ChildrenList { - node: JS, + node: Dom, #[ignore_heap_size_of = "Defined in rust-mozjs"] last_visited: MutNullableJS, last_index: Cell, @@ -122,7 +122,7 @@ impl ChildrenList { pub fn new(node: &Node) -> ChildrenList { let last_visited = node.GetFirstChild(); ChildrenList { - node: JS::from_ref(node), + node: Dom::from_ref(node), last_visited: MutNullableJS::new(last_visited.r()), last_index: Cell::new(0u32), } diff --git a/components/script/dom/paintworkletglobalscope.rs b/components/script/dom/paintworkletglobalscope.rs index 3a749cfaf2b0..daf8a0d35c21 100644 --- a/components/script/dom/paintworkletglobalscope.rs +++ b/components/script/dom/paintworkletglobalscope.rs @@ -13,7 +13,7 @@ use dom::bindings::error::Error; use dom::bindings::error::Fallible; use dom::bindings::inheritance::Castable; use dom::bindings::reflector::DomObject; -use dom::bindings::root::{JS, Root}; +use dom::bindings::root::{Dom, Root}; use dom::bindings::str::DOMString; use dom::cssstylevalue::CSSStyleValue; use dom::paintrenderingcontext2d::PaintRenderingContext2D; @@ -476,7 +476,7 @@ struct PaintDefinition { // TODO: the spec calls for fresh rendering contexts each time a paint image is drawn, // but to avoid having the primary worklet thread create a new renering context, // we recycle them. - context: JS, + context: Dom, } impl PaintDefinition { @@ -493,7 +493,7 @@ impl PaintDefinition { constructor_valid_flag: Cell::new(true), context_alpha_flag: alpha, input_arguments_len: input_arguments_len, - context: JS::from_ref(context), + context: Dom::from_ref(context), }); result.class_constructor.set(class_constructor.get()); result.paint_function.set(paint_function.get()); diff --git a/components/script/dom/performance.rs b/components/script/dom/performance.rs index 0213c2999074..b0fbae9b8449 100644 --- a/components/script/dom/performance.rs +++ b/components/script/dom/performance.rs @@ -10,7 +10,7 @@ use dom::bindings::error::{Error, Fallible}; use dom::bindings::inheritance::Castable; use dom::bindings::num::Finite; use dom::bindings::reflector::{DomObject, Reflector, reflect_dom_object}; -use dom::bindings::root::{JS, Root}; +use dom::bindings::root::{Dom, Root}; use dom::bindings::str::DOMString; use dom::globalscope::GlobalScope; use dom::performanceentry::PerformanceEntry; @@ -110,7 +110,7 @@ struct PerformanceObserver { #[dom_struct] pub struct Performance { reflector_: Reflector, - timing: Option>, + timing: Option>, entries: DOMRefCell, observers: DOMRefCell>, pending_notification_observers_task: Cell, @@ -124,7 +124,7 @@ impl Performance { Performance { reflector_: Reflector::new(), timing: if global.is::() { - Some(JS::from_ref(&*PerformanceTiming::new(global.as_window(), + Some(Dom::from_ref(&*PerformanceTiming::new(global.as_window(), navigation_start, navigation_start_precise))) } else { diff --git a/components/script/dom/performancetiming.rs b/components/script/dom/performancetiming.rs index 0300accc922d..c4dff76e2181 100644 --- a/components/script/dom/performancetiming.rs +++ b/components/script/dom/performancetiming.rs @@ -6,7 +6,7 @@ use dom::bindings::codegen::Bindings::PerformanceTimingBinding; use dom::bindings::codegen::Bindings::PerformanceTimingBinding::PerformanceTimingMethods; use dom::bindings::codegen::Bindings::WindowBinding::WindowMethods; use dom::bindings::reflector::{Reflector, reflect_dom_object}; -use dom::bindings::root::{JS, Root}; +use dom::bindings::root::{Dom, Root}; use dom::document::Document; use dom::window::Window; use dom_struct::dom_struct; @@ -16,7 +16,7 @@ pub struct PerformanceTiming { reflector_: Reflector, navigation_start: u64, navigation_start_precise: f64, - document: JS, + document: Dom, } impl PerformanceTiming { @@ -28,7 +28,7 @@ impl PerformanceTiming { reflector_: Reflector::new(), navigation_start: nav_start, navigation_start_precise: nav_start_precise, - document: JS::from_ref(document), + document: Dom::from_ref(document), } } diff --git a/components/script/dom/radionodelist.rs b/components/script/dom/radionodelist.rs index 64abfe9177e0..cd892108ee30 100644 --- a/components/script/dom/radionodelist.rs +++ b/components/script/dom/radionodelist.rs @@ -8,7 +8,7 @@ use dom::bindings::codegen::Bindings::RadioNodeListBinding; use dom::bindings::codegen::Bindings::RadioNodeListBinding::RadioNodeListMethods; use dom::bindings::inheritance::Castable; use dom::bindings::reflector::reflect_dom_object; -use dom::bindings::root::{JS, Root}; +use dom::bindings::root::{Dom, Root}; use dom::bindings::str::DOMString; use dom::htmlinputelement::HTMLInputElement; use dom::node::Node; @@ -38,7 +38,7 @@ impl RadioNodeList { pub fn new_simple_list(window: &Window, iter: T) -> Root where T: Iterator> { - RadioNodeList::new(window, NodeListType::Simple(iter.map(|r| JS::from_ref(&*r)).collect())) + RadioNodeList::new(window, NodeListType::Simple(iter.map(|r| Dom::from_ref(&*r)).collect())) } // FIXME: This shouldn't need to be implemented here since NodeList (the parent of diff --git a/components/script/dom/range.rs b/components/script/dom/range.rs index 1e0e8f090c64..1344f9c7a5cf 100644 --- a/components/script/dom/range.rs +++ b/components/script/dom/range.rs @@ -14,7 +14,7 @@ use dom::bindings::error::{Error, ErrorResult, Fallible}; use dom::bindings::inheritance::{CharacterDataTypeId, NodeTypeId}; use dom::bindings::inheritance::Castable; use dom::bindings::reflector::{Reflector, reflect_dom_object}; -use dom::bindings::root::{JS, MutJS, Root, RootedReference}; +use dom::bindings::root::{Dom, MutJS, Root, RootedReference}; use dom::bindings::str::DOMString; use dom::bindings::trace::JSTraceable; use dom::bindings::weakref::{WeakRef, WeakRefVec}; @@ -770,7 +770,7 @@ impl RangeMethods for Range { let mut next = iter.next(); while let Some(child) = next { if self.contains(&child) { - contained_children.push(JS::from_ref(&*child)); + contained_children.push(Dom::from_ref(&*child)); next = iter.next_skipping_children(); } else { next = iter.next(); diff --git a/components/script/dom/request.rs b/components/script/dom/request.rs index 70835465093e..1225369cea59 100644 --- a/components/script/dom/request.rs +++ b/components/script/dom/request.rs @@ -796,7 +796,7 @@ impl Into for NetTraitsRequestMode { NetTraitsRequestMode::SameOrigin => RequestMode::Same_origin, NetTraitsRequestMode::NoCors => RequestMode::No_cors, NetTraitsRequestMode::CorsMode => RequestMode::Cors, - NetTraitsRequestMode::WebSocket => unreachable!("Websocket request mode should never be exposed to JS"), + NetTraitsRequestMode::WebSocket => unreachable!("Websocket request mode should never be exposed to Dom"), } } } diff --git a/components/script/dom/serviceworkercontainer.rs b/components/script/dom/serviceworkercontainer.rs index 7c5d30709fb1..a322f618fa80 100644 --- a/components/script/dom/serviceworkercontainer.rs +++ b/components/script/dom/serviceworkercontainer.rs @@ -6,7 +6,7 @@ use dom::bindings::codegen::Bindings::ServiceWorkerContainerBinding::{ServiceWor use dom::bindings::codegen::Bindings::ServiceWorkerContainerBinding::RegistrationOptions; use dom::bindings::error::Error; use dom::bindings::reflector::{DomObject, reflect_dom_object}; -use dom::bindings::root::{JS, MutNullableJS, Root}; +use dom::bindings::root::{Dom, MutNullableJS, Root}; use dom::bindings::str::USVString; use dom::client::Client; use dom::eventtarget::EventTarget; @@ -24,7 +24,7 @@ use std::rc::Rc; pub struct ServiceWorkerContainer { eventtarget: EventTarget, controller: MutNullableJS, - client: JS + client: Dom } impl ServiceWorkerContainer { @@ -32,7 +32,7 @@ impl ServiceWorkerContainer { ServiceWorkerContainer { eventtarget: EventTarget::new_inherited(), controller: Default::default(), - client: JS::from_ref(client), + client: Dom::from_ref(client), } } diff --git a/components/script/dom/serviceworkerregistration.rs b/components/script/dom/serviceworkerregistration.rs index 3ca40ab874c8..7a824509b623 100644 --- a/components/script/dom/serviceworkerregistration.rs +++ b/components/script/dom/serviceworkerregistration.rs @@ -5,7 +5,7 @@ use dom::bindings::codegen::Bindings::ServiceWorkerBinding::ServiceWorkerState; use dom::bindings::codegen::Bindings::ServiceWorkerRegistrationBinding::{ServiceWorkerRegistrationMethods, Wrap}; use dom::bindings::reflector::reflect_dom_object; -use dom::bindings::root::{JS, Root}; +use dom::bindings::root::{Dom, Root}; use dom::bindings::str::USVString; use dom::eventtarget::EventTarget; use dom::globalscope::GlobalScope; @@ -20,9 +20,9 @@ use std::cell::Cell; #[dom_struct] pub struct ServiceWorkerRegistration { eventtarget: EventTarget, - active: Option>, - installing: Option>, - waiting: Option>, + active: Option>, + installing: Option>, + waiting: Option>, scope: ServoUrl, uninstalling: Cell } @@ -31,7 +31,7 @@ impl ServiceWorkerRegistration { fn new_inherited(active_sw: &ServiceWorker, scope: ServoUrl) -> ServiceWorkerRegistration { ServiceWorkerRegistration { eventtarget: EventTarget::new_inherited(), - active: Some(JS::from_ref(active_sw)), + active: Some(Dom::from_ref(active_sw)), installing: None, waiting: None, scope: scope, diff --git a/components/script/dom/servoparser/async_html.rs b/components/script/dom/servoparser/async_html.rs index c33ffe6aa027..19c163616cfd 100644 --- a/components/script/dom/servoparser/async_html.rs +++ b/components/script/dom/servoparser/async_html.rs @@ -7,7 +7,7 @@ use dom::bindings::codegen::Bindings::HTMLTemplateElementBinding::HTMLTemplateElementMethods; use dom::bindings::codegen::Bindings::NodeBinding::NodeMethods; use dom::bindings::inheritance::Castable; -use dom::bindings::root::{JS, Root}; +use dom::bindings::root::{Dom, Root}; use dom::bindings::str::DOMString; use dom::comment::Comment; use dom::document::Document; @@ -168,13 +168,13 @@ fn create_buffer_queue(mut buffers: VecDeque>) -> BufferQueue #[derive(HeapSizeOf, JSTraceable)] #[must_root] pub struct Tokenizer { - document: JS, + document: Dom, #[ignore_heap_size_of = "Defined in std"] receiver: Receiver, #[ignore_heap_size_of = "Defined in std"] html_tokenizer_sender: Sender, #[ignore_heap_size_of = "Defined in std"] - nodes: HashMap>, + nodes: HashMap>, url: ServoUrl, } @@ -190,13 +190,13 @@ impl Tokenizer { let (to_tokenizer_sender, tokenizer_receiver) = channel(); let mut tokenizer = Tokenizer { - document: JS::from_ref(document), + document: Dom::from_ref(document), receiver: tokenizer_receiver, html_tokenizer_sender: to_html_tokenizer_sender, nodes: HashMap::new(), url: url }; - tokenizer.insert_node(0, JS::from_ref(document.upcast())); + tokenizer.insert_node(0, Dom::from_ref(document.upcast())); let mut sink = Sink::new(to_tokenizer_sender.clone()); let mut ctxt_parse_node = None; @@ -204,12 +204,12 @@ impl Tokenizer { let mut fragment_context_is_some = false; if let Some(fc) = fragment_context { let node = sink.new_parse_node(); - tokenizer.insert_node(node.id, JS::from_ref(fc.context_elem)); + tokenizer.insert_node(node.id, Dom::from_ref(fc.context_elem)); ctxt_parse_node = Some(node); form_parse_node = fc.form_elem.map(|form_elem| { let node = sink.new_parse_node(); - tokenizer.insert_node(node.id, JS::from_ref(form_elem)); + tokenizer.insert_node(node.id, Dom::from_ref(form_elem)); node }); fragment_context_is_some = true; @@ -278,18 +278,18 @@ impl Tokenizer { self.html_tokenizer_sender.send(ToHtmlTokenizerMsg::SetPlainTextState).unwrap(); } - fn insert_node(&mut self, id: ParseNodeId, node: JS) { + fn insert_node(&mut self, id: ParseNodeId, node: Dom) { assert!(self.nodes.insert(id, node).is_none()); } - fn get_node<'a>(&'a self, id: &ParseNodeId) -> &'a JS { + fn get_node<'a>(&'a self, id: &ParseNodeId) -> &'a Dom { self.nodes.get(id).expect("Node not found!") } fn append_before_sibling(&mut self, sibling: ParseNodeId, node: NodeOrText) { let node = match node { - NodeOrText::Node(n) => HtmlNodeOrText::AppendNode(JS::from_ref(&**self.get_node(&n.id))), + NodeOrText::Node(n) => HtmlNodeOrText::AppendNode(Dom::from_ref(&**self.get_node(&n.id))), NodeOrText::Text(text) => HtmlNodeOrText::AppendText( Tendril::from(text) ) @@ -302,7 +302,7 @@ impl Tokenizer { fn append(&mut self, parent: ParseNodeId, node: NodeOrText) { let node = match node { - NodeOrText::Node(n) => HtmlNodeOrText::AppendNode(JS::from_ref(&**self.get_node(&n.id))), + NodeOrText::Node(n) => HtmlNodeOrText::AppendNode(Dom::from_ref(&**self.get_node(&n.id))), NodeOrText::Text(text) => HtmlNodeOrText::AppendText( Tendril::from(text) ) @@ -333,7 +333,7 @@ impl Tokenizer { let target = Root::from_ref(&**self.get_node(&target)); let template = target.downcast::().expect( "Tried to extract contents from non-template element while parsing"); - self.insert_node(contents, JS::from_ref(template.Content().upcast())); + self.insert_node(contents, Dom::from_ref(template.Content().upcast())); } ParseOperation::CreateElement { node, name, attrs, current_line } => { let is = attrs.iter() @@ -349,11 +349,11 @@ impl Tokenizer { elem.set_attribute_from_parser(attr.name, DOMString::from(attr.value), None); } - self.insert_node(node, JS::from_ref(elem.upcast())); + self.insert_node(node, Dom::from_ref(elem.upcast())); } ParseOperation::CreateComment { text, node } => { let comment = Comment::new(DOMString::from(text), document); - self.insert_node(node, JS::from_ref(&comment.upcast())); + self.insert_node(node, Dom::from_ref(&comment.upcast())); } ParseOperation::AppendBeforeSibling { sibling, node } => { self.append_before_sibling(sibling, node); @@ -429,7 +429,7 @@ impl Tokenizer { DOMString::from(target), DOMString::from(data), document); - self.insert_node(node, JS::from_ref(pi.upcast())); + self.insert_node(node, Dom::from_ref(pi.upcast())); } ParseOperation::SetQuirksMode { mode } => { document.set_quirks_mode(mode); diff --git a/components/script/dom/servoparser/html.rs b/components/script/dom/servoparser/html.rs index 447e8e28e67d..54635c15bb02 100644 --- a/components/script/dom/servoparser/html.rs +++ b/components/script/dom/servoparser/html.rs @@ -6,7 +6,7 @@ use dom::bindings::codegen::Bindings::HTMLTemplateElementBinding::HTMLTemplateElementMethods; use dom::bindings::inheritance::{Castable, CharacterDataTypeId, NodeTypeId}; -use dom::bindings::root::{JS, Root}; +use dom::bindings::root::{Dom, Root}; use dom::bindings::trace::JSTraceable; use dom::characterdata::CharacterData; use dom::document::Document; @@ -32,7 +32,7 @@ use std::io; #[must_root] pub struct Tokenizer { #[ignore_heap_size_of = "Defined in html5ever"] - inner: HtmlTokenizer, Sink>>, + inner: HtmlTokenizer, Sink>>, } impl Tokenizer { @@ -43,7 +43,7 @@ impl Tokenizer { -> Self { let sink = Sink { base_url: url, - document: JS::from_ref(document), + document: Dom::from_ref(document), current_line: 1, script: Default::default(), }; @@ -56,8 +56,8 @@ impl Tokenizer { let inner = if let Some(fc) = fragment_context { let tb = TreeBuilder::new_for_fragment( sink, - JS::from_ref(fc.context_elem), - fc.form_elem.map(|n| JS::from_ref(n)), + Dom::from_ref(fc.context_elem), + fc.form_elem.map(|n| Dom::from_ref(n)), options); let tok_options = TokenizerOpts { @@ -96,15 +96,15 @@ impl Tokenizer { } #[allow(unsafe_code)] -unsafe impl JSTraceable for HtmlTokenizer, Sink>> { +unsafe impl JSTraceable for HtmlTokenizer, Sink>> { unsafe fn trace(&self, trc: *mut JSTracer) { struct Tracer(*mut JSTracer); let tracer = Tracer(trc); impl HtmlTracer for Tracer { - type Handle = JS; + type Handle = Dom; #[allow(unrooted_must_root)] - fn trace_handle(&self, node: &JS) { + fn trace_handle(&self, node: &Dom) { unsafe { node.trace(self.0); } } } diff --git a/components/script/dom/servoparser/mod.rs b/components/script/dom/servoparser/mod.rs index 61400a30f70d..92d3b8a894ed 100644 --- a/components/script/dom/servoparser/mod.rs +++ b/components/script/dom/servoparser/mod.rs @@ -12,7 +12,7 @@ use dom::bindings::codegen::Bindings::ServoParserBinding; use dom::bindings::inheritance::Castable; use dom::bindings::refcounted::Trusted; use dom::bindings::reflector::{Reflector, reflect_dom_object}; -use dom::bindings::root::{JS, MutNullableJS, Root, RootedReference}; +use dom::bindings::root::{Dom, MutNullableJS, Root, RootedReference}; use dom::bindings::str::DOMString; use dom::characterdata::CharacterData; use dom::comment::Comment; @@ -72,7 +72,7 @@ mod xml; pub struct ServoParser { reflector: Reflector, /// The document associated with this parser. - document: JS, + document: Dom, /// Input received from network. #[ignore_heap_size_of = "Defined in html5ever"] network_input: DOMRefCell, @@ -319,7 +319,7 @@ impl ServoParser { -> Self { ServoParser { reflector: Reflector::new(), - document: JS::from_ref(document), + document: Dom::from_ref(document), incomplete_utf8: DOMRefCell::new(None), network_input: DOMRefCell::new(BufferQueue::new()), script_input: DOMRefCell::new(BufferQueue::new()), @@ -721,7 +721,7 @@ pub struct FragmentContext<'a> { } #[allow(unrooted_must_root)] -fn insert(parent: &Node, reference_child: Option<&Node>, child: NodeOrText>) { +fn insert(parent: &Node, reference_child: Option<&Node>, child: NodeOrText>) { match child { NodeOrText::AppendNode(n) => { parent.InsertBefore(&n, reference_child).unwrap(); @@ -746,7 +746,7 @@ fn insert(parent: &Node, reference_child: Option<&Node>, child: NodeOrText, + document: Dom, current_line: u64, script: MutNullableJS, } @@ -756,23 +756,23 @@ impl TreeSink for Sink { type Output = Self; fn finish(self) -> Self { self } - type Handle = JS; + type Handle = Dom; - fn get_document(&mut self) -> JS { - JS::from_ref(self.document.upcast()) + fn get_document(&mut self) -> Dom { + Dom::from_ref(self.document.upcast()) } - fn get_template_contents(&mut self, target: &JS) -> JS { + fn get_template_contents(&mut self, target: &Dom) -> Dom { let template = target.downcast::() .expect("tried to get template contents of non-HTMLTemplateElement in HTML parsing"); - JS::from_ref(template.Content().upcast()) + Dom::from_ref(template.Content().upcast()) } - fn same_node(&self, x: &JS, y: &JS) -> bool { + fn same_node(&self, x: &Dom, y: &Dom) -> bool { x == y } - fn elem_name<'a>(&self, target: &'a JS) -> ExpandedName<'a> { + fn elem_name<'a>(&self, target: &'a Dom) -> ExpandedName<'a> { let elem = target.downcast::() .expect("tried to get name of non-Element in HTML parsing"); ExpandedName { @@ -781,7 +781,7 @@ impl TreeSink for Sink { } } - fn same_tree(&self, x: &JS, y: &JS) -> bool { + fn same_tree(&self, x: &Dom, y: &Dom) -> bool { let x = x.downcast::().expect("Element node expected"); let y = y.downcast::().expect("Element node expected"); @@ -789,7 +789,7 @@ impl TreeSink for Sink { } fn create_element(&mut self, name: QualName, attrs: Vec, _flags: ElementFlags) - -> JS { + -> Dom { let is = attrs.iter() .find(|attr| attr.name.local.eq_str_ignore_ascii_case("is")) .map(|attr| LocalName::from(&*attr.value)); @@ -804,27 +804,27 @@ impl TreeSink for Sink { elem.set_attribute_from_parser(attr.name, DOMString::from(String::from(attr.value)), None); } - JS::from_ref(elem.upcast()) + Dom::from_ref(elem.upcast()) } - fn create_comment(&mut self, text: StrTendril) -> JS { + fn create_comment(&mut self, text: StrTendril) -> Dom { let comment = Comment::new(DOMString::from(String::from(text)), &*self.document); - JS::from_ref(comment.upcast()) + Dom::from_ref(comment.upcast()) } - fn create_pi(&mut self, target: StrTendril, data: StrTendril) -> JS { + fn create_pi(&mut self, target: StrTendril, data: StrTendril) -> Dom { let doc = &*self.document; let pi = ProcessingInstruction::new( DOMString::from(String::from(target)), DOMString::from(String::from(data)), doc); - JS::from_ref(pi.upcast()) + Dom::from_ref(pi.upcast()) } - fn has_parent_node(&self, node: &JS) -> bool { + fn has_parent_node(&self, node: &Dom) -> bool { node.GetParentNode().is_some() } - fn associate_with_form(&mut self, target: &JS, form: &JS, nodes: (&JS, Option<&JS>)) { + fn associate_with_form(&mut self, target: &Dom, form: &Dom, nodes: (&Dom, Option<&Dom>)) { let (element, prev_element) = nodes; let tree_node = prev_element.map_or(element, |prev| { if self.has_parent_node(element) { element } else { prev } @@ -849,8 +849,8 @@ impl TreeSink for Sink { } fn append_before_sibling(&mut self, - sibling: &JS, - new_node: NodeOrText>) { + sibling: &Dom, + new_node: NodeOrText>) { let parent = sibling.GetParentNode() .expect("append_before_sibling called on node without parent"); @@ -870,15 +870,15 @@ impl TreeSink for Sink { self.document.set_quirks_mode(mode); } - fn append(&mut self, parent: &JS, child: NodeOrText>) { + fn append(&mut self, parent: &Dom, child: NodeOrText>) { insert(&parent, None, child); } fn append_based_on_parent_node( &mut self, - elem: &JS, - prev_elem: &JS, - child: NodeOrText>, + elem: &Dom, + prev_elem: &Dom, + child: NodeOrText>, ) { if self.has_parent_node(elem) { self.append_before_sibling(elem, child); @@ -896,7 +896,7 @@ impl TreeSink for Sink { doc.upcast::().AppendChild(doctype.upcast()).expect("Appending failed"); } - fn add_attrs_if_missing(&mut self, target: &JS, attrs: Vec) { + fn add_attrs_if_missing(&mut self, target: &Dom, attrs: Vec) { let elem = target.downcast::() .expect("tried to set attrs on non-Element in HTML parsing"); for attr in attrs { @@ -904,18 +904,18 @@ impl TreeSink for Sink { } } - fn remove_from_parent(&mut self, target: &JS) { + fn remove_from_parent(&mut self, target: &Dom) { if let Some(ref parent) = target.GetParentNode() { parent.RemoveChild(&*target).unwrap(); } } - fn mark_script_already_started(&mut self, node: &JS) { + fn mark_script_already_started(&mut self, node: &Dom) { let script = node.downcast::(); script.map(|script| script.set_already_started(true)); } - fn complete_script(&mut self, node: &JS) -> NextParserState { + fn complete_script(&mut self, node: &Dom) -> NextParserState { if let Some(script) = node.downcast() { self.script.set(Some(script)); NextParserState::Suspend @@ -924,7 +924,7 @@ impl TreeSink for Sink { } } - fn reparent_children(&mut self, node: &JS, new_parent: &JS) { + fn reparent_children(&mut self, node: &Dom, new_parent: &Dom) { while let Some(ref child) = node.GetFirstChild() { new_parent.AppendChild(&child).unwrap(); } @@ -932,7 +932,7 @@ impl TreeSink for Sink { /// https://html.spec.whatwg.org/multipage/#html-integration-point /// Specifically, the cases. - fn is_mathml_annotation_xml_integration_point(&self, handle: &JS) -> bool { + fn is_mathml_annotation_xml_integration_point(&self, handle: &Dom) -> bool { let elem = handle.downcast::().unwrap(); elem.get_attribute(&ns!(), &local_name!("encoding")).map_or(false, |attr| { attr.value().eq_ignore_ascii_case("text/html") @@ -944,7 +944,7 @@ impl TreeSink for Sink { self.current_line = line_number; } - fn pop(&mut self, node: &JS) { + fn pop(&mut self, node: &Dom) { let node = Root::from_ref(&**node); vtable_for(&node).pop(); } diff --git a/components/script/dom/servoparser/xml.rs b/components/script/dom/servoparser/xml.rs index 58791b4d3230..12c9131daa5b 100644 --- a/components/script/dom/servoparser/xml.rs +++ b/components/script/dom/servoparser/xml.rs @@ -4,7 +4,7 @@ #![allow(unrooted_must_root)] -use dom::bindings::root::{JS, Root}; +use dom::bindings::root::{Dom, Root}; use dom::bindings::trace::JSTraceable; use dom::document::Document; use dom::htmlscriptelement::HTMLScriptElement; @@ -20,14 +20,14 @@ use xml5ever::tree_builder::{Tracer as XmlTracer, XmlTreeBuilder}; #[must_root] pub struct Tokenizer { #[ignore_heap_size_of = "Defined in xml5ever"] - inner: XmlTokenizer, Sink>>, + inner: XmlTokenizer, Sink>>, } impl Tokenizer { pub fn new(document: &Document, url: ServoUrl) -> Self { let sink = Sink { base_url: url, - document: JS::from_ref(document), + document: Dom::from_ref(document), current_line: 1, script: Default::default(), }; @@ -67,15 +67,15 @@ impl Tokenizer { } #[allow(unsafe_code)] -unsafe impl JSTraceable for XmlTokenizer, Sink>> { +unsafe impl JSTraceable for XmlTokenizer, Sink>> { unsafe fn trace(&self, trc: *mut JSTracer) { struct Tracer(*mut JSTracer); let tracer = Tracer(trc); impl XmlTracer for Tracer { - type Handle = JS; + type Handle = Dom; #[allow(unrooted_must_root)] - fn trace_handle(&self, node: &JS) { + fn trace_handle(&self, node: &Dom) { unsafe { node.trace(self.0); } } } diff --git a/components/script/dom/stylepropertymapreadonly.rs b/components/script/dom/stylepropertymapreadonly.rs index cde0f9042e0f..624664df75f3 100644 --- a/components/script/dom/stylepropertymapreadonly.rs +++ b/components/script/dom/stylepropertymapreadonly.rs @@ -6,7 +6,7 @@ use dom::bindings::codegen::Bindings::StylePropertyMapReadOnlyBinding::StyleProp use dom::bindings::codegen::Bindings::StylePropertyMapReadOnlyBinding::Wrap; use dom::bindings::reflector::Reflector; use dom::bindings::reflector::reflect_dom_object; -use dom::bindings::root::{JS, Root}; +use dom::bindings::root::{Dom, Root}; use dom::bindings::str::DOMString; use dom::cssstylevalue::CSSStyleValue; use dom::globalscope::GlobalScope; @@ -20,12 +20,12 @@ use style::custom_properties; #[dom_struct] pub struct StylePropertyMapReadOnly { reflector: Reflector, - entries: HashMap>, + entries: HashMap>, } impl StylePropertyMapReadOnly { fn new_inherited(entries: Entries) -> StylePropertyMapReadOnly where - Entries: IntoIterator)> + Entries: IntoIterator)> { StylePropertyMapReadOnly { reflector: Reflector::new(), @@ -45,7 +45,7 @@ impl StylePropertyMapReadOnly { for (key, value) in iter { let value = CSSStyleValue::new(global, value); keys.push(key); - values.push(JS::from_ref(&*value)); + values.push(Dom::from_ref(&*value)); } let iter = keys.drain(..).zip(values.iter().cloned()); reflect_dom_object(box StylePropertyMapReadOnly::new_inherited(iter), global, Wrap) diff --git a/components/script/dom/stylesheetlist.rs b/components/script/dom/stylesheetlist.rs index 3021b47a0a95..7a479fe4c17f 100644 --- a/components/script/dom/stylesheetlist.rs +++ b/components/script/dom/stylesheetlist.rs @@ -5,7 +5,7 @@ use dom::bindings::codegen::Bindings::StyleSheetListBinding; use dom::bindings::codegen::Bindings::StyleSheetListBinding::StyleSheetListMethods; use dom::bindings::reflector::{Reflector, reflect_dom_object}; -use dom::bindings::root::{JS, Root}; +use dom::bindings::root::{Dom, Root}; use dom::document::Document; use dom::stylesheet::StyleSheet; use dom::window::Window; @@ -14,12 +14,12 @@ use dom_struct::dom_struct; #[dom_struct] pub struct StyleSheetList { reflector_: Reflector, - document: JS, + document: Dom, } impl StyleSheetList { #[allow(unrooted_must_root)] - fn new_inherited(doc: JS) -> StyleSheetList { + fn new_inherited(doc: Dom) -> StyleSheetList { StyleSheetList { reflector_: Reflector::new(), document: doc @@ -27,7 +27,7 @@ impl StyleSheetList { } #[allow(unrooted_must_root)] - pub fn new(window: &Window, document: JS) -> Root { + pub fn new(window: &Window, document: Dom) -> Root { reflect_dom_object(box StyleSheetList::new_inherited(document), window, StyleSheetListBinding::Wrap) } diff --git a/components/script/dom/testworklet.rs b/components/script/dom/testworklet.rs index 3ff7a8a4b9cb..31d1e3853c1b 100644 --- a/components/script/dom/testworklet.rs +++ b/components/script/dom/testworklet.rs @@ -11,7 +11,7 @@ use dom::bindings::codegen::Bindings::WorkletBinding::WorkletOptions; use dom::bindings::error::Fallible; use dom::bindings::reflector::Reflector; use dom::bindings::reflector::reflect_dom_object; -use dom::bindings::root::{JS, Root}; +use dom::bindings::root::{Dom, Root}; use dom::bindings::str::DOMString; use dom::bindings::str::USVString; use dom::promise::Promise; @@ -25,14 +25,14 @@ use std::rc::Rc; #[dom_struct] pub struct TestWorklet { reflector: Reflector, - worklet: JS, + worklet: Dom, } impl TestWorklet { fn new_inherited(worklet: &Worklet) -> TestWorklet { TestWorklet { reflector: Reflector::new(), - worklet: JS::from_ref(worklet), + worklet: Dom::from_ref(worklet), } } diff --git a/components/script/dom/touchlist.rs b/components/script/dom/touchlist.rs index 299cab0c9824..c07b583619e6 100644 --- a/components/script/dom/touchlist.rs +++ b/components/script/dom/touchlist.rs @@ -5,7 +5,7 @@ use dom::bindings::codegen::Bindings::TouchListBinding; use dom::bindings::codegen::Bindings::TouchListBinding::TouchListMethods; use dom::bindings::reflector::{Reflector, reflect_dom_object}; -use dom::bindings::root::{JS, Root}; +use dom::bindings::root::{Dom, Root}; use dom::touch::Touch; use dom::window::Window; use dom_struct::dom_struct; @@ -13,14 +13,14 @@ use dom_struct::dom_struct; #[dom_struct] pub struct TouchList { reflector_: Reflector, - touches: Vec>, + touches: Vec>, } impl TouchList { fn new_inherited(touches: &[&Touch]) -> TouchList { TouchList { reflector_: Reflector::new(), - touches: touches.iter().map(|touch| JS::from_ref(*touch)).collect(), + touches: touches.iter().map(|touch| Dom::from_ref(*touch)).collect(), } } diff --git a/components/script/dom/treewalker.rs b/components/script/dom/treewalker.rs index 54d085792c25..bbb27c61541b 100644 --- a/components/script/dom/treewalker.rs +++ b/components/script/dom/treewalker.rs @@ -10,7 +10,7 @@ use dom::bindings::codegen::Bindings::TreeWalkerBinding; use dom::bindings::codegen::Bindings::TreeWalkerBinding::TreeWalkerMethods; use dom::bindings::error::Fallible; use dom::bindings::reflector::{Reflector, reflect_dom_object}; -use dom::bindings::root::{JS, MutJS, Root}; +use dom::bindings::root::{Dom, MutJS, Root}; use dom::document::Document; use dom::node::Node; use dom_struct::dom_struct; @@ -20,7 +20,7 @@ use std::rc::Rc; #[dom_struct] pub struct TreeWalker { reflector_: Reflector, - root_node: JS, + root_node: Dom, current_node: MutJS, what_to_show: u32, #[ignore_heap_size_of = "function pointers and Rc are hard"] @@ -33,7 +33,7 @@ impl TreeWalker { filter: Filter) -> TreeWalker { TreeWalker { reflector_: Reflector::new(), - root_node: JS::from_ref(root_node), + root_node: Dom::from_ref(root_node), current_node: MutJS::new(root_node), what_to_show: what_to_show, filter: filter @@ -55,7 +55,7 @@ impl TreeWalker { node_filter: Option>) -> Root { let filter = match node_filter { None => Filter::None, - Some(jsfilter) => Filter::JS(jsfilter) + Some(jsfilter) => Filter::Dom(jsfilter) }; TreeWalker::new_with_filter(document, root_node, what_to_show, filter) } @@ -76,7 +76,7 @@ impl TreeWalkerMethods for TreeWalker { fn GetFilter(&self) -> Option> { match self.filter { Filter::None => None, - Filter::JS(ref nf) => Some(nf.clone()), + Filter::Dom(ref nf) => Some(nf.clone()), Filter::Native(_) => panic!("Cannot convert native node filter to DOM NodeFilter") } } @@ -430,12 +430,12 @@ impl TreeWalker { match self.filter { Filter::None => Ok(NodeFilterConstants::FILTER_ACCEPT), Filter::Native(f) => Ok((f)(node)), - Filter::JS(ref callback) => callback.AcceptNode_(self, node, Rethrow) + Filter::Dom(ref callback) => callback.AcceptNode_(self, node, Rethrow) } } fn is_root_node(&self, node: &Node) -> bool { - JS::from_ref(node) == self.root_node + Dom::from_ref(node) == self.root_node } fn is_current_node(&self, node: &Node) -> bool { @@ -464,5 +464,5 @@ impl<'a> Iterator for &'a TreeWalker { pub enum Filter { None, Native(fn (node: &Node) -> u16), - JS(Rc) + Dom(Rc) } diff --git a/components/script/dom/validitystate.rs b/components/script/dom/validitystate.rs index dd10dc0e99c2..80dead5c66f5 100755 --- a/components/script/dom/validitystate.rs +++ b/components/script/dom/validitystate.rs @@ -5,7 +5,7 @@ use dom::bindings::codegen::Bindings::ValidityStateBinding; use dom::bindings::codegen::Bindings::ValidityStateBinding::ValidityStateMethods; use dom::bindings::reflector::{Reflector, reflect_dom_object}; -use dom::bindings::root::{JS, Root}; +use dom::bindings::root::{Dom, Root}; use dom::element::Element; use dom::window::Window; use dom_struct::dom_struct; @@ -46,7 +46,7 @@ bitflags!{ #[dom_struct] pub struct ValidityState { reflector_: Reflector, - element: JS, + element: Dom, state: ValidityStatus } @@ -55,7 +55,7 @@ impl ValidityState { fn new_inherited(element: &Element) -> ValidityState { ValidityState { reflector_: Reflector::new(), - element: JS::from_ref(element), + element: Dom::from_ref(element), state: ValidityStatus::Valid } } diff --git a/components/script/dom/vr.rs b/components/script/dom/vr.rs index cf5ed1fe084b..83e75931e6aa 100644 --- a/components/script/dom/vr.rs +++ b/components/script/dom/vr.rs @@ -9,7 +9,7 @@ use dom::bindings::codegen::Bindings::VRDisplayBinding::VRDisplayMethods; use dom::bindings::error::Error; use dom::bindings::inheritance::Castable; use dom::bindings::reflector::{DomObject, Reflector, reflect_dom_object}; -use dom::bindings::root::{JS, Root}; +use dom::bindings::root::{Dom, Root}; use dom::event::Event; use dom::eventtarget::EventTarget; use dom::gamepad::Gamepad; @@ -28,8 +28,8 @@ use webvr_traits::{WebVRGamepadData, WebVRGamepadEvent, WebVRGamepadState}; #[dom_struct] pub struct VR { reflector_: Reflector, - displays: DOMRefCell>>, - gamepads: DOMRefCell>> + displays: DOMRefCell>>, + gamepads: DOMRefCell>> } impl VR { @@ -83,7 +83,7 @@ impl VRMethods for VR { return promise; } - // convert from JS to Root + // convert from Dom to Root let displays: Vec> = self.displays.borrow().iter() .map(|d| Root::from_ref(&**d)) .collect(); @@ -126,7 +126,7 @@ impl VR { existing } else { let root = VRDisplay::new(&self.global(), display.clone()); - self.displays.borrow_mut().push(JS::from_ref(&*root)); + self.displays.borrow_mut().push(Dom::from_ref(&*root)); root } } @@ -223,7 +223,7 @@ impl VR { index as i32, &data, &state); - self.gamepads.borrow_mut().push(JS::from_ref(&*root)); + self.gamepads.borrow_mut().push(Dom::from_ref(&*root)); if state.connected { root.notify_event(GamepadEventType::Connected); } diff --git a/components/script/dom/vrdisplayevent.rs b/components/script/dom/vrdisplayevent.rs index d7fb88d8bdc4..b7c2a940f6d0 100644 --- a/components/script/dom/vrdisplayevent.rs +++ b/components/script/dom/vrdisplayevent.rs @@ -9,7 +9,7 @@ use dom::bindings::codegen::Bindings::VRDisplayEventBinding::VRDisplayEventReaso use dom::bindings::error::Fallible; use dom::bindings::inheritance::Castable; use dom::bindings::reflector::{DomObject, reflect_dom_object}; -use dom::bindings::root::{JS, Root}; +use dom::bindings::root::{Dom, Root}; use dom::bindings::str::DOMString; use dom::event::Event; use dom::globalscope::GlobalScope; @@ -22,7 +22,7 @@ use webvr_traits::{WebVRDisplayEvent, WebVRDisplayEventReason}; #[dom_struct] pub struct VRDisplayEvent { event: Event, - display: JS, + display: Dom, reason: Option } @@ -32,7 +32,7 @@ impl VRDisplayEvent { -> VRDisplayEvent { VRDisplayEvent { event: Event::new_inherited(), - display: JS::from_ref(display), + display: Dom::from_ref(display), reason: reason.clone() } } diff --git a/components/script/dom/vreyeparameters.rs b/components/script/dom/vreyeparameters.rs index 33e737c6265c..8df18c91e043 100644 --- a/components/script/dom/vreyeparameters.rs +++ b/components/script/dom/vreyeparameters.rs @@ -7,7 +7,7 @@ use dom::bindings::cell::DOMRefCell; use dom::bindings::codegen::Bindings::VREyeParametersBinding; use dom::bindings::codegen::Bindings::VREyeParametersBinding::VREyeParametersMethods; use dom::bindings::reflector::{Reflector, reflect_dom_object}; -use dom::bindings::root::{JS, Root}; +use dom::bindings::root::{Dom, Root}; use dom::globalscope::GlobalScope; use dom::vrfieldofview::VRFieldOfView; use dom_struct::dom_struct; @@ -23,7 +23,7 @@ pub struct VREyeParameters { #[ignore_heap_size_of = "Defined in rust-webvr"] parameters: DOMRefCell, offset: Heap<*mut JSObject>, - fov: JS, + fov: Dom, } unsafe_no_jsmanaged_fields!(WebVREyeParameters); @@ -34,7 +34,7 @@ impl VREyeParameters { reflector_: Reflector::new(), parameters: DOMRefCell::new(parameters), offset: Heap::default(), - fov: JS::from_ref(&*fov) + fov: Dom::from_ref(&*fov) } } diff --git a/components/script/dom/vrframedata.rs b/components/script/dom/vrframedata.rs index 2a98da00f916..c7ccf84f10e6 100644 --- a/components/script/dom/vrframedata.rs +++ b/components/script/dom/vrframedata.rs @@ -8,7 +8,7 @@ use dom::bindings::codegen::Bindings::VRFrameDataBinding::VRFrameDataMethods; use dom::bindings::error::Fallible; use dom::bindings::num::Finite; use dom::bindings::reflector::{DomObject, Reflector, reflect_dom_object}; -use dom::bindings::root::{JS, Root}; +use dom::bindings::root::{Dom, Root}; use dom::globalscope::GlobalScope; use dom::vrpose::VRPose; use dom::window::Window; @@ -26,7 +26,7 @@ pub struct VRFrameData { left_view: Heap<*mut JSObject>, right_proj: Heap<*mut JSObject>, right_view: Heap<*mut JSObject>, - pose: JS, + pose: Dom, timestamp: Cell, first_timestamp: Cell } @@ -39,7 +39,7 @@ impl VRFrameData { left_view: Heap::default(), right_proj: Heap::default(), right_view: Heap::default(), - pose: JS::from_ref(&*pose), + pose: Dom::from_ref(&*pose), timestamp: Cell::new(0.0), first_timestamp: Cell::new(0.0) } diff --git a/components/script/dom/webgl_extensions/ext/oesvertexarrayobject.rs b/components/script/dom/webgl_extensions/ext/oesvertexarrayobject.rs index b3b5a958997f..f7414bcbb1b5 100644 --- a/components/script/dom/webgl_extensions/ext/oesvertexarrayobject.rs +++ b/components/script/dom/webgl_extensions/ext/oesvertexarrayobject.rs @@ -6,7 +6,7 @@ use canvas_traits::webgl::{webgl_channel, WebGLCommand, WebGLError}; use dom::bindings::codegen::Bindings::OESVertexArrayObjectBinding::{self, OESVertexArrayObjectMethods}; use dom::bindings::codegen::Bindings::OESVertexArrayObjectBinding::OESVertexArrayObjectConstants; use dom::bindings::reflector::{DomObject, Reflector, reflect_dom_object}; -use dom::bindings::root::{JS, MutNullableJS, Root}; +use dom::bindings::root::{Dom, MutNullableJS, Root}; use dom::webglrenderingcontext::WebGLRenderingContext; use dom::webglvertexarrayobjectoes::WebGLVertexArrayObjectOES; use dom_struct::dom_struct; @@ -19,7 +19,7 @@ use super::{WebGLExtension, WebGLExtensions}; #[dom_struct] pub struct OESVertexArrayObject { reflector_: Reflector, - ctx: JS, + ctx: Dom, bound_vao: MutNullableJS, } @@ -27,7 +27,7 @@ impl OESVertexArrayObject { fn new_inherited(ctx: &WebGLRenderingContext) -> OESVertexArrayObject { Self { reflector_: Reflector::new(), - ctx: JS::from_ref(ctx), + ctx: Dom::from_ref(ctx), bound_vao: MutNullableJS::new(None) } } diff --git a/components/script/dom/webgl_extensions/ext/webglvertexarrayobjectoes.rs b/components/script/dom/webgl_extensions/ext/webglvertexarrayobjectoes.rs index eeca0a247072..ccd103e07a2f 100644 --- a/components/script/dom/webgl_extensions/ext/webglvertexarrayobjectoes.rs +++ b/components/script/dom/webgl_extensions/ext/webglvertexarrayobjectoes.rs @@ -8,7 +8,7 @@ use core::iter::FromIterator; use dom::bindings::cell::DOMRefCell; use dom::bindings::codegen::Bindings::WebGLVertexArrayObjectOESBinding; use dom::bindings::reflector::reflect_dom_object; -use dom::bindings::root::{JS, MutNullableJS, Root}; +use dom::bindings::root::{Dom, MutNullableJS, Root}; use dom::globalscope::GlobalScope; use dom::webglbuffer::WebGLBuffer; use dom::webglobject::WebGLObject; @@ -22,7 +22,7 @@ pub struct WebGLVertexArrayObjectOES { id: WebGLVertexArrayId, ever_bound: Cell, is_deleted: Cell, - bound_attrib_buffers: DOMRefCell>>, + bound_attrib_buffers: DOMRefCell>>, bound_buffer_element_array: MutNullableJS, } @@ -64,7 +64,7 @@ impl WebGLVertexArrayObjectOES { self.ever_bound.set(true); } - pub fn borrow_bound_attrib_buffers(&self) -> Ref>> { + pub fn borrow_bound_attrib_buffers(&self) -> Ref>> { self.bound_attrib_buffers.borrow() } @@ -73,7 +73,7 @@ impl WebGLVertexArrayObjectOES { } pub fn set_bound_attrib_buffers<'a, T>(&self, iter: T) where T: Iterator { - *self.bound_attrib_buffers.borrow_mut() = HashMap::from_iter(iter.map(|(k,v)| (k, JS::from_ref(v)))); + *self.bound_attrib_buffers.borrow_mut() = HashMap::from_iter(iter.map(|(k,v)| (k, Dom::from_ref(v)))); } pub fn bound_buffer_element_array(&self) -> Option> { diff --git a/components/script/dom/webglframebuffer.rs b/components/script/dom/webglframebuffer.rs index 750bc5edfdc8..0a8df198cdb8 100644 --- a/components/script/dom/webglframebuffer.rs +++ b/components/script/dom/webglframebuffer.rs @@ -10,7 +10,7 @@ use dom::bindings::cell::DOMRefCell; use dom::bindings::codegen::Bindings::WebGLFramebufferBinding; use dom::bindings::codegen::Bindings::WebGLRenderingContextBinding::WebGLRenderingContextConstants as constants; use dom::bindings::reflector::reflect_dom_object; -use dom::bindings::root::{JS, Root}; +use dom::bindings::root::{Dom, Root}; use dom::webglobject::WebGLObject; use dom::webglrenderbuffer::WebGLRenderbuffer; use dom::webgltexture::WebGLTexture; @@ -21,8 +21,8 @@ use std::cell::Cell; #[must_root] #[derive(Clone, HeapSizeOf, JSTraceable)] enum WebGLFramebufferAttachment { - Renderbuffer(JS), - Texture { texture: JS, level: i32 }, + Renderbuffer(Dom), + Texture { texture: Dom, level: i32 }, } #[dom_struct] @@ -194,7 +194,7 @@ impl WebGLFramebuffer { let rb_id = match rb { Some(rb) => { - *binding.borrow_mut() = Some(WebGLFramebufferAttachment::Renderbuffer(JS::from_ref(rb))); + *binding.borrow_mut() = Some(WebGLFramebufferAttachment::Renderbuffer(Dom::from_ref(rb))); Some(rb.id()) } @@ -267,7 +267,7 @@ impl WebGLFramebuffer { } *binding.borrow_mut() = Some(WebGLFramebufferAttachment::Texture { - texture: JS::from_ref(texture), + texture: Dom::from_ref(texture), level: level } ); diff --git a/components/script/dom/webglrenderingcontext.rs b/components/script/dom/webglrenderingcontext.rs index a2ef298589f6..64148a0a4351 100644 --- a/components/script/dom/webglrenderingcontext.rs +++ b/components/script/dom/webglrenderingcontext.rs @@ -20,7 +20,7 @@ use dom::bindings::conversions::{ConversionResult, FromJSValConvertible, ToJSVal use dom::bindings::error::{Error, Fallible}; use dom::bindings::inheritance::Castable; use dom::bindings::reflector::{DomObject, Reflector, reflect_dom_object}; -use dom::bindings::root::{JS, LayoutJS, MutNullableJS, Root}; +use dom::bindings::root::{Dom, LayoutJS, MutNullableJS, Root}; use dom::bindings::str::DOMString; use dom::event::{Event, EventBubbles, EventCancelable}; use dom::htmlcanvaselement::HTMLCanvasElement; @@ -140,7 +140,7 @@ pub struct WebGLRenderingContext { share_mode: WebGLContextShareMode, #[ignore_heap_size_of = "Defined in offscreen_gl_context"] limits: GLLimits, - canvas: JS, + canvas: Dom, #[ignore_heap_size_of = "Defined in canvas_traits"] last_error: Cell>, texture_unpacking_settings: Cell, @@ -151,7 +151,7 @@ pub struct WebGLRenderingContext { bound_texture_cube_map: MutNullableJS, bound_buffer_array: MutNullableJS, bound_buffer_element_array: MutNullableJS, - bound_attrib_buffers: DOMRefCell>>, + bound_attrib_buffers: DOMRefCell>>, current_program: MutNullableJS, #[ignore_heap_size_of = "Because it's small"] current_vertex_attrib_0: Cell<(f32, f32, f32, f32)>, @@ -185,7 +185,7 @@ impl WebGLRenderingContext { webrender_image: Cell::new(None), share_mode: ctx_data.share_mode, limits: ctx_data.limits, - canvas: JS::from_ref(canvas), + canvas: Dom::from_ref(canvas), last_error: Cell::new(None), texture_unpacking_settings: Cell::new(CONVERT_COLORSPACE), texture_unpacking_alignment: Cell::new(4), @@ -239,12 +239,12 @@ impl WebGLRenderingContext { } } - pub fn borrow_bound_attrib_buffers(&self) -> Ref>> { + pub fn borrow_bound_attrib_buffers(&self) -> Ref>> { self.bound_attrib_buffers.borrow() } pub fn set_bound_attrib_buffers<'a, T>(&self, iter: T) where T: Iterator { - *self.bound_attrib_buffers.borrow_mut() = FnvHashMap::from_iter(iter.map(|(k,v)| (k, JS::from_ref(v)))); + *self.bound_attrib_buffers.borrow_mut() = FnvHashMap::from_iter(iter.map(|(k,v)| (k, Dom::from_ref(v)))); } pub fn bound_buffer_element_array(&self) -> Option> { @@ -3024,7 +3024,7 @@ impl WebGLRenderingContextMethods for WebGLRenderingContext { } - self.bound_attrib_buffers.borrow_mut().insert(attrib_id, JS::from_ref(&*buffer_array)); + self.bound_attrib_buffers.borrow_mut().insert(attrib_id, Dom::from_ref(&*buffer_array)); let msg = WebGLCommand::VertexAttribPointer(attrib_id, size, data_type, normalized, stride, offset as u32); self.send_command(msg); diff --git a/components/script/dom/window.rs b/components/script/dom/window.rs index 590591a070a3..b80beb186d02 100644 --- a/components/script/dom/window.rs +++ b/components/script/dom/window.rs @@ -21,7 +21,7 @@ use dom::bindings::inheritance::Castable; use dom::bindings::num::Finite; use dom::bindings::refcounted::Trusted; use dom::bindings::reflector::DomObject; -use dom::bindings::root::{JS, MutNullableJS, Root}; +use dom::bindings::root::{Dom, MutNullableJS, Root}; use dom::bindings::str::DOMString; use dom::bindings::structuredclone::StructuredCloneData; use dom::bindings::trace::RootedTraceableBox; @@ -280,7 +280,7 @@ pub struct Window { /// initiated by layout during a reflow. They are stored in the script thread /// to ensure that the element can be marked dirty when the image data becomes /// available at some point in the future. - pending_layout_images: DOMRefCell>>>, + pending_layout_images: DOMRefCell>>>, /// Directory to store unminified scripts for this window if unminify-js /// opt is enabled. @@ -840,7 +840,7 @@ impl WindowMethods for Window { // Step 5. CSSStyleDeclaration::new(self, - CSSStyleOwner::Element(JS::from_ref(element)), + CSSStyleOwner::Element(Dom::from_ref(element)), pseudo, CSSModificationAccess::Readonly) } @@ -1305,7 +1305,7 @@ impl Window { let _ = image_cache_chan.send((pipeline, message.to().unwrap())); }); self.image_cache.add_listener(id, ImageResponder::new(responder, id)); - nodes.push(JS::from_ref(&*node)); + nodes.push(Dom::from_ref(&*node)); } } diff --git a/components/script/dom/windowproxy.rs b/components/script/dom/windowproxy.rs index e76435818d93..3c8a340d0f73 100644 --- a/components/script/dom/windowproxy.rs +++ b/components/script/dom/windowproxy.rs @@ -7,7 +7,7 @@ use dom::bindings::error::{Error, throw_dom_exception}; use dom::bindings::inheritance::Castable; use dom::bindings::proxyhandler::{fill_property_descriptor, get_property_descriptor}; use dom::bindings::reflector::{DomObject, Reflector}; -use dom::bindings::root::{JS, Root, RootedReference}; +use dom::bindings::root::{Dom, Root, RootedReference}; use dom::bindings::trace::JSTraceable; use dom::bindings::utils::{WindowProxyHandler, get_array_index_from_id, AsVoidPtr}; use dom::dissimilaroriginwindow::DissimilarOriginWindow; @@ -66,10 +66,10 @@ pub struct WindowProxy { discarded: Cell, /// The containing iframe element, if this is a same-origin iframe - frame_element: Option>, + frame_element: Option>, /// The parent browsing context's window proxy, if this is a nested browsing context - parent: Option>, + parent: Option>, } impl WindowProxy { @@ -86,8 +86,8 @@ impl WindowProxy { top_level_browsing_context_id: top_level_browsing_context_id, currently_active: Cell::new(currently_active), discarded: Cell::new(false), - frame_element: frame_element.map(JS::from_ref), - parent: parent.map(JS::from_ref), + frame_element: frame_element.map(Dom::from_ref), + parent: parent.map(Dom::from_ref), } } diff --git a/components/script/dom/worklet.rs b/components/script/dom/worklet.rs index cc96618ae7a7..b83de5e462d7 100644 --- a/components/script/dom/worklet.rs +++ b/components/script/dom/worklet.rs @@ -20,7 +20,7 @@ use dom::bindings::inheritance::Castable; use dom::bindings::refcounted::TrustedPromise; use dom::bindings::reflector::Reflector; use dom::bindings::reflector::reflect_dom_object; -use dom::bindings::root::{JS, Root, RootCollection}; +use dom::bindings::root::{Dom, Root, RootCollection}; use dom::bindings::str::USVString; use dom::bindings::trace::JSTraceable; use dom::bindings::trace::RootedTraceableBox; @@ -78,7 +78,7 @@ const MIN_GC_THRESHOLD: u32 = 1_000_000; /// https://drafts.css-houdini.org/worklets/#worklet pub struct Worklet { reflector: Reflector, - window: JS, + window: Dom, worklet_id: WorkletId, global_type: WorkletGlobalScopeType, } @@ -87,7 +87,7 @@ impl Worklet { fn new_inherited(window: &Window, global_type: WorkletGlobalScopeType) -> Worklet { Worklet { reflector: Reflector::new(), - window: JS::from_ref(window), + window: Dom::from_ref(window), worklet_id: WorkletId::new(), global_type: global_type, } @@ -396,7 +396,7 @@ struct WorkletThread { global_init: WorkletGlobalScopeInit, /// The global scopes created by this thread - global_scopes: HashMap>, + global_scopes: HashMap>, /// A one-place buffer for control messages control_buffer: Option, @@ -546,7 +546,7 @@ impl WorkletThread { debug!("Creating new worklet global scope."); let executor = WorkletExecutor::new(worklet_id, self.primary_sender.clone()); let result = global_type.new(&self.runtime, pipeline_id, base_url, executor, &self.global_init); - entry.insert(JS::from_ref(&*result)); + entry.insert(Dom::from_ref(&*result)); result }, } diff --git a/components/script/dom/workletglobalscope.rs b/components/script/dom/workletglobalscope.rs index a699a0e326b6..64c8f0793a68 100644 --- a/components/script/dom/workletglobalscope.rs +++ b/components/script/dom/workletglobalscope.rs @@ -86,7 +86,7 @@ impl WorkletGlobalScope { /// Evaluate a JS script in this global. pub fn evaluate_js(&self, script: &str) -> bool { - debug!("Evaluating JS."); + debug!("Evaluating Dom."); rooted!(in (self.globalscope.get_cx()) let mut rval = UndefinedValue()); self.globalscope.evaluate_js_on_global_with_result(&*script, rval.handle_mut()) } diff --git a/components/script/dom/xmlhttprequest.rs b/components/script/dom/xmlhttprequest.rs index 3d74870f275e..a4446d55a561 100644 --- a/components/script/dom/xmlhttprequest.rs +++ b/components/script/dom/xmlhttprequest.rs @@ -16,7 +16,7 @@ use dom::bindings::error::{Error, ErrorResult, Fallible}; use dom::bindings::inheritance::Castable; use dom::bindings::refcounted::Trusted; use dom::bindings::reflector::{DomObject, reflect_dom_object}; -use dom::bindings::root::{JS, MutNullableJS, Root}; +use dom::bindings::root::{Dom, MutNullableJS, Root}; use dom::bindings::str::{ByteString, DOMString, USVString, is_token}; use dom::blob::{Blob, BlobImpl}; use dom::document::{Document, HasBrowsingContext, IsHTMLDocument}; @@ -123,7 +123,7 @@ pub struct XMLHttpRequest { ready_state: Cell, timeout: Cell, with_credentials: Cell, - upload: JS, + upload: Dom, response_url: DOMRefCell, status: Cell, status_text: DOMRefCell, @@ -174,7 +174,7 @@ impl XMLHttpRequest { ready_state: Cell::new(XMLHttpRequestState::Unsent), timeout: Cell::new(0u32), with_credentials: Cell::new(false), - upload: JS::from_ref(&*XMLHttpRequestUpload::new(global)), + upload: Dom::from_ref(&*XMLHttpRequestUpload::new(global)), response_url: DOMRefCell::new(String::new()), status: Cell::new(0), status_text: DOMRefCell::new(ByteString::new(vec!())), diff --git a/components/script/script_thread.rs b/components/script/script_thread.rs index ff4ce058ce0e..92b8aa4b9d54 100644 --- a/components/script/script_thread.rs +++ b/components/script/script_thread.rs @@ -34,7 +34,7 @@ use dom::bindings::conversions::{ConversionResult, FromJSValConvertible, Stringi use dom::bindings::inheritance::Castable; use dom::bindings::num::Finite; use dom::bindings::reflector::DomObject; -use dom::bindings::root::{JS, MutNullableJS, Root, RootCollection}; +use dom::bindings::root::{Dom, MutNullableJS, Root, RootCollection}; use dom::bindings::root::{RootCollectionPtr, RootedReference}; use dom::bindings::str::DOMString; use dom::bindings::structuredclone::StructuredCloneData; @@ -320,7 +320,7 @@ impl OpaqueSender for Sender { #[derive(JSTraceable)] #[must_root] pub struct Documents { - map: HashMap>, + map: HashMap>, } impl Documents { @@ -331,7 +331,7 @@ impl Documents { } pub fn insert(&mut self, pipeline_id: PipelineId, doc: &Document) { - self.map.insert(pipeline_id, JS::from_ref(doc)); + self.map.insert(pipeline_id, Dom::from_ref(doc)); } pub fn remove(&mut self, pipeline_id: PipelineId) -> Option> { @@ -369,7 +369,7 @@ impl Documents { #[allow(unrooted_must_root)] pub struct DocumentsIter<'a> { - iter: hash_map::Iter<'a, PipelineId, JS>, + iter: hash_map::Iter<'a, PipelineId, Dom>, } impl<'a> Iterator for DocumentsIter<'a> { @@ -388,13 +388,13 @@ pub struct ScriptThread { documents: DOMRefCell, /// The window proxies known by this thread /// TODO: this map grows, but never shrinks. Issue #15258. - window_proxies: DOMRefCell>>, + window_proxies: DOMRefCell>>, /// A list of data pertaining to loads that have not yet received a network response incomplete_loads: DOMRefCell>, /// A vector containing parser contexts which have not yet been fully processed incomplete_parser_contexts: DOMRefCell>, /// A map to store service worker registrations for a given origin - registration_map: DOMRefCell>>, + registration_map: DOMRefCell>>, /// A job queue for Service Workers keyed by their scope url job_queue_map: Rc, /// Image cache for this script thread. @@ -476,7 +476,7 @@ pub struct ScriptThread { mutation_observer_compound_microtask_queued: Cell, /// The unit of related similar-origin browsing contexts' list of MutationObserver objects - mutation_observers: DOMRefCell>>, + mutation_observers: DOMRefCell>>, /// A handle to the webgl thread webgl_chan: WebGLPipeline, @@ -489,11 +489,11 @@ pub struct ScriptThread { /// A list of pipelines containing documents that finished loading all their blocking /// resources during a turn of the event loop. - docs_with_no_blocking_loads: DOMRefCell>>, + docs_with_no_blocking_loads: DOMRefCell>>, /// A list of nodes with in-progress CSS transitions, which roots them for the duration /// of the transition. - transitioning_nodes: DOMRefCell>>, + transitioning_nodes: DOMRefCell>>, /// https://html.spec.whatwg.org/multipage/#custom-element-reactions-stack custom_element_reaction_stack: CustomElementReactionStack, @@ -588,7 +588,7 @@ impl ScriptThread { let js_runtime = script_thread.js_runtime.rt(); let new_nodes = nodes .into_iter() - .map(|n| JS::from_ref(&*from_untrusted_node_address(js_runtime, n))); + .map(|n| Dom::from_ref(&*from_untrusted_node_address(js_runtime, n))); script_thread.transitioning_nodes.borrow_mut().extend(new_nodes); }) } @@ -612,7 +612,7 @@ impl ScriptThread { let script_thread = unsafe { &*root.get().unwrap() }; script_thread.mutation_observers .borrow_mut() - .push(JS::from_ref(observer)); + .push(Dom::from_ref(observer)); }) } @@ -628,7 +628,7 @@ impl ScriptThread { let script_thread = unsafe { &*root.get().unwrap() }; script_thread.docs_with_no_blocking_loads .borrow_mut() - .insert(JS::from_ref(doc)); + .insert(Dom::from_ref(doc)); }) } @@ -1699,7 +1699,7 @@ impl ScriptThread { // according to spec we should replace if an older registration exists for // same scope otherwise just insert the new one let _ = reg_ref.remove(scope); - reg_ref.insert(scope.clone(), JS::from_ref(registration)); + reg_ref.insert(scope.clone(), Dom::from_ref(registration)); } // send ScopeThings to sw-manager @@ -1959,7 +1959,7 @@ impl ScriptThread { browsing_context_id, top_level_browsing_context_id, parent.r()); - self.window_proxies.borrow_mut().insert(browsing_context_id, JS::from_ref(&*window_proxy)); + self.window_proxies.borrow_mut().insert(browsing_context_id, Dom::from_ref(&*window_proxy)); Some(window_proxy) } @@ -1996,7 +1996,7 @@ impl ScriptThread { top_level_browsing_context_id, iframe.r().map(Castable::upcast), parent.r()); - self.window_proxies.borrow_mut().insert(browsing_context_id, JS::from_ref(&*window_proxy)); + self.window_proxies.borrow_mut().insert(browsing_context_id, Dom::from_ref(&*window_proxy)); window_proxy } diff --git a/components/script/serviceworkerjob.rs b/components/script/serviceworkerjob.rs index 54af84ad9c01..76276d7b5cef 100644 --- a/components/script/serviceworkerjob.rs +++ b/components/script/serviceworkerjob.rs @@ -11,7 +11,7 @@ use dom::bindings::cell::DOMRefCell; use dom::bindings::error::Error; use dom::bindings::refcounted::{Trusted, TrustedPromise}; use dom::bindings::reflector::DomObject; -use dom::bindings::root::JS; +use dom::bindings::root::Dom; use dom::client::Client; use dom::promise::Promise; use dom::serviceworkerregistration::ServiceWorkerRegistration; @@ -46,7 +46,7 @@ pub struct Job { pub promise: Rc, pub equivalent_jobs: Vec, // client can be a window client, worker client so `Client` will be an enum in future - pub client: JS, + pub client: Dom, pub referrer: ServoUrl } @@ -64,7 +64,7 @@ impl Job { script_url: script_url, promise: promise, equivalent_jobs: vec![], - client: JS::from_ref(client), + client: Dom::from_ref(client), referrer: client.creation_url() } } diff --git a/components/script/test.rs b/components/script/test.rs index 556ef4b95ffd..18d8754d8318 100644 --- a/components/script/test.rs +++ b/components/script/test.rs @@ -7,7 +7,7 @@ pub use dom::headers::normalize_value; // For compile-fail tests only. pub use dom::bindings::cell::DOMRefCell; -pub use dom::bindings::root::JS; +pub use dom::bindings::root::Dom; pub use dom::node::Node; pub use dom::bindings::refcounted::TrustedPromise; diff --git a/python/tidy/servo_tidy/tidy.py b/python/tidy/servo_tidy/tidy.py index 74c9bf7b36f4..cd4bf6feb979 100644 --- a/python/tidy/servo_tidy/tidy.py +++ b/python/tidy/servo_tidy/tidy.py @@ -574,10 +574,10 @@ def check_rust(file_name, lines): # No benefit over using &str (r": &String", "use &str instead of &String", no_filter), # There should be any use of banned types: - # Cell, Cell>, DOMRefCell>, DOMRefCell> + # Cell, Cell>, DOMRefCell>, DOMRefCell> (r"(\s|:)+Cell", "Banned type Cell detected. Use MutJS instead", no_filter), - (r"(\s|:)+Cell>", "Banned type Cell> detected. Use MutJS instead", no_filter), - (r"DOMRefCell>", "Banned type DOMRefCell> detected. Use MutJS instead", no_filter), + (r"(\s|:)+Cell>", "Banned type Cell> detected. Use MutJS instead", no_filter), + (r"DOMRefCell>", "Banned type DOMRefCell> detected. Use MutJS instead", no_filter), (r"DOMRefCell>", "Banned type DOMRefCell> detected. Use MutJS instead", no_filter), # No benefit to using &Root (r": &Root<", "use &T instead of &Root", no_filter), diff --git a/python/tidy/servo_tidy_tests/ban-domrefcell.rs b/python/tidy/servo_tidy_tests/ban-domrefcell.rs index 9cd8a74ca8c8..f41358e7fa72 100644 --- a/python/tidy/servo_tidy_tests/ban-domrefcell.rs +++ b/python/tidy/servo_tidy_tests/ban-domrefcell.rs @@ -7,13 +7,13 @@ extern crate script; +use script::test::Dom; use script::test::DOMRefCell; -use script::test::JS; use script::test::Node; struct Foo { - bar: DOMRefCell> - //~^ ERROR Banned type DOMRefCell> detected. Use MutJS instead + bar: DOMRefCell> + //~^ ERROR Banned type DOMRefCell> detected. Use MutJS instead } fn main() {} diff --git a/python/tidy/servo_tidy_tests/test_tidy.py b/python/tidy/servo_tidy_tests/test_tidy.py index 6a45fd42062a..ce9906f55490 100644 --- a/python/tidy/servo_tidy_tests/test_tidy.py +++ b/python/tidy/servo_tidy_tests/test_tidy.py @@ -151,7 +151,7 @@ def test_rust(self): self.assertNoMoreErrors(ban_errors) ban_errors = tidy.collect_errors_for_files(iterFile('ban-domrefcell.rs'), [], [tidy.check_rust], print_text=False) - self.assertEqual('Banned type DOMRefCell> detected. Use MutJS instead', ban_errors.next()[2]) + self.assertEqual('Banned type DOMRefCell> detected. Use MutJS instead', ban_errors.next()[2]) self.assertNoMoreErrors(ban_errors) def test_spec_link(self): From d29335040d78a19f25830061484cf70dc03a9c21 Mon Sep 17 00:00:00 2001 From: Anthony Ramine Date: Tue, 26 Sep 2017 00:16:22 +0200 Subject: [PATCH 4/9] Rename MutJS to MutDom --- components/script/dom/bindings/root.rs | 20 +++++++++---------- components/script/dom/mod.rs | 2 +- components/script/dom/nodeiterator.rs | 6 +++--- components/script/dom/range.rs | 6 +++--- components/script/dom/touch.rs | 6 +++--- components/script/dom/touchevent.rs | 14 ++++++------- components/script/dom/treewalker.rs | 6 +++--- components/script/dom/vrdisplay.rs | 14 ++++++------- python/tidy/servo_tidy/tidy.py | 8 ++++---- .../tidy/servo_tidy_tests/ban-domrefcell.rs | 2 +- python/tidy/servo_tidy_tests/ban.rs | 2 +- python/tidy/servo_tidy_tests/test_tidy.py | 4 ++-- 12 files changed, 45 insertions(+), 45 deletions(-) diff --git a/components/script/dom/bindings/root.rs b/components/script/dom/bindings/root.rs index 32c3e5c7eaa7..a7f4bb9e4118 100644 --- a/components/script/dom/bindings/root.rs +++ b/components/script/dom/bindings/root.rs @@ -237,20 +237,20 @@ impl LayoutJS { /// on `Dom`. #[must_root] #[derive(JSTraceable)] -pub struct MutJS { +pub struct MutDom { val: UnsafeCell>, } -impl MutJS { - /// Create a new `MutJS`. - pub fn new(initial: &T) -> MutJS { +impl MutDom { + /// Create a new `MutDom`. + pub fn new(initial: &T) -> MutDom { debug_assert!(thread_state::get().is_script()); - MutJS { + MutDom { val: UnsafeCell::new(Dom::from_ref(initial)), } } - /// Set this `MutJS` to the given value. + /// Set this `MutDom` to the given value. pub fn set(&self, val: &T) { debug_assert!(thread_state::get().is_script()); unsafe { @@ -258,7 +258,7 @@ impl MutJS { } } - /// Get the value in this `MutJS`. + /// Get the value in this `MutDom`. pub fn get(&self) -> Root { debug_assert!(thread_state::get().is_script()); unsafe { @@ -267,14 +267,14 @@ impl MutJS { } } -impl HeapSizeOf for MutJS { +impl HeapSizeOf for MutDom { fn heap_size_of_children(&self) -> usize { // See comment on HeapSizeOf for Dom. 0 } } -impl PartialEq for MutJS { +impl PartialEq for MutDom { fn eq(&self, other: &Self) -> bool { unsafe { *self.val.get() == *other.val.get() @@ -282,7 +282,7 @@ impl PartialEq for MutJS { } } -impl PartialEq for MutJS { +impl PartialEq for MutDom { fn eq(&self, other: &T) -> bool { unsafe { **self.val.get() == *other diff --git a/components/script/dom/mod.rs b/components/script/dom/mod.rs index 8020d832ab9b..7c683edf9eb9 100644 --- a/components/script/dom/mod.rs +++ b/components/script/dom/mod.rs @@ -33,7 +33,7 @@ //! the [`Root`](bindings/root/struct.Root.html) smart pointer; //! * tracing pointers in member fields: the [`Dom`](bindings/root/struct.Dom.html), //! [`MutNullableJS`](bindings/root/struct.MutNullableJS.html) and -//! [`MutJS`](bindings/root/struct.MutJS.html) smart pointers and +//! [`MutDom`](bindings/root/struct.MutDom.html) smart pointers and //! [the tracing implementation](bindings/trace/index.html); //! * rooting pointers from across thread boundaries or in channels: the //! [`Trusted`](bindings/refcounted/struct.Trusted.html) smart pointer; diff --git a/components/script/dom/nodeiterator.rs b/components/script/dom/nodeiterator.rs index 0ab8c54360b0..ec18066a9789 100644 --- a/components/script/dom/nodeiterator.rs +++ b/components/script/dom/nodeiterator.rs @@ -10,7 +10,7 @@ use dom::bindings::codegen::Bindings::NodeIteratorBinding; use dom::bindings::codegen::Bindings::NodeIteratorBinding::NodeIteratorMethods; use dom::bindings::error::Fallible; use dom::bindings::reflector::{Reflector, reflect_dom_object}; -use dom::bindings::root::{Dom, MutJS, Root}; +use dom::bindings::root::{Dom, MutDom, Root}; use dom::document::Document; use dom::node::Node; use dom_struct::dom_struct; @@ -22,7 +22,7 @@ pub struct NodeIterator { reflector_: Reflector, root_node: Dom, #[ignore_heap_size_of = "Defined in rust-mozjs"] - reference_node: MutJS, + reference_node: MutDom, pointer_before_reference_node: Cell, what_to_show: u32, #[ignore_heap_size_of = "Can't measure due to #6870"] @@ -36,7 +36,7 @@ impl NodeIterator { NodeIterator { reflector_: Reflector::new(), root_node: Dom::from_ref(root_node), - reference_node: MutJS::new(root_node), + reference_node: MutDom::new(root_node), pointer_before_reference_node: Cell::new(true), what_to_show: what_to_show, filter: filter diff --git a/components/script/dom/range.rs b/components/script/dom/range.rs index 1344f9c7a5cf..79091beff557 100644 --- a/components/script/dom/range.rs +++ b/components/script/dom/range.rs @@ -14,7 +14,7 @@ use dom::bindings::error::{Error, ErrorResult, Fallible}; use dom::bindings::inheritance::{CharacterDataTypeId, NodeTypeId}; use dom::bindings::inheritance::Castable; use dom::bindings::reflector::{Reflector, reflect_dom_object}; -use dom::bindings::root::{Dom, MutJS, Root, RootedReference}; +use dom::bindings::root::{Dom, MutDom, Root, RootedReference}; use dom::bindings::str::DOMString; use dom::bindings::trace::JSTraceable; use dom::bindings::weakref::{WeakRef, WeakRefVec}; @@ -933,7 +933,7 @@ impl RangeMethods for Range { #[derive(DenyPublicFields, HeapSizeOf, JSTraceable)] #[must_root] pub struct BoundaryPoint { - node: MutJS, + node: MutDom, offset: Cell, } @@ -942,7 +942,7 @@ impl BoundaryPoint { debug_assert!(!node.is_doctype()); debug_assert!(offset <= node.len()); BoundaryPoint { - node: MutJS::new(node), + node: MutDom::new(node), offset: Cell::new(offset), } } diff --git a/components/script/dom/touch.rs b/components/script/dom/touch.rs index d7920a2dd196..d526e607d8d1 100644 --- a/components/script/dom/touch.rs +++ b/components/script/dom/touch.rs @@ -6,7 +6,7 @@ use dom::bindings::codegen::Bindings::TouchBinding; use dom::bindings::codegen::Bindings::TouchBinding::TouchMethods; use dom::bindings::num::Finite; use dom::bindings::reflector::{Reflector, reflect_dom_object}; -use dom::bindings::root::{MutJS, Root}; +use dom::bindings::root::{MutDom, Root}; use dom::eventtarget::EventTarget; use dom::window::Window; use dom_struct::dom_struct; @@ -15,7 +15,7 @@ use dom_struct::dom_struct; pub struct Touch { reflector_: Reflector, identifier: i32, - target: MutJS, + target: MutDom, screen_x: f64, screen_y: f64, client_x: f64, @@ -32,7 +32,7 @@ impl Touch { Touch { reflector_: Reflector::new(), identifier: identifier, - target: MutJS::new(target), + target: MutDom::new(target), screen_x: *screen_x, screen_y: *screen_y, client_x: *client_x, diff --git a/components/script/dom/touchevent.rs b/components/script/dom/touchevent.rs index 4c29bc484454..92ff9bf04242 100644 --- a/components/script/dom/touchevent.rs +++ b/components/script/dom/touchevent.rs @@ -7,7 +7,7 @@ use dom::bindings::codegen::Bindings::TouchEventBinding::TouchEventMethods; use dom::bindings::codegen::Bindings::UIEventBinding::UIEventMethods; use dom::bindings::inheritance::Castable; use dom::bindings::reflector::reflect_dom_object; -use dom::bindings::root::{MutJS, Root}; +use dom::bindings::root::{MutDom, Root}; use dom::bindings::str::DOMString; use dom::event::{EventBubbles, EventCancelable}; use dom::touchlist::TouchList; @@ -19,9 +19,9 @@ use std::cell::Cell; #[dom_struct] pub struct TouchEvent { uievent: UIEvent, - touches: MutJS, - target_touches: MutJS, - changed_touches: MutJS, + touches: MutDom, + target_touches: MutDom, + changed_touches: MutDom, alt_key: Cell, meta_key: Cell, ctrl_key: Cell, @@ -34,9 +34,9 @@ impl TouchEvent { target_touches: &TouchList) -> TouchEvent { TouchEvent { uievent: UIEvent::new_inherited(), - touches: MutJS::new(touches), - target_touches: MutJS::new(target_touches), - changed_touches: MutJS::new(changed_touches), + touches: MutDom::new(touches), + target_touches: MutDom::new(target_touches), + changed_touches: MutDom::new(changed_touches), ctrl_key: Cell::new(false), shift_key: Cell::new(false), alt_key: Cell::new(false), diff --git a/components/script/dom/treewalker.rs b/components/script/dom/treewalker.rs index bbb27c61541b..61a085aaa53e 100644 --- a/components/script/dom/treewalker.rs +++ b/components/script/dom/treewalker.rs @@ -10,7 +10,7 @@ use dom::bindings::codegen::Bindings::TreeWalkerBinding; use dom::bindings::codegen::Bindings::TreeWalkerBinding::TreeWalkerMethods; use dom::bindings::error::Fallible; use dom::bindings::reflector::{Reflector, reflect_dom_object}; -use dom::bindings::root::{Dom, MutJS, Root}; +use dom::bindings::root::{Dom, MutDom, Root}; use dom::document::Document; use dom::node::Node; use dom_struct::dom_struct; @@ -21,7 +21,7 @@ use std::rc::Rc; pub struct TreeWalker { reflector_: Reflector, root_node: Dom, - current_node: MutJS, + current_node: MutDom, what_to_show: u32, #[ignore_heap_size_of = "function pointers and Rc are hard"] filter: Filter @@ -34,7 +34,7 @@ impl TreeWalker { TreeWalker { reflector_: Reflector::new(), root_node: Dom::from_ref(root_node), - current_node: MutJS::new(root_node), + current_node: MutDom::new(root_node), what_to_show: what_to_show, filter: filter } diff --git a/components/script/dom/vrdisplay.rs b/components/script/dom/vrdisplay.rs index a17666e625ea..d6e8d480c3d3 100644 --- a/components/script/dom/vrdisplay.rs +++ b/components/script/dom/vrdisplay.rs @@ -18,7 +18,7 @@ use dom::bindings::inheritance::Castable; use dom::bindings::num::Finite; use dom::bindings::refcounted::Trusted; use dom::bindings::reflector::{DomObject, reflect_dom_object}; -use dom::bindings::root::{MutJS, MutNullableJS, Root}; +use dom::bindings::root::{MutDom, MutNullableJS, Root}; use dom::bindings::str::DOMString; use dom::event::Event; use dom::eventtarget::EventTarget; @@ -51,9 +51,9 @@ pub struct VRDisplay { depth_near: Cell, depth_far: Cell, presenting: Cell, - left_eye_params: MutJS, - right_eye_params: MutJS, - capabilities: MutJS, + left_eye_params: MutDom, + right_eye_params: MutDom, + capabilities: MutDom, stage_params: MutNullableJS, #[ignore_heap_size_of = "Defined in rust-webvr"] frame_data: DOMRefCell, @@ -100,9 +100,9 @@ impl VRDisplay { depth_near: Cell::new(0.01), depth_far: Cell::new(10000.0), presenting: Cell::new(false), - left_eye_params: MutJS::new(&*VREyeParameters::new(display.left_eye_parameters.clone(), &global)), - right_eye_params: MutJS::new(&*VREyeParameters::new(display.right_eye_parameters.clone(), &global)), - capabilities: MutJS::new(&*VRDisplayCapabilities::new(display.capabilities.clone(), &global)), + left_eye_params: MutDom::new(&*VREyeParameters::new(display.left_eye_parameters.clone(), &global)), + right_eye_params: MutDom::new(&*VREyeParameters::new(display.right_eye_parameters.clone(), &global)), + capabilities: MutDom::new(&*VRDisplayCapabilities::new(display.capabilities.clone(), &global)), stage_params: MutNullableJS::new(stage.as_ref().map(|v| v.deref())), frame_data: DOMRefCell::new(Default::default()), layer: DOMRefCell::new(Default::default()), diff --git a/python/tidy/servo_tidy/tidy.py b/python/tidy/servo_tidy/tidy.py index cd4bf6feb979..d7c83ee8cee1 100644 --- a/python/tidy/servo_tidy/tidy.py +++ b/python/tidy/servo_tidy/tidy.py @@ -575,10 +575,10 @@ def check_rust(file_name, lines): (r": &String", "use &str instead of &String", no_filter), # There should be any use of banned types: # Cell, Cell>, DOMRefCell>, DOMRefCell> - (r"(\s|:)+Cell", "Banned type Cell detected. Use MutJS instead", no_filter), - (r"(\s|:)+Cell>", "Banned type Cell> detected. Use MutJS instead", no_filter), - (r"DOMRefCell>", "Banned type DOMRefCell> detected. Use MutJS instead", no_filter), - (r"DOMRefCell>", "Banned type DOMRefCell> detected. Use MutJS instead", no_filter), + (r"(\s|:)+Cell", "Banned type Cell detected. Use MutDom instead", no_filter), + (r"(\s|:)+Cell>", "Banned type Cell> detected. Use MutDom instead", no_filter), + (r"DOMRefCell>", "Banned type DOMRefCell> detected. Use MutDom instead", no_filter), + (r"DOMRefCell>", "Banned type DOMRefCell> detected. Use MutDom instead", no_filter), # No benefit to using &Root (r": &Root<", "use &T instead of &Root", no_filter), (r"^&&", "operators should go at the end of the first line", no_filter), diff --git a/python/tidy/servo_tidy_tests/ban-domrefcell.rs b/python/tidy/servo_tidy_tests/ban-domrefcell.rs index f41358e7fa72..6d4e2b2fbc3b 100644 --- a/python/tidy/servo_tidy_tests/ban-domrefcell.rs +++ b/python/tidy/servo_tidy_tests/ban-domrefcell.rs @@ -13,7 +13,7 @@ use script::test::Node; struct Foo { bar: DOMRefCell> - //~^ ERROR Banned type DOMRefCell> detected. Use MutJS instead + //~^ ERROR Banned type DOMRefCell> detected. Use MutDom instead } fn main() {} diff --git a/python/tidy/servo_tidy_tests/ban.rs b/python/tidy/servo_tidy_tests/ban.rs index f828053d289c..fc5c600041a9 100644 --- a/python/tidy/servo_tidy_tests/ban.rs +++ b/python/tidy/servo_tidy_tests/ban.rs @@ -13,7 +13,7 @@ use std::cell::UnsafeCell; struct Foo { bar: Cell, - //~^ ERROR Banned type Cell detected. Use MutJS instead + //~^ ERROR Banned type Cell detected. Use MutDom instead foo: UnsafeCell //~^ NOT AN ERROR } diff --git a/python/tidy/servo_tidy_tests/test_tidy.py b/python/tidy/servo_tidy_tests/test_tidy.py index ce9906f55490..3761975c62bc 100644 --- a/python/tidy/servo_tidy_tests/test_tidy.py +++ b/python/tidy/servo_tidy_tests/test_tidy.py @@ -147,11 +147,11 @@ def test_rust(self): self.assertNoMoreErrors(feature_errors) ban_errors = tidy.collect_errors_for_files(iterFile('ban.rs'), [], [tidy.check_rust], print_text=False) - self.assertEqual('Banned type Cell detected. Use MutJS instead', ban_errors.next()[2]) + self.assertEqual('Banned type Cell detected. Use MutDom instead', ban_errors.next()[2]) self.assertNoMoreErrors(ban_errors) ban_errors = tidy.collect_errors_for_files(iterFile('ban-domrefcell.rs'), [], [tidy.check_rust], print_text=False) - self.assertEqual('Banned type DOMRefCell> detected. Use MutJS instead', ban_errors.next()[2]) + self.assertEqual('Banned type DOMRefCell> detected. Use MutDom instead', ban_errors.next()[2]) self.assertNoMoreErrors(ban_errors) def test_spec_link(self): From c52fd0a78041ec22db1c4b391556368cd8b87b02 Mon Sep 17 00:00:00 2001 From: Anthony Ramine Date: Tue, 26 Sep 2017 01:21:01 +0200 Subject: [PATCH 5/9] Rename MutNullableJS to MutNullableDom --- components/script/dom/attr.rs | 6 +-- components/script/dom/bindings/root.rs | 24 +++++----- components/script/dom/bluetoothdevice.rs | 4 +- components/script/dom/client.rs | 4 +- components/script/dom/cssgroupingrule.rs | 6 +-- components/script/dom/csskeyframerule.rs | 4 +- components/script/dom/csskeyframesrule.rs | 6 +-- components/script/dom/cssmediarule.rs | 6 +-- components/script/dom/cssrulelist.rs | 12 ++--- components/script/dom/cssstylerule.rs | 4 +- components/script/dom/cssstylesheet.rs | 6 +-- .../script/dom/dissimilaroriginwindow.rs | 4 +- components/script/dom/document.rs | 44 +++++++++---------- components/script/dom/element.rs | 6 +-- components/script/dom/event.rs | 6 +-- components/script/dom/filereader.rs | 6 +-- components/script/dom/focusevent.rs | 4 +- components/script/dom/globalscope.rs | 4 +- components/script/dom/htmlanchorelement.rs | 4 +- components/script/dom/htmlareaelement.rs | 4 +- components/script/dom/htmlbuttonelement.rs | 4 +- components/script/dom/htmlcollection.rs | 6 +-- components/script/dom/htmlelement.rs | 6 +-- components/script/dom/htmlfieldsetelement.rs | 4 +- components/script/dom/htmliframeelement.rs | 4 +- components/script/dom/htmlimageelement.rs | 4 +- components/script/dom/htmlinputelement.rs | 8 ++-- components/script/dom/htmllegendelement.rs | 4 +- components/script/dom/htmllinkelement.rs | 8 ++-- components/script/dom/htmlmediaelement.rs | 4 +- components/script/dom/htmlmetaelement.rs | 6 +-- components/script/dom/htmlobjectelement.rs | 4 +- components/script/dom/htmloutputelement.rs | 4 +- components/script/dom/htmlselectelement.rs | 6 +-- components/script/dom/htmlstyleelement.rs | 6 +-- components/script/dom/htmltableelement.rs | 4 +- components/script/dom/htmltablerowelement.rs | 4 +- components/script/dom/htmltemplateelement.rs | 6 +-- components/script/dom/htmltextareaelement.rs | 4 +- components/script/dom/mod.rs | 2 +- components/script/dom/mouseevent.rs | 4 +- components/script/dom/mutationrecord.rs | 10 ++--- components/script/dom/navigator.rs | 16 +++---- components/script/dom/node.rs | 18 ++++---- components/script/dom/nodelist.rs | 6 +-- components/script/dom/request.rs | 4 +- components/script/dom/response.rs | 4 +- .../script/dom/serviceworkercontainer.rs | 4 +- components/script/dom/servoparser/mod.rs | 4 +- components/script/dom/storageevent.rs | 6 +-- components/script/dom/uievent.rs | 4 +- components/script/dom/url.rs | 4 +- components/script/dom/vrdisplay.rs | 10 ++--- .../ext/oesvertexarrayobject.rs | 6 +-- .../ext/webglvertexarrayobjectoes.rs | 6 +-- .../script/dom/webgl_extensions/wrapper.rs | 8 ++-- components/script/dom/webglprogram.rs | 6 +-- .../script/dom/webglrenderingcontext.rs | 30 ++++++------- components/script/dom/window.rs | 28 ++++++------ components/script/dom/workerglobalscope.rs | 8 ++-- components/script/dom/workernavigator.rs | 4 +- components/script/dom/xmlhttprequest.rs | 6 +-- components/script/script_thread.rs | 6 +-- 63 files changed, 232 insertions(+), 232 deletions(-) diff --git a/components/script/dom/attr.rs b/components/script/dom/attr.rs index ea97c1a294f1..d18eed26f65b 100644 --- a/components/script/dom/attr.rs +++ b/components/script/dom/attr.rs @@ -7,7 +7,7 @@ use dom::bindings::cell::DOMRefCell; use dom::bindings::codegen::Bindings::AttrBinding::{self, AttrMethods}; use dom::bindings::inheritance::Castable; use dom::bindings::reflector::{Reflector, reflect_dom_object}; -use dom::bindings::root::{LayoutJS, MutNullableJS, Root, RootedReference}; +use dom::bindings::root::{LayoutJS, MutNullableDom, Root, RootedReference}; use dom::bindings::str::DOMString; use dom::customelementregistry::CallbackReaction; use dom::element::{AttributeMutation, Element}; @@ -32,7 +32,7 @@ pub struct Attr { value: DOMRefCell, /// the element that owns this attribute. - owner: MutNullableJS, + owner: MutNullableDom, } impl Attr { @@ -52,7 +52,7 @@ impl Attr { prefix: prefix, }, value: DOMRefCell::new(value), - owner: MutNullableJS::new(owner), + owner: MutNullableDom::new(owner), } } diff --git a/components/script/dom/bindings/root.rs b/components/script/dom/bindings/root.rs index a7f4bb9e4118..dbfe4023d63e 100644 --- a/components/script/dom/bindings/root.rs +++ b/components/script/dom/bindings/root.rs @@ -298,15 +298,15 @@ impl PartialEq for MutDom { /// on `Dom`. #[must_root] #[derive(JSTraceable)] -pub struct MutNullableJS { +pub struct MutNullableDom { ptr: UnsafeCell>>, } -impl MutNullableJS { - /// Create a new `MutNullableJS`. - pub fn new(initial: Option<&T>) -> MutNullableJS { +impl MutNullableDom { + /// Create a new `MutNullableDom`. + pub fn new(initial: Option<&T>) -> MutNullableDom { debug_assert!(thread_state::get().is_script()); - MutNullableJS { + MutNullableDom { ptr: UnsafeCell::new(initial.map(Dom::from_ref)), } } @@ -344,7 +344,7 @@ impl MutNullableJS { } } - /// Set this `MutNullableJS` to the given value. + /// Set this `MutNullableDom` to the given value. pub fn set(&self, val: Option<&T>) { debug_assert!(thread_state::get().is_script()); unsafe { @@ -360,7 +360,7 @@ impl MutNullableJS { } } -impl PartialEq for MutNullableJS { +impl PartialEq for MutNullableDom { fn eq(&self, other: &Self) -> bool { unsafe { *self.ptr.get() == *other.ptr.get() @@ -368,7 +368,7 @@ impl PartialEq for MutNullableJS { } } -impl<'a, T: DomObject> PartialEq> for MutNullableJS { +impl<'a, T: DomObject> PartialEq> for MutNullableDom { fn eq(&self, other: &Option<&T>) -> bool { unsafe { *self.ptr.get() == other.map(Dom::from_ref) @@ -376,17 +376,17 @@ impl<'a, T: DomObject> PartialEq> for MutNullableJS { } } -impl Default for MutNullableJS { +impl Default for MutNullableDom { #[allow(unrooted_must_root)] - fn default() -> MutNullableJS { + fn default() -> MutNullableDom { debug_assert!(thread_state::get().is_script()); - MutNullableJS { + MutNullableDom { ptr: UnsafeCell::new(None), } } } -impl HeapSizeOf for MutNullableJS { +impl HeapSizeOf for MutNullableDom { fn heap_size_of_children(&self) -> usize { // See comment on HeapSizeOf for Dom. 0 diff --git a/components/script/dom/bluetoothdevice.rs b/components/script/dom/bluetoothdevice.rs index c07852f78538..d98a1ed42f5f 100644 --- a/components/script/dom/bluetoothdevice.rs +++ b/components/script/dom/bluetoothdevice.rs @@ -12,7 +12,7 @@ use dom::bindings::error::Error; use dom::bindings::error::ErrorResult; use dom::bindings::inheritance::Castable; use dom::bindings::reflector::{DomObject, reflect_dom_object}; -use dom::bindings::root::{Dom, MutNullableJS, Root}; +use dom::bindings::root::{Dom, MutNullableDom, Root}; use dom::bindings::str::DOMString; use dom::bluetooth::{AsyncBluetoothListener, Bluetooth, response_async}; use dom::bluetoothcharacteristicproperties::BluetoothCharacteristicProperties; @@ -35,7 +35,7 @@ pub struct BluetoothDevice { eventtarget: EventTarget, id: DOMString, name: Option, - gatt: MutNullableJS, + gatt: MutNullableDom, context: Dom, attribute_instance_map: (DOMRefCell>>, DOMRefCell>>, diff --git a/components/script/dom/client.rs b/components/script/dom/client.rs index 872b23196e6b..6ec88bd0cbd5 100644 --- a/components/script/dom/client.rs +++ b/components/script/dom/client.rs @@ -5,7 +5,7 @@ use dom::bindings::codegen::Bindings::ClientBinding::{ClientMethods, Wrap}; use dom::bindings::codegen::Bindings::ClientBinding::FrameType; use dom::bindings::reflector::{Reflector, reflect_dom_object}; -use dom::bindings::root::{Root, MutNullableJS}; +use dom::bindings::root::{Root, MutNullableDom}; use dom::bindings::str::{DOMString, USVString}; use dom::serviceworker::ServiceWorker; use dom::window::Window; @@ -17,7 +17,7 @@ use uuid::Uuid; #[dom_struct] pub struct Client { reflector_: Reflector, - active_worker: MutNullableJS, + active_worker: MutNullableDom, url: ServoUrl, frame_type: FrameType, #[ignore_heap_size_of = "Defined in uuid"] diff --git a/components/script/dom/cssgroupingrule.rs b/components/script/dom/cssgroupingrule.rs index f3a462237528..de5e59f27848 100644 --- a/components/script/dom/cssgroupingrule.rs +++ b/components/script/dom/cssgroupingrule.rs @@ -6,7 +6,7 @@ use dom::bindings::codegen::Bindings::CSSGroupingRuleBinding::CSSGroupingRuleMet use dom::bindings::error::{ErrorResult, Fallible}; use dom::bindings::inheritance::Castable; use dom::bindings::reflector::DomObject; -use dom::bindings::root::{MutNullableJS, Root}; +use dom::bindings::root::{MutNullableDom, Root}; use dom::bindings::str::DOMString; use dom::cssrule::CSSRule; use dom::cssrulelist::{CSSRuleList, RulesSource}; @@ -21,7 +21,7 @@ pub struct CSSGroupingRule { cssrule: CSSRule, #[ignore_heap_size_of = "Arc"] rules: Arc>, - rulelist: MutNullableJS, + rulelist: MutNullableDom, } impl CSSGroupingRule { @@ -30,7 +30,7 @@ impl CSSGroupingRule { CSSGroupingRule { cssrule: CSSRule::new_inherited(parent_stylesheet), rules: rules, - rulelist: MutNullableJS::new(None), + rulelist: MutNullableDom::new(None), } } diff --git a/components/script/dom/csskeyframerule.rs b/components/script/dom/csskeyframerule.rs index 0b8329ccf1bd..17b5c7a63c4b 100644 --- a/components/script/dom/csskeyframerule.rs +++ b/components/script/dom/csskeyframerule.rs @@ -5,7 +5,7 @@ use dom::bindings::codegen::Bindings::CSSKeyframeRuleBinding::{self, CSSKeyframeRuleMethods}; use dom::bindings::inheritance::Castable; use dom::bindings::reflector::{DomObject, reflect_dom_object}; -use dom::bindings::root::{Dom, MutNullableJS, Root}; +use dom::bindings::root::{Dom, MutNullableDom, Root}; use dom::bindings::str::DOMString; use dom::cssrule::{CSSRule, SpecificCSSRule}; use dom::cssstyledeclaration::{CSSModificationAccess, CSSStyleDeclaration, CSSStyleOwner}; @@ -21,7 +21,7 @@ pub struct CSSKeyframeRule { cssrule: CSSRule, #[ignore_heap_size_of = "Arc"] keyframerule: Arc>, - style_decl: MutNullableJS, + style_decl: MutNullableDom, } impl CSSKeyframeRule { diff --git a/components/script/dom/csskeyframesrule.rs b/components/script/dom/csskeyframesrule.rs index d699f15c0a07..280cd53fcf6a 100644 --- a/components/script/dom/csskeyframesrule.rs +++ b/components/script/dom/csskeyframesrule.rs @@ -8,7 +8,7 @@ use dom::bindings::codegen::Bindings::CSSKeyframesRuleBinding::CSSKeyframesRuleM use dom::bindings::error::ErrorResult; use dom::bindings::inheritance::Castable; use dom::bindings::reflector::{DomObject, reflect_dom_object}; -use dom::bindings::root::{MutNullableJS, Root}; +use dom::bindings::root::{MutNullableDom, Root}; use dom::bindings::str::DOMString; use dom::csskeyframerule::CSSKeyframeRule; use dom::cssrule::{CSSRule, SpecificCSSRule}; @@ -26,7 +26,7 @@ pub struct CSSKeyframesRule { cssrule: CSSRule, #[ignore_heap_size_of = "Arc"] keyframesrule: Arc>, - rulelist: MutNullableJS, + rulelist: MutNullableDom, } impl CSSKeyframesRule { @@ -35,7 +35,7 @@ impl CSSKeyframesRule { CSSKeyframesRule { cssrule: CSSRule::new_inherited(parent_stylesheet), keyframesrule: keyframesrule, - rulelist: MutNullableJS::new(None), + rulelist: MutNullableDom::new(None), } } diff --git a/components/script/dom/cssmediarule.rs b/components/script/dom/cssmediarule.rs index 1dc4ce69a116..c77ed0b75639 100644 --- a/components/script/dom/cssmediarule.rs +++ b/components/script/dom/cssmediarule.rs @@ -7,7 +7,7 @@ use dom::bindings::codegen::Bindings::CSSMediaRuleBinding; use dom::bindings::codegen::Bindings::CSSMediaRuleBinding::CSSMediaRuleMethods; use dom::bindings::codegen::Bindings::WindowBinding::WindowBinding::WindowMethods; use dom::bindings::reflector::{DomObject, reflect_dom_object}; -use dom::bindings::root::{MutNullableJS, Root}; +use dom::bindings::root::{MutNullableDom, Root}; use dom::bindings::str::DOMString; use dom::cssconditionrule::CSSConditionRule; use dom::cssrule::SpecificCSSRule; @@ -27,7 +27,7 @@ pub struct CSSMediaRule { cssconditionrule: CSSConditionRule, #[ignore_heap_size_of = "Arc"] mediarule: Arc>, - medialist: MutNullableJS, + medialist: MutNullableDom, } impl CSSMediaRule { @@ -38,7 +38,7 @@ impl CSSMediaRule { CSSMediaRule { cssconditionrule: CSSConditionRule::new_inherited(parent_stylesheet, list), mediarule: mediarule, - medialist: MutNullableJS::new(None), + medialist: MutNullableDom::new(None), } } diff --git a/components/script/dom/cssrulelist.rs b/components/script/dom/cssrulelist.rs index 4500405869e2..8fdef21c4d0e 100644 --- a/components/script/dom/cssrulelist.rs +++ b/components/script/dom/cssrulelist.rs @@ -7,7 +7,7 @@ use dom::bindings::codegen::Bindings::CSSRuleListBinding; use dom::bindings::codegen::Bindings::CSSRuleListBinding::CSSRuleListMethods; use dom::bindings::error::{Error, ErrorResult, Fallible}; use dom::bindings::reflector::{DomObject, Reflector, reflect_dom_object}; -use dom::bindings::root::{Dom, MutNullableJS, Root}; +use dom::bindings::root::{Dom, MutNullableDom, Root}; use dom::csskeyframerule::CSSKeyframeRule; use dom::cssrule::CSSRule; use dom::cssstylesheet::CSSStyleSheet; @@ -39,7 +39,7 @@ pub struct CSSRuleList { parent_stylesheet: Dom, #[ignore_heap_size_of = "Arc"] rules: RulesSource, - dom_rules: DOMRefCell>> + dom_rules: DOMRefCell>> } pub enum RulesSource { @@ -53,10 +53,10 @@ impl CSSRuleList { let guard = parent_stylesheet.shared_lock().read(); let dom_rules = match rules { RulesSource::Rules(ref rules) => { - rules.read_with(&guard).0.iter().map(|_| MutNullableJS::new(None)).collect() + rules.read_with(&guard).0.iter().map(|_| MutNullableDom::new(None)).collect() } RulesSource::Keyframes(ref rules) => { - rules.read_with(&guard).keyframes.iter().map(|_| MutNullableJS::new(None)).collect() + rules.read_with(&guard).keyframes.iter().map(|_| MutNullableDom::new(None)).collect() } }; @@ -102,7 +102,7 @@ impl CSSRuleList { let parent_stylesheet = &*self.parent_stylesheet; let dom_rule = CSSRule::new_specific(&window, parent_stylesheet, new_rule); - self.dom_rules.borrow_mut().insert(index, MutNullableJS::new(Some(&*dom_rule))); + self.dom_rules.borrow_mut().insert(index, MutNullableDom::new(Some(&*dom_rule))); Ok((idx)) } @@ -170,7 +170,7 @@ impl CSSRuleList { if let RulesSource::Rules(..) = self.rules { panic!("Can only call append_lazy_rule with keyframes-backed CSSRules"); } - self.dom_rules.borrow_mut().push(MutNullableJS::new(None)); + self.dom_rules.borrow_mut().push(MutNullableDom::new(None)); } } diff --git a/components/script/dom/cssstylerule.rs b/components/script/dom/cssstylerule.rs index 5004a4f909b0..b8b99b8aef37 100644 --- a/components/script/dom/cssstylerule.rs +++ b/components/script/dom/cssstylerule.rs @@ -8,7 +8,7 @@ use dom::bindings::codegen::Bindings::CSSStyleRuleBinding::{self, CSSStyleRuleMe use dom::bindings::codegen::Bindings::WindowBinding::WindowBinding::WindowMethods; use dom::bindings::inheritance::Castable; use dom::bindings::reflector::{DomObject, reflect_dom_object}; -use dom::bindings::root::{Dom, MutNullableJS, Root}; +use dom::bindings::root::{Dom, MutNullableDom, Root}; use dom::bindings::str::DOMString; use dom::cssrule::{CSSRule, SpecificCSSRule}; use dom::cssstyledeclaration::{CSSModificationAccess, CSSStyleDeclaration, CSSStyleOwner}; @@ -27,7 +27,7 @@ pub struct CSSStyleRule { cssrule: CSSRule, #[ignore_heap_size_of = "Arc"] stylerule: Arc>, - style_decl: MutNullableJS, + style_decl: MutNullableDom, } impl CSSStyleRule { diff --git a/components/script/dom/cssstylesheet.rs b/components/script/dom/cssstylesheet.rs index 26396c964391..2839708e6076 100644 --- a/components/script/dom/cssstylesheet.rs +++ b/components/script/dom/cssstylesheet.rs @@ -7,7 +7,7 @@ use dom::bindings::codegen::Bindings::CSSStyleSheetBinding::CSSStyleSheetMethods use dom::bindings::codegen::Bindings::WindowBinding::WindowBinding::WindowMethods; use dom::bindings::error::{Error, ErrorResult, Fallible}; use dom::bindings::reflector::{reflect_dom_object, DomObject}; -use dom::bindings::root::{Dom, MutNullableJS, Root}; +use dom::bindings::root::{Dom, MutNullableDom, Root}; use dom::bindings::str::DOMString; use dom::cssrulelist::{CSSRuleList, RulesSource}; use dom::element::Element; @@ -23,7 +23,7 @@ use style::stylesheets::Stylesheet as StyleStyleSheet; pub struct CSSStyleSheet { stylesheet: StyleSheet, owner: Dom, - rulelist: MutNullableJS, + rulelist: MutNullableDom, #[ignore_heap_size_of = "Arc"] style_stylesheet: Arc, origin_clean: Cell, @@ -38,7 +38,7 @@ impl CSSStyleSheet { CSSStyleSheet { stylesheet: StyleSheet::new_inherited(type_, href, title), owner: Dom::from_ref(owner), - rulelist: MutNullableJS::new(None), + rulelist: MutNullableDom::new(None), style_stylesheet: stylesheet, origin_clean: Cell::new(true), } diff --git a/components/script/dom/dissimilaroriginwindow.rs b/components/script/dom/dissimilaroriginwindow.rs index 174446b6098f..ba1adf00c216 100644 --- a/components/script/dom/dissimilaroriginwindow.rs +++ b/components/script/dom/dissimilaroriginwindow.rs @@ -6,7 +6,7 @@ use dom::bindings::codegen::Bindings::DissimilarOriginWindowBinding; use dom::bindings::codegen::Bindings::DissimilarOriginWindowBinding::DissimilarOriginWindowMethods; use dom::bindings::error::{Error, ErrorResult}; use dom::bindings::inheritance::Castable; -use dom::bindings::root::{Dom, MutNullableJS, Root}; +use dom::bindings::root::{Dom, MutNullableDom, Root}; use dom::bindings::str::DOMString; use dom::bindings::structuredclone::StructuredCloneData; use dom::dissimilaroriginlocation::DissimilarOriginLocation; @@ -40,7 +40,7 @@ pub struct DissimilarOriginWindow { window_proxy: Dom, /// The location of this window, initialized lazily. - location: MutNullableJS, + location: MutNullableDom, } impl DissimilarOriginWindow { diff --git a/components/script/dom/document.rs b/components/script/dom/document.rs index 3075dcfc54df..49dfdb4230e9 100644 --- a/components/script/dom/document.rs +++ b/components/script/dom/document.rs @@ -27,7 +27,7 @@ use dom::bindings::inheritance::{Castable, ElementTypeId, HTMLElementTypeId, Nod use dom::bindings::num::Finite; use dom::bindings::refcounted::{Trusted, TrustedPromise}; use dom::bindings::reflector::{DomObject, reflect_dom_object}; -use dom::bindings::root::{Dom, LayoutJS, MutNullableJS, Root, RootedReference}; +use dom::bindings::root::{Dom, LayoutJS, MutNullableDom, Root, RootedReference}; use dom::bindings::str::{DOMString, USVString}; use dom::bindings::xmlname::{namespace_from_domstring, validate_and_extract, xml_name_type}; use dom::bindings::xmlname::XMLName::InvalidXMLName; @@ -224,7 +224,7 @@ impl ::style::stylesheets::StylesheetInDocument for StyleSheetInDocument { pub struct Document { node: Node, window: Dom, - implementation: MutNullableJS, + implementation: MutNullableDom, content_type: DOMString, last_modified: Option, encoding: Cell, @@ -239,28 +239,28 @@ pub struct Document { tag_map: DOMRefCell>>, tagns_map: DOMRefCell>>, classes_map: DOMRefCell, Dom>>, - images: MutNullableJS, - embeds: MutNullableJS, - links: MutNullableJS, - forms: MutNullableJS, - scripts: MutNullableJS, - anchors: MutNullableJS, - applets: MutNullableJS, + images: MutNullableDom, + embeds: MutNullableDom, + links: MutNullableDom, + forms: MutNullableDom, + scripts: MutNullableDom, + anchors: MutNullableDom, + applets: MutNullableDom, /// Lock use for style attributes and author-origin stylesheet objects in this document. /// Can be acquired once for accessing many objects. style_shared_lock: StyleSharedRwLock, /// List of stylesheets associated with nodes in this document. |None| if the list needs to be refreshed. stylesheets: DOMRefCell>, - stylesheet_list: MutNullableJS, + stylesheet_list: MutNullableDom, ready_state: Cell, /// Whether the DOMContentLoaded event has already been dispatched. domcontentloaded_dispatched: Cell, /// The element that has most recently requested focus for itself. - possibly_focused: MutNullableJS, + possibly_focused: MutNullableDom, /// The element that currently has the document focus context. - focused: MutNullableJS, + focused: MutNullableDom, /// The script element that is currently executing. - current_script: MutNullableJS, + current_script: MutNullableDom, /// https://html.spec.whatwg.org/multipage/#pending-parsing-blocking-script pending_parsing_blocking_script: DOMRefCell>, /// Number of stylesheets that block executing the next parser-inserted script @@ -288,14 +288,14 @@ pub struct Document { /// Tracks all outstanding loads related to this document. loader: DOMRefCell, /// The current active HTML parser, to allow resuming after interruptions. - current_parser: MutNullableJS, + current_parser: MutNullableDom, /// When we should kick off a reflow. This happens during parsing. reflow_timeout: Cell>, /// The cached first `base` element with an `href` attribute. - base_element: MutNullableJS, + base_element: MutNullableDom, /// This field is set to the document itself for inert documents. /// https://html.spec.whatwg.org/multipage/#appropriate-template-contents-owner-document - appropriate_template_contents_owner_document: MutNullableJS, + appropriate_template_contents_owner_document: MutNullableDom, /// Information on elements needing restyle to ship over to the layout thread when the /// time comes. pending_restyles: DOMRefCell, PendingRestyle>>, @@ -323,7 +323,7 @@ pub struct Document { /// https://html.spec.whatwg.org/multipage/#dom-document-referrer referrer: Option, /// https://html.spec.whatwg.org/multipage/#target-element - target_element: MutNullableJS, + target_element: MutNullableDom, /// https://w3c.github.io/uievents/#event-type-dblclick #[ignore_heap_size_of = "Defined in std"] last_click_info: DOMRefCell)>>, @@ -341,7 +341,7 @@ pub struct Document { /// See also: https://github.com/servo/servo/issues/10110 dom_count: Cell, /// Entry node for fullscreen. - fullscreen_element: MutNullableJS, + fullscreen_element: MutNullableDom, /// Map from ID to set of form control elements that have that ID as /// their 'form' content attribute. Used to reset form controls /// whenever any element with the same ID as the form attribute @@ -1112,7 +1112,7 @@ impl Document { pub fn handle_mouse_move_event(&self, js_runtime: *mut JSRuntime, client_point: Option>, - prev_mouse_over_target: &MutNullableJS) { + prev_mouse_over_target: &MutNullableDom) { let client_point = match client_point { None => { // If there's no point, there's no target under the mouse @@ -2264,7 +2264,7 @@ impl Document { //StyleSharedRwLock::new() }, stylesheets: DOMRefCell::new(StylesheetSet::new()), - stylesheet_list: MutNullableJS::new(None), + stylesheet_list: MutNullableDom::new(None), ready_state: Cell::new(ready_state), domcontentloaded_dispatched: Cell::new(domcontentloaded_dispatched), possibly_focused: Default::default(), @@ -2299,12 +2299,12 @@ impl Document { origin: origin, referrer: referrer, referrer_policy: Cell::new(referrer_policy), - target_element: MutNullableJS::new(None), + target_element: MutNullableDom::new(None), last_click_info: DOMRefCell::new(None), ignore_destructive_writes_counter: Default::default(), spurious_animation_frames: Cell::new(0), dom_count: Cell::new(1), - fullscreen_element: MutNullableJS::new(None), + fullscreen_element: MutNullableDom::new(None), form_id_listener_map: Default::default(), } } diff --git a/components/script/dom/element.rs b/components/script/dom/element.rs index 03c09c36df82..66c1ac9cbb1c 100644 --- a/components/script/dom/element.rs +++ b/components/script/dom/element.rs @@ -24,7 +24,7 @@ use dom::bindings::error::{Error, ErrorResult, Fallible}; use dom::bindings::inheritance::{Castable, ElementTypeId, HTMLElementTypeId, NodeTypeId}; use dom::bindings::refcounted::{Trusted, TrustedPromise}; use dom::bindings::reflector::DomObject; -use dom::bindings::root::{Dom, LayoutJS, MutNullableJS, Root, RootedReference}; +use dom::bindings::root::{Dom, LayoutJS, MutNullableDom, Root, RootedReference}; use dom::bindings::str::DOMString; use dom::bindings::xmlname::{namespace_from_domstring, validate_and_extract, xml_name_type}; use dom::bindings::xmlname::XMLName::InvalidXMLName; @@ -136,8 +136,8 @@ pub struct Element { is: DOMRefCell>, #[ignore_heap_size_of = "Arc"] style_attribute: DOMRefCell>>>, - attr_list: MutNullableJS, - class_list: MutNullableJS, + attr_list: MutNullableDom, + class_list: MutNullableDom, state: Cell, /// These flags are set by the style system to indicate the that certain /// operations may require restyling this element or its descendants. The diff --git a/components/script/dom/event.rs b/components/script/dom/event.rs index 58c4a503c8e5..c00ed9a00119 100644 --- a/components/script/dom/event.rs +++ b/components/script/dom/event.rs @@ -11,7 +11,7 @@ use dom::bindings::error::Fallible; use dom::bindings::inheritance::Castable; use dom::bindings::refcounted::Trusted; use dom::bindings::reflector::{DomObject, Reflector, reflect_dom_object}; -use dom::bindings::root::{Dom, MutNullableJS, Root, RootedReference}; +use dom::bindings::root::{Dom, MutNullableDom, Root, RootedReference}; use dom::bindings::str::DOMString; use dom::document::Document; use dom::eventtarget::{CompiledEventListener, EventTarget, ListenerPhase}; @@ -29,8 +29,8 @@ use time; #[dom_struct] pub struct Event { reflector_: Reflector, - current_target: MutNullableJS, - target: MutNullableJS, + current_target: MutNullableDom, + target: MutNullableDom, type_: DOMRefCell, phase: Cell, canceled: Cell, diff --git a/components/script/dom/filereader.rs b/components/script/dom/filereader.rs index 6e72249748fc..2e5721cc9100 100644 --- a/components/script/dom/filereader.rs +++ b/components/script/dom/filereader.rs @@ -11,7 +11,7 @@ use dom::bindings::error::{Error, ErrorResult, Fallible}; use dom::bindings::inheritance::Castable; use dom::bindings::refcounted::Trusted; use dom::bindings::reflector::{DomObject, reflect_dom_object}; -use dom::bindings::root::{MutNullableJS, Root}; +use dom::bindings::root::{MutNullableDom, Root}; use dom::bindings::str::DOMString; use dom::bindings::trace::RootedTraceableBox; use dom::blob::Blob; @@ -87,7 +87,7 @@ pub enum FileReaderResult { pub struct FileReader { eventtarget: EventTarget, ready_state: Cell, - error: MutNullableJS, + error: MutNullableDom, result: DOMRefCell>, generation_id: Cell, } @@ -97,7 +97,7 @@ impl FileReader { FileReader { eventtarget: EventTarget::new_inherited(), ready_state: Cell::new(FileReaderReadyState::Empty), - error: MutNullableJS::new(None), + error: MutNullableDom::new(None), result: DOMRefCell::new(None), generation_id: Cell::new(GenerationId(0)), } diff --git a/components/script/dom/focusevent.rs b/components/script/dom/focusevent.rs index 0dbf3fc2f1e7..10d78227aa24 100644 --- a/components/script/dom/focusevent.rs +++ b/components/script/dom/focusevent.rs @@ -8,7 +8,7 @@ use dom::bindings::codegen::Bindings::UIEventBinding::UIEventMethods; use dom::bindings::error::Fallible; use dom::bindings::inheritance::Castable; use dom::bindings::reflector::reflect_dom_object; -use dom::bindings::root::{MutNullableJS, Root, RootedReference}; +use dom::bindings::root::{MutNullableDom, Root, RootedReference}; use dom::bindings::str::DOMString; use dom::event::{EventBubbles, EventCancelable}; use dom::eventtarget::EventTarget; @@ -20,7 +20,7 @@ use std::default::Default; #[dom_struct] pub struct FocusEvent { uievent: UIEvent, - related_target: MutNullableJS, + related_target: MutNullableDom, } impl FocusEvent { diff --git a/components/script/dom/globalscope.rs b/components/script/dom/globalscope.rs index 16e47e0396f0..e9854d4f991e 100644 --- a/components/script/dom/globalscope.rs +++ b/components/script/dom/globalscope.rs @@ -10,7 +10,7 @@ use dom::bindings::conversions::root_from_object; use dom::bindings::error::{ErrorInfo, report_pending_exception}; use dom::bindings::inheritance::Castable; use dom::bindings::reflector::DomObject; -use dom::bindings::root::{MutNullableJS, Root}; +use dom::bindings::root::{MutNullableDom, Root}; use dom::bindings::settings_stack::{AutoEntryScript, entry_global, incumbent_global}; use dom::bindings::str::DOMString; use dom::crypto::Crypto; @@ -58,7 +58,7 @@ use timers::{OneshotTimers, TimerCallback}; #[dom_struct] pub struct GlobalScope { eventtarget: EventTarget, - crypto: MutNullableJS, + crypto: MutNullableDom, next_worker_id: Cell, /// Pipeline id associated with this global. diff --git a/components/script/dom/htmlanchorelement.rs b/components/script/dom/htmlanchorelement.rs index 05065e078063..bd363e316c68 100644 --- a/components/script/dom/htmlanchorelement.rs +++ b/components/script/dom/htmlanchorelement.rs @@ -11,7 +11,7 @@ use dom::bindings::codegen::Bindings::HTMLAnchorElementBinding::HTMLAnchorElemen use dom::bindings::codegen::Bindings::MouseEventBinding::MouseEventMethods; use dom::bindings::codegen::Bindings::NodeBinding::NodeMethods; use dom::bindings::inheritance::Castable; -use dom::bindings::root::{MutNullableJS, Root}; +use dom::bindings::root::{MutNullableDom, Root}; use dom::bindings::str::{DOMString, USVString}; use dom::document::Document; use dom::domtokenlist::DOMTokenList; @@ -37,7 +37,7 @@ use style::attr::AttrValue; #[dom_struct] pub struct HTMLAnchorElement { htmlelement: HTMLElement, - rel_list: MutNullableJS, + rel_list: MutNullableDom, url: DOMRefCell>, } diff --git a/components/script/dom/htmlareaelement.rs b/components/script/dom/htmlareaelement.rs index 531752ac8f92..2ea9dfa40066 100644 --- a/components/script/dom/htmlareaelement.rs +++ b/components/script/dom/htmlareaelement.rs @@ -7,7 +7,7 @@ use dom::bindings::codegen::Bindings::DOMTokenListBinding::DOMTokenListMethods; use dom::bindings::codegen::Bindings::HTMLAreaElementBinding; use dom::bindings::codegen::Bindings::HTMLAreaElementBinding::HTMLAreaElementMethods; use dom::bindings::inheritance::Castable; -use dom::bindings::root::{MutNullableJS, Root}; +use dom::bindings::root::{MutNullableDom, Root}; use dom::bindings::str::DOMString; use dom::document::Document; use dom::domtokenlist::DOMTokenList; @@ -217,7 +217,7 @@ impl Area { #[dom_struct] pub struct HTMLAreaElement { htmlelement: HTMLElement, - rel_list: MutNullableJS, + rel_list: MutNullableDom, } impl HTMLAreaElement { diff --git a/components/script/dom/htmlbuttonelement.rs b/components/script/dom/htmlbuttonelement.rs index 00aec8d5f2d4..37997c93702c 100755 --- a/components/script/dom/htmlbuttonelement.rs +++ b/components/script/dom/htmlbuttonelement.rs @@ -7,7 +7,7 @@ use dom::attr::Attr; use dom::bindings::codegen::Bindings::HTMLButtonElementBinding; use dom::bindings::codegen::Bindings::HTMLButtonElementBinding::HTMLButtonElementMethods; use dom::bindings::inheritance::Castable; -use dom::bindings::root::{MutNullableJS, Root}; +use dom::bindings::root::{MutNullableDom, Root}; use dom::bindings::str::DOMString; use dom::document::Document; use dom::element::{AttributeMutation, Element}; @@ -42,7 +42,7 @@ enum ButtonType { pub struct HTMLButtonElement { htmlelement: HTMLElement, button_type: Cell, - form_owner: MutNullableJS, + form_owner: MutNullableDom, } impl HTMLButtonElement { diff --git a/components/script/dom/htmlcollection.rs b/components/script/dom/htmlcollection.rs index c99e794a0e5b..dd8a62617db4 100644 --- a/components/script/dom/htmlcollection.rs +++ b/components/script/dom/htmlcollection.rs @@ -6,7 +6,7 @@ use dom::bindings::codegen::Bindings::HTMLCollectionBinding; use dom::bindings::codegen::Bindings::HTMLCollectionBinding::HTMLCollectionMethods; use dom::bindings::inheritance::Castable; use dom::bindings::reflector::{Reflector, reflect_dom_object}; -use dom::bindings::root::{Dom, Root, MutNullableJS}; +use dom::bindings::root::{Dom, Root, MutNullableDom}; use dom::bindings::str::DOMString; use dom::bindings::trace::JSTraceable; use dom::bindings::xmlname::namespace_from_domstring; @@ -60,7 +60,7 @@ pub struct HTMLCollection { // the length of the collection, and a cursor into the collection. // FIXME: make the cached cursor element a weak pointer cached_version: Cell, - cached_cursor_element: MutNullableJS, + cached_cursor_element: MutNullableDom, cached_cursor_index: Cell, cached_length: Cell, } @@ -74,7 +74,7 @@ impl HTMLCollection { filter: filter, // Default values for the cache cached_version: Cell::new(root.inclusive_descendants_version()), - cached_cursor_element: MutNullableJS::new(None), + cached_cursor_element: MutNullableDom::new(None), cached_cursor_index: Cell::new(OptionU32::none()), cached_length: Cell::new(OptionU32::none()), } diff --git a/components/script/dom/htmlelement.rs b/components/script/dom/htmlelement.rs index 946696863dc6..7890cc5fa895 100644 --- a/components/script/dom/htmlelement.rs +++ b/components/script/dom/htmlelement.rs @@ -12,7 +12,7 @@ use dom::bindings::codegen::Bindings::WindowBinding::WindowMethods; use dom::bindings::error::{Error, ErrorResult}; use dom::bindings::inheritance::{ElementTypeId, HTMLElementTypeId, NodeTypeId}; use dom::bindings::inheritance::Castable; -use dom::bindings::root::{Dom, MutNullableJS, Root, RootedReference}; +use dom::bindings::root::{Dom, MutNullableDom, Root, RootedReference}; use dom::bindings::str::DOMString; use dom::cssstyledeclaration::{CSSModificationAccess, CSSStyleDeclaration, CSSStyleOwner}; use dom::document::{Document, FocusType}; @@ -39,8 +39,8 @@ use style::element_state::*; #[dom_struct] pub struct HTMLElement { element: Element, - style_decl: MutNullableJS, - dataset: MutNullableJS, + style_decl: MutNullableDom, + dataset: MutNullableDom, } impl HTMLElement { diff --git a/components/script/dom/htmlfieldsetelement.rs b/components/script/dom/htmlfieldsetelement.rs index 37187c6def56..e935169c244b 100644 --- a/components/script/dom/htmlfieldsetelement.rs +++ b/components/script/dom/htmlfieldsetelement.rs @@ -6,7 +6,7 @@ use dom::attr::Attr; use dom::bindings::codegen::Bindings::HTMLFieldSetElementBinding; use dom::bindings::codegen::Bindings::HTMLFieldSetElementBinding::HTMLFieldSetElementMethods; use dom::bindings::inheritance::{Castable, ElementTypeId, HTMLElementTypeId, NodeTypeId}; -use dom::bindings::root::{MutNullableJS, Root}; +use dom::bindings::root::{MutNullableDom, Root}; use dom::document::Document; use dom::element::{AttributeMutation, Element}; use dom::htmlcollection::{CollectionFilter, HTMLCollection}; @@ -24,7 +24,7 @@ use style::element_state::*; #[dom_struct] pub struct HTMLFieldSetElement { htmlelement: HTMLElement, - form_owner: MutNullableJS, + form_owner: MutNullableDom, } impl HTMLFieldSetElement { diff --git a/components/script/dom/htmliframeelement.rs b/components/script/dom/htmliframeelement.rs index cbff0beacc44..8e71609a4513 100644 --- a/components/script/dom/htmliframeelement.rs +++ b/components/script/dom/htmliframeelement.rs @@ -21,7 +21,7 @@ use dom::bindings::error::{Error, ErrorResult, Fallible}; use dom::bindings::inheritance::Castable; use dom::bindings::refcounted::Trusted; use dom::bindings::reflector::DomObject; -use dom::bindings::root::{LayoutJS, MutNullableJS, Root}; +use dom::bindings::root::{LayoutJS, MutNullableDom, Root}; use dom::bindings::str::DOMString; use dom::customevent::CustomEvent; use dom::document::Document; @@ -88,7 +88,7 @@ pub struct HTMLIFrameElement { browsing_context_id: Cell>, pipeline_id: Cell>, pending_pipeline_id: Cell>, - sandbox: MutNullableJS, + sandbox: MutNullableDom, sandbox_allowance: Cell>, load_blocker: DOMRefCell>, visibility: Cell, diff --git a/components/script/dom/htmlimageelement.rs b/components/script/dom/htmlimageelement.rs index 48cb34d1a988..89873ffc4d84 100644 --- a/components/script/dom/htmlimageelement.rs +++ b/components/script/dom/htmlimageelement.rs @@ -17,7 +17,7 @@ use dom::bindings::error::Fallible; use dom::bindings::inheritance::Castable; use dom::bindings::refcounted::Trusted; use dom::bindings::reflector::DomObject; -use dom::bindings::root::{LayoutJS, MutNullableJS, Root}; +use dom::bindings::root::{LayoutJS, MutNullableDom, Root}; use dom::bindings::str::DOMString; use dom::document::Document; use dom::element::{AttributeMutation, Element, RawLayoutElementHelpers}; @@ -89,7 +89,7 @@ pub struct HTMLImageElement { image_request: Cell, current_request: DOMRefCell, pending_request: DOMRefCell, - form_owner: MutNullableJS, + form_owner: MutNullableDom, generation: Cell, } diff --git a/components/script/dom/htmlinputelement.rs b/components/script/dom/htmlinputelement.rs index 2cb872e4908f..bd714509dda9 100755 --- a/components/script/dom/htmlinputelement.rs +++ b/components/script/dom/htmlinputelement.rs @@ -15,7 +15,7 @@ use dom::bindings::codegen::Bindings::MouseEventBinding::MouseEventMethods; use dom::bindings::codegen::Bindings::WindowBinding::WindowMethods; use dom::bindings::error::{Error, ErrorResult}; use dom::bindings::inheritance::Castable; -use dom::bindings::root::{Dom, LayoutJS, MutNullableJS, Root, RootedReference}; +use dom::bindings::root::{Dom, LayoutJS, MutNullableDom, Root, RootedReference}; use dom::bindings::str::DOMString; use dom::document::Document; use dom::element::{AttributeMutation, Element, LayoutElementHelpers, RawLayoutElementHelpers}; @@ -99,8 +99,8 @@ pub struct HTMLInputElement { // https://html.spec.whatwg.org/multipage/#concept-input-value-dirty-flag value_dirty: Cell, - filelist: MutNullableJS, - form_owner: MutNullableJS, + filelist: MutNullableDom, + form_owner: MutNullableDom, } #[derive(JSTraceable)] @@ -156,7 +156,7 @@ impl HTMLInputElement { SelectionDirection::None)), activation_state: DOMRefCell::new(InputActivationState::new()), value_dirty: Cell::new(false), - filelist: MutNullableJS::new(None), + filelist: MutNullableDom::new(None), form_owner: Default::default(), } } diff --git a/components/script/dom/htmllegendelement.rs b/components/script/dom/htmllegendelement.rs index ad51e0cb6522..010e80c22eef 100644 --- a/components/script/dom/htmllegendelement.rs +++ b/components/script/dom/htmllegendelement.rs @@ -6,7 +6,7 @@ use dom::bindings::codegen::Bindings::HTMLLegendElementBinding; use dom::bindings::codegen::Bindings::HTMLLegendElementBinding::HTMLLegendElementMethods; use dom::bindings::codegen::Bindings::NodeBinding::NodeMethods; use dom::bindings::inheritance::Castable; -use dom::bindings::root::{MutNullableJS, Root}; +use dom::bindings::root::{MutNullableDom, Root}; use dom::document::Document; use dom::element::Element; use dom::htmlelement::HTMLElement; @@ -20,7 +20,7 @@ use html5ever::{LocalName, Prefix}; #[dom_struct] pub struct HTMLLegendElement { htmlelement: HTMLElement, - form_owner: MutNullableJS, + form_owner: MutNullableDom, } impl HTMLLegendElement { diff --git a/components/script/dom/htmllinkelement.rs b/components/script/dom/htmllinkelement.rs index 814c6b94bd49..b229e331ed62 100644 --- a/components/script/dom/htmllinkelement.rs +++ b/components/script/dom/htmllinkelement.rs @@ -9,7 +9,7 @@ use dom::bindings::codegen::Bindings::DOMTokenListBinding::DOMTokenListBinding:: use dom::bindings::codegen::Bindings::HTMLLinkElementBinding; use dom::bindings::codegen::Bindings::HTMLLinkElementBinding::HTMLLinkElementMethods; use dom::bindings::inheritance::Castable; -use dom::bindings::root::{MutNullableJS, Root, RootedReference}; +use dom::bindings::root::{MutNullableDom, Root, RootedReference}; use dom::bindings::str::DOMString; use dom::cssstylesheet::CSSStyleSheet; use dom::document::Document; @@ -50,10 +50,10 @@ impl RequestGenerationId { #[dom_struct] pub struct HTMLLinkElement { htmlelement: HTMLElement, - rel_list: MutNullableJS, + rel_list: MutNullableDom, #[ignore_heap_size_of = "Arc"] stylesheet: DOMRefCell>>, - cssom_stylesheet: MutNullableJS, + cssom_stylesheet: MutNullableDom, /// https://html.spec.whatwg.org/multipage/#a-style-sheet-that-is-blocking-scripts parser_inserted: Cell, @@ -74,7 +74,7 @@ impl HTMLLinkElement { rel_list: Default::default(), parser_inserted: Cell::new(creator.is_parser_created()), stylesheet: DOMRefCell::new(None), - cssom_stylesheet: MutNullableJS::new(None), + cssom_stylesheet: MutNullableDom::new(None), pending_loads: Cell::new(0), any_failed_load: Cell::new(false), request_generation_id: Cell::new(RequestGenerationId(0)), diff --git a/components/script/dom/htmlmediaelement.rs b/components/script/dom/htmlmediaelement.rs index cadde0b2073a..81708864742f 100644 --- a/components/script/dom/htmlmediaelement.rs +++ b/components/script/dom/htmlmediaelement.rs @@ -18,7 +18,7 @@ use dom::bindings::error::{Error, ErrorResult}; use dom::bindings::inheritance::Castable; use dom::bindings::refcounted::Trusted; use dom::bindings::reflector::DomObject; -use dom::bindings::root::{MutNullableJS, Root}; +use dom::bindings::root::{MutNullableDom, Root}; use dom::bindings::str::DOMString; use dom::document::Document; use dom::element::{Element, AttributeMutation}; @@ -66,7 +66,7 @@ pub struct HTMLMediaElement { /// Reset to false every time the load algorithm is invoked. fired_loadeddata_event: Cell, /// https://html.spec.whatwg.org/multipage/#dom-media-error - error: MutNullableJS, + error: MutNullableDom, /// https://html.spec.whatwg.org/multipage/#dom-media-paused paused: Cell, /// https://html.spec.whatwg.org/multipage/#attr-media-autoplay diff --git a/components/script/dom/htmlmetaelement.rs b/components/script/dom/htmlmetaelement.rs index 09443824b70e..41ae52a1b4c3 100644 --- a/components/script/dom/htmlmetaelement.rs +++ b/components/script/dom/htmlmetaelement.rs @@ -8,7 +8,7 @@ use dom::bindings::codegen::Bindings::HTMLMetaElementBinding; use dom::bindings::codegen::Bindings::HTMLMetaElementBinding::HTMLMetaElementMethods; use dom::bindings::codegen::Bindings::NodeBinding::NodeMethods; use dom::bindings::inheritance::Castable; -use dom::bindings::root::{MutNullableJS, Root, RootedReference}; +use dom::bindings::root::{MutNullableDom, Root, RootedReference}; use dom::bindings::str::DOMString; use dom::cssstylesheet::CSSStyleSheet; use dom::document::Document; @@ -34,7 +34,7 @@ pub struct HTMLMetaElement { htmlelement: HTMLElement, #[ignore_heap_size_of = "Arc"] stylesheet: DOMRefCell>>, - cssom_stylesheet: MutNullableJS, + cssom_stylesheet: MutNullableDom, } impl HTMLMetaElement { @@ -44,7 +44,7 @@ impl HTMLMetaElement { HTMLMetaElement { htmlelement: HTMLElement::new_inherited(local_name, prefix, document), stylesheet: DOMRefCell::new(None), - cssom_stylesheet: MutNullableJS::new(None), + cssom_stylesheet: MutNullableDom::new(None), } } diff --git a/components/script/dom/htmlobjectelement.rs b/components/script/dom/htmlobjectelement.rs index bfab288a9cf8..121dde5d2ae8 100755 --- a/components/script/dom/htmlobjectelement.rs +++ b/components/script/dom/htmlobjectelement.rs @@ -7,7 +7,7 @@ use dom::bindings::cell::DOMRefCell; use dom::bindings::codegen::Bindings::HTMLObjectElementBinding; use dom::bindings::codegen::Bindings::HTMLObjectElementBinding::HTMLObjectElementMethods; use dom::bindings::inheritance::Castable; -use dom::bindings::root::{MutNullableJS, Root}; +use dom::bindings::root::{MutNullableDom, Root}; use dom::bindings::str::DOMString; use dom::document::Document; use dom::element::{AttributeMutation, Element}; @@ -28,7 +28,7 @@ pub struct HTMLObjectElement { htmlelement: HTMLElement, #[ignore_heap_size_of = "Arc"] image: DOMRefCell>>, - form_owner: MutNullableJS, + form_owner: MutNullableDom, } impl HTMLObjectElement { diff --git a/components/script/dom/htmloutputelement.rs b/components/script/dom/htmloutputelement.rs index 510235e617aa..2a52cfabcaab 100644 --- a/components/script/dom/htmloutputelement.rs +++ b/components/script/dom/htmloutputelement.rs @@ -6,7 +6,7 @@ use dom::attr::Attr; use dom::bindings::codegen::Bindings::HTMLOutputElementBinding; use dom::bindings::codegen::Bindings::HTMLOutputElementBinding::HTMLOutputElementMethods; use dom::bindings::inheritance::Castable; -use dom::bindings::root::{MutNullableJS, Root}; +use dom::bindings::root::{MutNullableDom, Root}; use dom::document::Document; use dom::element::{AttributeMutation, Element}; use dom::htmlelement::HTMLElement; @@ -21,7 +21,7 @@ use html5ever::{LocalName, Prefix}; #[dom_struct] pub struct HTMLOutputElement { htmlelement: HTMLElement, - form_owner: MutNullableJS, + form_owner: MutNullableDom, } impl HTMLOutputElement { diff --git a/components/script/dom/htmlselectelement.rs b/components/script/dom/htmlselectelement.rs index 641a88178149..73238870e480 100755 --- a/components/script/dom/htmlselectelement.rs +++ b/components/script/dom/htmlselectelement.rs @@ -14,7 +14,7 @@ use dom::bindings::codegen::UnionTypes::HTMLElementOrLong; use dom::bindings::codegen::UnionTypes::HTMLOptionElementOrHTMLOptGroupElement; //use dom::bindings::error::ErrorResult; use dom::bindings::inheritance::Castable; -use dom::bindings::root::{MutNullableJS, Root}; +use dom::bindings::root::{MutNullableDom, Root}; use dom::bindings::str::DOMString; use dom::document::Document; use dom::element::{AttributeMutation, Element}; @@ -61,8 +61,8 @@ impl CollectionFilter for OptionsFilter { #[dom_struct] pub struct HTMLSelectElement { htmlelement: HTMLElement, - options: MutNullableJS, - form_owner: MutNullableJS, + options: MutNullableDom, + form_owner: MutNullableDom, } static DEFAULT_SELECT_SIZE: u32 = 0; diff --git a/components/script/dom/htmlstyleelement.rs b/components/script/dom/htmlstyleelement.rs index cfe0651df28f..a66ede9c930b 100644 --- a/components/script/dom/htmlstyleelement.rs +++ b/components/script/dom/htmlstyleelement.rs @@ -8,7 +8,7 @@ use dom::bindings::codegen::Bindings::HTMLStyleElementBinding; use dom::bindings::codegen::Bindings::HTMLStyleElementBinding::HTMLStyleElementMethods; use dom::bindings::codegen::Bindings::NodeBinding::NodeMethods; use dom::bindings::inheritance::Castable; -use dom::bindings::root::{MutNullableJS, Root}; +use dom::bindings::root::{MutNullableDom, Root}; use dom::cssstylesheet::CSSStyleSheet; use dom::document::Document; use dom::element::{Element, ElementCreator}; @@ -33,7 +33,7 @@ pub struct HTMLStyleElement { htmlelement: HTMLElement, #[ignore_heap_size_of = "Arc"] stylesheet: DOMRefCell>>, - cssom_stylesheet: MutNullableJS, + cssom_stylesheet: MutNullableDom, /// https://html.spec.whatwg.org/multipage/#a-style-sheet-that-is-blocking-scripts parser_inserted: Cell, in_stack_of_open_elements: Cell, @@ -50,7 +50,7 @@ impl HTMLStyleElement { HTMLStyleElement { htmlelement: HTMLElement::new_inherited(local_name, prefix, document), stylesheet: DOMRefCell::new(None), - cssom_stylesheet: MutNullableJS::new(None), + cssom_stylesheet: MutNullableDom::new(None), parser_inserted: Cell::new(creator.is_parser_created()), in_stack_of_open_elements: Cell::new(creator.is_parser_created()), pending_loads: Cell::new(0), diff --git a/components/script/dom/htmltableelement.rs b/components/script/dom/htmltableelement.rs index 5e9a80f07904..25069647f6c2 100644 --- a/components/script/dom/htmltableelement.rs +++ b/components/script/dom/htmltableelement.rs @@ -10,7 +10,7 @@ use dom::bindings::codegen::Bindings::HTMLTableElementBinding::HTMLTableElementM use dom::bindings::codegen::Bindings::NodeBinding::NodeMethods; use dom::bindings::error::{Error, ErrorResult, Fallible}; use dom::bindings::inheritance::Castable; -use dom::bindings::root::{Dom, LayoutJS, MutNullableJS, Root, RootedReference}; +use dom::bindings::root::{Dom, LayoutJS, MutNullableDom, Root, RootedReference}; use dom::bindings::str::DOMString; use dom::document::Document; use dom::element::{AttributeMutation, Element, RawLayoutElementHelpers}; @@ -32,7 +32,7 @@ pub struct HTMLTableElement { htmlelement: HTMLElement, border: Cell>, cellspacing: Cell>, - tbodies: MutNullableJS, + tbodies: MutNullableDom, } #[allow(unrooted_must_root)] diff --git a/components/script/dom/htmltablerowelement.rs b/components/script/dom/htmltablerowelement.rs index c56c7ae7add7..78246d4444cc 100644 --- a/components/script/dom/htmltablerowelement.rs +++ b/components/script/dom/htmltablerowelement.rs @@ -9,7 +9,7 @@ use dom::bindings::codegen::Bindings::HTMLTableSectionElementBinding::HTMLTableS use dom::bindings::codegen::Bindings::NodeBinding::NodeMethods; use dom::bindings::error::{ErrorResult, Fallible}; use dom::bindings::inheritance::Castable; -use dom::bindings::root::{LayoutJS, MutNullableJS, Root, RootedReference}; +use dom::bindings::root::{LayoutJS, MutNullableDom, Root, RootedReference}; use dom::bindings::str::DOMString; use dom::document::Document; use dom::element::{Element, RawLayoutElementHelpers}; @@ -37,7 +37,7 @@ impl CollectionFilter for CellsFilter { #[dom_struct] pub struct HTMLTableRowElement { htmlelement: HTMLElement, - cells: MutNullableJS, + cells: MutNullableDom, } impl HTMLTableRowElement { diff --git a/components/script/dom/htmltemplateelement.rs b/components/script/dom/htmltemplateelement.rs index ec46955db7e6..5f345206a949 100644 --- a/components/script/dom/htmltemplateelement.rs +++ b/components/script/dom/htmltemplateelement.rs @@ -7,7 +7,7 @@ use dom::bindings::codegen::Bindings::HTMLTemplateElementBinding; use dom::bindings::codegen::Bindings::HTMLTemplateElementBinding::HTMLTemplateElementMethods; use dom::bindings::codegen::Bindings::NodeBinding::NodeMethods; use dom::bindings::inheritance::Castable; -use dom::bindings::root::{MutNullableJS, Root}; +use dom::bindings::root::{MutNullableDom, Root}; use dom::document::Document; use dom::documentfragment::DocumentFragment; use dom::htmlelement::HTMLElement; @@ -21,7 +21,7 @@ pub struct HTMLTemplateElement { htmlelement: HTMLElement, /// https://html.spec.whatwg.org/multipage/#template-contents - contents: MutNullableJS, + contents: MutNullableDom, } impl HTMLTemplateElement { @@ -31,7 +31,7 @@ impl HTMLTemplateElement { HTMLTemplateElement { htmlelement: HTMLElement::new_inherited(local_name, prefix, document), - contents: MutNullableJS::new(None), + contents: MutNullableDom::new(None), } } diff --git a/components/script/dom/htmltextareaelement.rs b/components/script/dom/htmltextareaelement.rs index 9c050f0790fc..4958d2d3ca9f 100755 --- a/components/script/dom/htmltextareaelement.rs +++ b/components/script/dom/htmltextareaelement.rs @@ -9,7 +9,7 @@ use dom::bindings::codegen::Bindings::HTMLTextAreaElementBinding; use dom::bindings::codegen::Bindings::HTMLTextAreaElementBinding::HTMLTextAreaElementMethods; use dom::bindings::codegen::Bindings::NodeBinding::NodeMethods; use dom::bindings::inheritance::Castable; -use dom::bindings::root::{LayoutJS, MutNullableJS, Root}; +use dom::bindings::root::{LayoutJS, MutNullableDom, Root}; use dom::bindings::str::DOMString; use dom::document::Document; use dom::element::{AttributeMutation, Element}; @@ -43,7 +43,7 @@ pub struct HTMLTextAreaElement { placeholder: DOMRefCell, // https://html.spec.whatwg.org/multipage/#concept-textarea-dirty value_changed: Cell, - form_owner: MutNullableJS, + form_owner: MutNullableDom, } pub trait LayoutHTMLTextAreaElementHelpers { diff --git a/components/script/dom/mod.rs b/components/script/dom/mod.rs index 7c683edf9eb9..b14cca5f8202 100644 --- a/components/script/dom/mod.rs +++ b/components/script/dom/mod.rs @@ -32,7 +32,7 @@ //! * rooting pointers on the stack: //! the [`Root`](bindings/root/struct.Root.html) smart pointer; //! * tracing pointers in member fields: the [`Dom`](bindings/root/struct.Dom.html), -//! [`MutNullableJS`](bindings/root/struct.MutNullableJS.html) and +//! [`MutNullableDom`](bindings/root/struct.MutNullableDom.html) and //! [`MutDom`](bindings/root/struct.MutDom.html) smart pointers and //! [the tracing implementation](bindings/trace/index.html); //! * rooting pointers from across thread boundaries or in channels: the diff --git a/components/script/dom/mouseevent.rs b/components/script/dom/mouseevent.rs index 049a92c8308e..e3f4cdab91de 100644 --- a/components/script/dom/mouseevent.rs +++ b/components/script/dom/mouseevent.rs @@ -8,7 +8,7 @@ use dom::bindings::codegen::Bindings::UIEventBinding::UIEventMethods; use dom::bindings::error::Fallible; use dom::bindings::inheritance::Castable; use dom::bindings::reflector::reflect_dom_object; -use dom::bindings::root::{MutNullableJS, Root, RootedReference}; +use dom::bindings::root::{MutNullableDom, Root, RootedReference}; use dom::bindings::str::DOMString; use dom::event::{Event, EventBubbles, EventCancelable}; use dom::eventtarget::EventTarget; @@ -31,7 +31,7 @@ pub struct MouseEvent { alt_key: Cell, meta_key: Cell, button: Cell, - related_target: MutNullableJS, + related_target: MutNullableDom, } impl MouseEvent { diff --git a/components/script/dom/mutationrecord.rs b/components/script/dom/mutationrecord.rs index a5d21663b997..bbb42dd1f282 100644 --- a/components/script/dom/mutationrecord.rs +++ b/components/script/dom/mutationrecord.rs @@ -5,7 +5,7 @@ use dom::bindings::codegen::Bindings::MutationRecordBinding::MutationRecordBinding; use dom::bindings::codegen::Bindings::MutationRecordBinding::MutationRecordBinding::MutationRecordMethods; use dom::bindings::reflector::{Reflector, reflect_dom_object}; -use dom::bindings::root::{Dom, MutNullableJS, Root}; +use dom::bindings::root::{Dom, MutNullableDom, Root}; use dom::bindings::str::DOMString; use dom::node::{Node, window_from_node}; use dom::nodelist::NodeList; @@ -20,8 +20,8 @@ pub struct MutationRecord { attribute_name: Option, attribute_namespace: Option, old_value: Option, - added_nodes: MutNullableJS, - removed_nodes: MutNullableJS, + added_nodes: MutNullableDom, + removed_nodes: MutNullableDom, next_sibling: Option>, prev_sibling: Option>, } @@ -77,8 +77,8 @@ impl MutationRecord { attribute_name: attribute_name, attribute_namespace: attribute_namespace, old_value: old_value, - added_nodes: MutNullableJS::new(added_nodes), - removed_nodes: MutNullableJS::new(removed_nodes), + added_nodes: MutNullableDom::new(added_nodes), + removed_nodes: MutNullableDom::new(removed_nodes), next_sibling: next_sibling.map(Dom::from_ref), prev_sibling: prev_sibling.map(Dom::from_ref), } diff --git a/components/script/dom/navigator.rs b/components/script/dom/navigator.rs index dddac1bb5613..c24b4972e372 100644 --- a/components/script/dom/navigator.rs +++ b/components/script/dom/navigator.rs @@ -6,7 +6,7 @@ use dom::bindings::codegen::Bindings::NavigatorBinding; use dom::bindings::codegen::Bindings::NavigatorBinding::NavigatorMethods; use dom::bindings::codegen::Bindings::VRBinding::VRBinding::VRMethods; use dom::bindings::reflector::{Reflector, DomObject, reflect_dom_object}; -use dom::bindings::root::{MutNullableJS, Root}; +use dom::bindings::root::{MutNullableDom, Root}; use dom::bindings::str::DOMString; use dom::bluetooth::Bluetooth; use dom::gamepadlist::GamepadList; @@ -24,13 +24,13 @@ use std::rc::Rc; #[dom_struct] pub struct Navigator { reflector_: Reflector, - bluetooth: MutNullableJS, - plugins: MutNullableJS, - mime_types: MutNullableJS, - service_worker: MutNullableJS, - vr: MutNullableJS, - gamepads: MutNullableJS, - permissions: MutNullableJS, + bluetooth: MutNullableDom, + plugins: MutNullableDom, + mime_types: MutNullableDom, + service_worker: MutNullableDom, + vr: MutNullableDom, + gamepads: MutNullableDom, + permissions: MutNullableDom, } impl Navigator { diff --git a/components/script/dom/node.rs b/components/script/dom/node.rs index f3cf9728b727..2ce11daeb0f8 100644 --- a/components/script/dom/node.rs +++ b/components/script/dom/node.rs @@ -23,7 +23,7 @@ use dom::bindings::inheritance::{Castable, CharacterDataTypeId, ElementTypeId}; use dom::bindings::inheritance::{EventTargetTypeId, HTMLElementTypeId, NodeTypeId}; use dom::bindings::inheritance::{SVGElementTypeId, SVGGraphicsElementTypeId}; use dom::bindings::reflector::{DomObject, reflect_dom_object}; -use dom::bindings::root::{Dom, LayoutJS, MutNullableJS, Root, RootedReference}; +use dom::bindings::root::{Dom, LayoutJS, MutNullableDom, Root, RootedReference}; use dom::bindings::str::{DOMString, USVString}; use dom::bindings::xmlname::namespace_from_domstring; use dom::characterdata::{CharacterData, LayoutCharacterDataHelpers}; @@ -98,25 +98,25 @@ pub struct Node { eventtarget: EventTarget, /// The parent of this node. - parent_node: MutNullableJS, + parent_node: MutNullableDom, /// The first child of this node. - first_child: MutNullableJS, + first_child: MutNullableDom, /// The last child of this node. - last_child: MutNullableJS, + last_child: MutNullableDom, /// The next sibling of this node. - next_sibling: MutNullableJS, + next_sibling: MutNullableDom, /// The previous sibling of this node. - prev_sibling: MutNullableJS, + prev_sibling: MutNullableDom, /// The document that this node belongs to. - owner_doc: MutNullableJS, + owner_doc: MutNullableDom, /// The live list of children return by .childNodes. - child_list: MutNullableJS, + child_list: MutNullableDom, /// The live count of children of this node. children_count: Cell, @@ -1407,7 +1407,7 @@ impl Node { last_child: Default::default(), next_sibling: Default::default(), prev_sibling: Default::default(), - owner_doc: MutNullableJS::new(doc), + owner_doc: MutNullableDom::new(doc), child_list: Default::default(), children_count: Cell::new(0u32), flags: Cell::new(flags), diff --git a/components/script/dom/nodelist.rs b/components/script/dom/nodelist.rs index 14d1e533ef56..191cc1f30cda 100644 --- a/components/script/dom/nodelist.rs +++ b/components/script/dom/nodelist.rs @@ -6,7 +6,7 @@ use dom::bindings::codegen::Bindings::NodeBinding::NodeMethods; use dom::bindings::codegen::Bindings::NodeListBinding; use dom::bindings::codegen::Bindings::NodeListBinding::NodeListMethods; use dom::bindings::reflector::{Reflector, reflect_dom_object}; -use dom::bindings::root::{Dom, MutNullableJS, Root, RootedReference}; +use dom::bindings::root::{Dom, MutNullableDom, Root, RootedReference}; use dom::node::{ChildrenMutation, Node}; use dom::window::Window; use dom_struct::dom_struct; @@ -114,7 +114,7 @@ impl NodeList { pub struct ChildrenList { node: Dom, #[ignore_heap_size_of = "Defined in rust-mozjs"] - last_visited: MutNullableJS, + last_visited: MutNullableDom, last_index: Cell, } @@ -123,7 +123,7 @@ impl ChildrenList { let last_visited = node.GetFirstChild(); ChildrenList { node: Dom::from_ref(node), - last_visited: MutNullableJS::new(last_visited.r()), + last_visited: MutNullableDom::new(last_visited.r()), last_index: Cell::new(0u32), } } diff --git a/components/script/dom/request.rs b/components/script/dom/request.rs index 1225369cea59..1d9d20629d05 100644 --- a/components/script/dom/request.rs +++ b/components/script/dom/request.rs @@ -18,7 +18,7 @@ use dom::bindings::codegen::Bindings::RequestBinding::RequestRedirect; use dom::bindings::codegen::Bindings::RequestBinding::RequestType; use dom::bindings::error::{Error, Fallible}; use dom::bindings::reflector::{DomObject, Reflector, reflect_dom_object}; -use dom::bindings::root::{MutNullableJS, Root}; +use dom::bindings::root::{MutNullableDom, Root}; use dom::bindings::str::{ByteString, DOMString, USVString}; use dom::bindings::trace::RootedTraceableBox; use dom::globalscope::GlobalScope; @@ -46,7 +46,7 @@ pub struct Request { reflector_: Reflector, request: DOMRefCell, body_used: Cell, - headers: MutNullableJS, + headers: MutNullableDom, mime_type: DOMRefCell>, #[ignore_heap_size_of = "Rc"] body_promise: DOMRefCell, BodyType)>>, diff --git a/components/script/dom/response.rs b/components/script/dom/response.rs index 5d254b345256..55c942e88fc9 100644 --- a/components/script/dom/response.rs +++ b/components/script/dom/response.rs @@ -11,7 +11,7 @@ use dom::bindings::codegen::Bindings::ResponseBinding::{ResponseMethods, Respons use dom::bindings::codegen::Bindings::XMLHttpRequestBinding::BodyInit; use dom::bindings::error::{Error, Fallible}; use dom::bindings::reflector::{DomObject, Reflector, reflect_dom_object}; -use dom::bindings::root::{MutNullableJS, Root}; +use dom::bindings::root::{MutNullableDom, Root}; use dom::bindings::str::{ByteString, USVString}; use dom::globalscope::GlobalScope; use dom::headers::{Headers, Guard}; @@ -33,7 +33,7 @@ use url::Position; #[dom_struct] pub struct Response { reflector_: Reflector, - headers_reflector: MutNullableJS, + headers_reflector: MutNullableDom, mime_type: DOMRefCell>, body_used: Cell, /// `None` can be considered a StatusCode of `0`. diff --git a/components/script/dom/serviceworkercontainer.rs b/components/script/dom/serviceworkercontainer.rs index a322f618fa80..e4cb7c3a255e 100644 --- a/components/script/dom/serviceworkercontainer.rs +++ b/components/script/dom/serviceworkercontainer.rs @@ -6,7 +6,7 @@ use dom::bindings::codegen::Bindings::ServiceWorkerContainerBinding::{ServiceWor use dom::bindings::codegen::Bindings::ServiceWorkerContainerBinding::RegistrationOptions; use dom::bindings::error::Error; use dom::bindings::reflector::{DomObject, reflect_dom_object}; -use dom::bindings::root::{Dom, MutNullableJS, Root}; +use dom::bindings::root::{Dom, MutNullableDom, Root}; use dom::bindings::str::USVString; use dom::client::Client; use dom::eventtarget::EventTarget; @@ -23,7 +23,7 @@ use std::rc::Rc; #[dom_struct] pub struct ServiceWorkerContainer { eventtarget: EventTarget, - controller: MutNullableJS, + controller: MutNullableDom, client: Dom } diff --git a/components/script/dom/servoparser/mod.rs b/components/script/dom/servoparser/mod.rs index 92d3b8a894ed..0da5d9391d74 100644 --- a/components/script/dom/servoparser/mod.rs +++ b/components/script/dom/servoparser/mod.rs @@ -12,7 +12,7 @@ use dom::bindings::codegen::Bindings::ServoParserBinding; use dom::bindings::inheritance::Castable; use dom::bindings::refcounted::Trusted; use dom::bindings::reflector::{Reflector, reflect_dom_object}; -use dom::bindings::root::{Dom, MutNullableJS, Root, RootedReference}; +use dom::bindings::root::{Dom, MutNullableDom, Root, RootedReference}; use dom::bindings::str::DOMString; use dom::characterdata::CharacterData; use dom::comment::Comment; @@ -748,7 +748,7 @@ pub struct Sink { base_url: ServoUrl, document: Dom, current_line: u64, - script: MutNullableJS, + script: MutNullableDom, } #[allow(unrooted_must_root)] // FIXME: really? diff --git a/components/script/dom/storageevent.rs b/components/script/dom/storageevent.rs index 5fa2f5da9dce..f5f8bc5577f5 100644 --- a/components/script/dom/storageevent.rs +++ b/components/script/dom/storageevent.rs @@ -8,7 +8,7 @@ use dom::bindings::codegen::Bindings::StorageEventBinding::StorageEventMethods; use dom::bindings::error::Fallible; use dom::bindings::inheritance::Castable; use dom::bindings::reflector::reflect_dom_object; -use dom::bindings::root::{MutNullableJS, Root, RootedReference}; +use dom::bindings::root::{MutNullableDom, Root, RootedReference}; use dom::bindings::str::DOMString; use dom::event::{Event, EventBubbles, EventCancelable}; use dom::storage::Storage; @@ -23,7 +23,7 @@ pub struct StorageEvent { old_value: Option, new_value: Option, url: DOMString, - storage_area: MutNullableJS + storage_area: MutNullableDom } @@ -39,7 +39,7 @@ impl StorageEvent { old_value: old_value, new_value: new_value, url: url, - storage_area: MutNullableJS::new(storage_area) + storage_area: MutNullableDom::new(storage_area) } } diff --git a/components/script/dom/uievent.rs b/components/script/dom/uievent.rs index 2c17f4961f27..d799b979245a 100644 --- a/components/script/dom/uievent.rs +++ b/components/script/dom/uievent.rs @@ -8,7 +8,7 @@ use dom::bindings::codegen::Bindings::UIEventBinding::UIEventMethods; use dom::bindings::error::Fallible; use dom::bindings::inheritance::Castable; use dom::bindings::reflector::reflect_dom_object; -use dom::bindings::root::{MutNullableJS, Root, RootedReference}; +use dom::bindings::root::{MutNullableDom, Root, RootedReference}; use dom::bindings::str::DOMString; use dom::event::{Event, EventBubbles, EventCancelable}; use dom::window::Window; @@ -21,7 +21,7 @@ use std::default::Default; #[dom_struct] pub struct UIEvent { event: Event, - view: MutNullableJS, + view: MutNullableDom, detail: Cell } diff --git a/components/script/dom/url.rs b/components/script/dom/url.rs index b4d17fdc9b6d..b19d2337142f 100644 --- a/components/script/dom/url.rs +++ b/components/script/dom/url.rs @@ -6,7 +6,7 @@ use dom::bindings::cell::DOMRefCell; use dom::bindings::codegen::Bindings::URLBinding::{self, URLMethods}; use dom::bindings::error::{Error, ErrorResult, Fallible}; use dom::bindings::reflector::{DomObject, Reflector, reflect_dom_object}; -use dom::bindings::root::{MutNullableJS, Root}; +use dom::bindings::root::{MutNullableDom, Root}; use dom::bindings::str::{DOMString, USVString}; use dom::blob::Blob; use dom::globalscope::GlobalScope; @@ -30,7 +30,7 @@ pub struct URL { url: DOMRefCell, // https://url.spec.whatwg.org/#dom-url-searchparams - search_params: MutNullableJS, + search_params: MutNullableDom, } impl URL { diff --git a/components/script/dom/vrdisplay.rs b/components/script/dom/vrdisplay.rs index d6e8d480c3d3..c05ff88b19a7 100644 --- a/components/script/dom/vrdisplay.rs +++ b/components/script/dom/vrdisplay.rs @@ -18,7 +18,7 @@ use dom::bindings::inheritance::Castable; use dom::bindings::num::Finite; use dom::bindings::refcounted::Trusted; use dom::bindings::reflector::{DomObject, reflect_dom_object}; -use dom::bindings::root::{MutDom, MutNullableJS, Root}; +use dom::bindings::root::{MutDom, MutNullableDom, Root}; use dom::bindings::str::DOMString; use dom::event::Event; use dom::eventtarget::EventTarget; @@ -54,12 +54,12 @@ pub struct VRDisplay { left_eye_params: MutDom, right_eye_params: MutDom, capabilities: MutDom, - stage_params: MutNullableJS, + stage_params: MutNullableDom, #[ignore_heap_size_of = "Defined in rust-webvr"] frame_data: DOMRefCell, #[ignore_heap_size_of = "Defined in rust-webvr"] layer: DOMRefCell, - layer_ctx: MutNullableJS, + layer_ctx: MutNullableDom, #[ignore_heap_size_of = "Defined in rust-webvr"] next_raf_id: Cell, /// List of request animation frame callbacks @@ -103,10 +103,10 @@ impl VRDisplay { left_eye_params: MutDom::new(&*VREyeParameters::new(display.left_eye_parameters.clone(), &global)), right_eye_params: MutDom::new(&*VREyeParameters::new(display.right_eye_parameters.clone(), &global)), capabilities: MutDom::new(&*VRDisplayCapabilities::new(display.capabilities.clone(), &global)), - stage_params: MutNullableJS::new(stage.as_ref().map(|v| v.deref())), + stage_params: MutNullableDom::new(stage.as_ref().map(|v| v.deref())), frame_data: DOMRefCell::new(Default::default()), layer: DOMRefCell::new(Default::default()), - layer_ctx: MutNullableJS::default(), + layer_ctx: MutNullableDom::default(), next_raf_id: Cell::new(1), raf_callback_list: DOMRefCell::new(vec![]), frame_data_status: Cell::new(VRFrameDataStatus::Waiting), diff --git a/components/script/dom/webgl_extensions/ext/oesvertexarrayobject.rs b/components/script/dom/webgl_extensions/ext/oesvertexarrayobject.rs index f7414bcbb1b5..00c9d1abdda0 100644 --- a/components/script/dom/webgl_extensions/ext/oesvertexarrayobject.rs +++ b/components/script/dom/webgl_extensions/ext/oesvertexarrayobject.rs @@ -6,7 +6,7 @@ use canvas_traits::webgl::{webgl_channel, WebGLCommand, WebGLError}; use dom::bindings::codegen::Bindings::OESVertexArrayObjectBinding::{self, OESVertexArrayObjectMethods}; use dom::bindings::codegen::Bindings::OESVertexArrayObjectBinding::OESVertexArrayObjectConstants; use dom::bindings::reflector::{DomObject, Reflector, reflect_dom_object}; -use dom::bindings::root::{Dom, MutNullableJS, Root}; +use dom::bindings::root::{Dom, MutNullableDom, Root}; use dom::webglrenderingcontext::WebGLRenderingContext; use dom::webglvertexarrayobjectoes::WebGLVertexArrayObjectOES; use dom_struct::dom_struct; @@ -20,7 +20,7 @@ use super::{WebGLExtension, WebGLExtensions}; pub struct OESVertexArrayObject { reflector_: Reflector, ctx: Dom, - bound_vao: MutNullableJS, + bound_vao: MutNullableDom, } impl OESVertexArrayObject { @@ -28,7 +28,7 @@ impl OESVertexArrayObject { Self { reflector_: Reflector::new(), ctx: Dom::from_ref(ctx), - bound_vao: MutNullableJS::new(None) + bound_vao: MutNullableDom::new(None) } } diff --git a/components/script/dom/webgl_extensions/ext/webglvertexarrayobjectoes.rs b/components/script/dom/webgl_extensions/ext/webglvertexarrayobjectoes.rs index ccd103e07a2f..3ef5f8bbefa0 100644 --- a/components/script/dom/webgl_extensions/ext/webglvertexarrayobjectoes.rs +++ b/components/script/dom/webgl_extensions/ext/webglvertexarrayobjectoes.rs @@ -8,7 +8,7 @@ use core::iter::FromIterator; use dom::bindings::cell::DOMRefCell; use dom::bindings::codegen::Bindings::WebGLVertexArrayObjectOESBinding; use dom::bindings::reflector::reflect_dom_object; -use dom::bindings::root::{Dom, MutNullableJS, Root}; +use dom::bindings::root::{Dom, MutNullableDom, Root}; use dom::globalscope::GlobalScope; use dom::webglbuffer::WebGLBuffer; use dom::webglobject::WebGLObject; @@ -23,7 +23,7 @@ pub struct WebGLVertexArrayObjectOES { ever_bound: Cell, is_deleted: Cell, bound_attrib_buffers: DOMRefCell>>, - bound_buffer_element_array: MutNullableJS, + bound_buffer_element_array: MutNullableDom, } impl WebGLVertexArrayObjectOES { @@ -34,7 +34,7 @@ impl WebGLVertexArrayObjectOES { ever_bound: Cell::new(false), is_deleted: Cell::new(false), bound_attrib_buffers: DOMRefCell::new(HashMap::new()), - bound_buffer_element_array: MutNullableJS::new(None), + bound_buffer_element_array: MutNullableDom::new(None), } } diff --git a/components/script/dom/webgl_extensions/wrapper.rs b/components/script/dom/webgl_extensions/wrapper.rs index 53aba5ed4626..fa4d1112a3cf 100644 --- a/components/script/dom/webgl_extensions/wrapper.rs +++ b/components/script/dom/webgl_extensions/wrapper.rs @@ -4,7 +4,7 @@ use core::nonzero::NonZero; use dom::bindings::reflector::DomObject; -use dom::bindings::root::{MutNullableJS, Root}; +use dom::bindings::root::{MutNullableDom, Root}; use dom::bindings::trace::JSTraceable; use dom::webglrenderingcontext::WebGLRenderingContext; use heapsize::HeapSizeOf; @@ -29,15 +29,15 @@ pub trait WebGLExtensionWrapper: JSTraceable + HeapSizeOf { #[must_root] #[derive(HeapSizeOf, JSTraceable)] pub struct TypedWebGLExtensionWrapper { - extension: MutNullableJS + extension: MutNullableDom } /// Typed WebGL Extension implementation. -/// Exposes the exact MutNullableJS type defined by the extension. +/// Exposes the exact MutNullableDom type defined by the extension. impl TypedWebGLExtensionWrapper { pub fn new() -> TypedWebGLExtensionWrapper { TypedWebGLExtensionWrapper { - extension: MutNullableJS::new(None) + extension: MutNullableDom::new(None) } } } diff --git a/components/script/dom/webglprogram.rs b/components/script/dom/webglprogram.rs index cc2425036076..39262c2f5bda 100644 --- a/components/script/dom/webglprogram.rs +++ b/components/script/dom/webglprogram.rs @@ -8,7 +8,7 @@ use canvas_traits::webgl::webgl_channel; use dom::bindings::codegen::Bindings::WebGLProgramBinding; use dom::bindings::codegen::Bindings::WebGLRenderingContextBinding::WebGLRenderingContextConstants as constants; use dom::bindings::reflector::{DomObject, reflect_dom_object}; -use dom::bindings::root::{MutNullableJS, Root}; +use dom::bindings::root::{MutNullableDom, Root}; use dom::bindings::str::DOMString; use dom::webglactiveinfo::WebGLActiveInfo; use dom::webglobject::WebGLObject; @@ -25,8 +25,8 @@ pub struct WebGLProgram { is_deleted: Cell, link_called: Cell, linked: Cell, - fragment_shader: MutNullableJS, - vertex_shader: MutNullableJS, + fragment_shader: MutNullableDom, + vertex_shader: MutNullableDom, #[ignore_heap_size_of = "Defined in ipc-channel"] renderer: WebGLMsgSender, } diff --git a/components/script/dom/webglrenderingcontext.rs b/components/script/dom/webglrenderingcontext.rs index 64148a0a4351..9f3b9f286e8b 100644 --- a/components/script/dom/webglrenderingcontext.rs +++ b/components/script/dom/webglrenderingcontext.rs @@ -20,7 +20,7 @@ use dom::bindings::conversions::{ConversionResult, FromJSValConvertible, ToJSVal use dom::bindings::error::{Error, Fallible}; use dom::bindings::inheritance::Castable; use dom::bindings::reflector::{DomObject, Reflector, reflect_dom_object}; -use dom::bindings::root::{Dom, LayoutJS, MutNullableJS, Root}; +use dom::bindings::root::{Dom, LayoutJS, MutNullableDom, Root}; use dom::bindings::str::DOMString; use dom::event::{Event, EventBubbles, EventCancelable}; use dom::htmlcanvaselement::HTMLCanvasElement; @@ -145,14 +145,14 @@ pub struct WebGLRenderingContext { last_error: Cell>, texture_unpacking_settings: Cell, texture_unpacking_alignment: Cell, - bound_framebuffer: MutNullableJS, - bound_renderbuffer: MutNullableJS, - bound_texture_2d: MutNullableJS, - bound_texture_cube_map: MutNullableJS, - bound_buffer_array: MutNullableJS, - bound_buffer_element_array: MutNullableJS, + bound_framebuffer: MutNullableDom, + bound_renderbuffer: MutNullableDom, + bound_texture_2d: MutNullableDom, + bound_texture_cube_map: MutNullableDom, + bound_buffer_array: MutNullableDom, + bound_buffer_element_array: MutNullableDom, bound_attrib_buffers: DOMRefCell>>, - current_program: MutNullableJS, + current_program: MutNullableDom, #[ignore_heap_size_of = "Because it's small"] current_vertex_attrib_0: Cell<(f32, f32, f32, f32)>, #[ignore_heap_size_of = "Because it's small"] @@ -189,14 +189,14 @@ impl WebGLRenderingContext { last_error: Cell::new(None), texture_unpacking_settings: Cell::new(CONVERT_COLORSPACE), texture_unpacking_alignment: Cell::new(4), - bound_framebuffer: MutNullableJS::new(None), - bound_texture_2d: MutNullableJS::new(None), - bound_texture_cube_map: MutNullableJS::new(None), - bound_buffer_array: MutNullableJS::new(None), - bound_buffer_element_array: MutNullableJS::new(None), + bound_framebuffer: MutNullableDom::new(None), + bound_texture_2d: MutNullableDom::new(None), + bound_texture_cube_map: MutNullableDom::new(None), + bound_buffer_array: MutNullableDom::new(None), + bound_buffer_element_array: MutNullableDom::new(None), bound_attrib_buffers: DOMRefCell::new(Default::default()), - bound_renderbuffer: MutNullableJS::new(None), - current_program: MutNullableJS::new(None), + bound_renderbuffer: MutNullableDom::new(None), + current_program: MutNullableDom::new(None), current_vertex_attrib_0: Cell::new((0f32, 0f32, 0f32, 1f32)), current_scissor: Cell::new((0, 0, size.width, size.height)), current_clear_color: Cell::new((0.0, 0.0, 0.0, 0.0)), diff --git a/components/script/dom/window.rs b/components/script/dom/window.rs index b80beb186d02..1cb9bd37158f 100644 --- a/components/script/dom/window.rs +++ b/components/script/dom/window.rs @@ -21,7 +21,7 @@ use dom::bindings::inheritance::Castable; use dom::bindings::num::Finite; use dom::bindings::refcounted::Trusted; use dom::bindings::reflector::DomObject; -use dom::bindings::root::{Dom, MutNullableJS, Root}; +use dom::bindings::root::{Dom, MutNullableDom, Root}; use dom::bindings::str::DOMString; use dom::bindings::structuredclone::StructuredCloneData; use dom::bindings::trace::RootedTraceableBox; @@ -176,22 +176,22 @@ pub struct Window { file_reading_task_source: FileReadingTaskSource, #[ignore_heap_size_of = "task sources are hard"] performance_timeline_task_source: PerformanceTimelineTaskSource, - navigator: MutNullableJS, + navigator: MutNullableDom, #[ignore_heap_size_of = "Arc"] image_cache: Arc, #[ignore_heap_size_of = "channels are hard"] image_cache_chan: Sender, - window_proxy: MutNullableJS, - document: MutNullableJS, - location: MutNullableJS, - history: MutNullableJS, - custom_element_registry: MutNullableJS, - performance: MutNullableJS, + window_proxy: MutNullableDom, + document: MutNullableDom, + location: MutNullableDom, + history: MutNullableDom, + custom_element_registry: MutNullableDom, + performance: MutNullableDom, navigation_start: Cell, navigation_start_precise: Cell, - screen: MutNullableJS, - session_storage: MutNullableJS, - local_storage: MutNullableJS, + screen: MutNullableDom, + session_storage: MutNullableDom, + local_storage: MutNullableDom, status: DOMRefCell, /// For sending timeline markers. Will be ignored if @@ -263,7 +263,7 @@ pub struct Window { /// All the MediaQueryLists we need to update media_query_lists: WeakMediaQueryListVec, - test_runner: MutNullableJS, + test_runner: MutNullableDom, /// A handle for communicating messages to the webvr thread, if available. #[ignore_heap_size_of = "channels are hard"] @@ -287,9 +287,9 @@ pub struct Window { unminified_js_dir: DOMRefCell>, /// Worklets - test_worklet: MutNullableJS, + test_worklet: MutNullableDom, /// https://drafts.css-houdini.org/css-paint-api-1/#paint-worklet - paint_worklet: MutNullableJS, + paint_worklet: MutNullableDom, } impl Window { diff --git a/components/script/dom/workerglobalscope.rs b/components/script/dom/workerglobalscope.rs index 6817a466400c..252be0f3bf1b 100644 --- a/components/script/dom/workerglobalscope.rs +++ b/components/script/dom/workerglobalscope.rs @@ -10,7 +10,7 @@ use dom::bindings::codegen::UnionTypes::RequestOrUSVString; use dom::bindings::error::{Error, ErrorResult, Fallible, report_pending_exception}; use dom::bindings::inheritance::Castable; use dom::bindings::reflector::DomObject; -use dom::bindings::root::{MutNullableJS, Root}; +use dom::bindings::root::{MutNullableDom, Root}; use dom::bindings::settings_stack::AutoEntryScript; use dom::bindings::str::DOMString; use dom::bindings::trace::RootedTraceableBox; @@ -77,8 +77,8 @@ pub struct WorkerGlobalScope { closing: Option>, #[ignore_heap_size_of = "Defined in js"] runtime: Runtime, - location: MutNullableJS, - navigator: MutNullableJS, + location: MutNullableDom, + navigator: MutNullableDom, #[ignore_heap_size_of = "Defined in ipc-channel"] /// Optional `IpcSender` for sending the `DevtoolScriptControlMsg` @@ -91,7 +91,7 @@ pub struct WorkerGlobalScope { from_devtools_receiver: Receiver, navigation_start_precise: f64, - performance: MutNullableJS, + performance: MutNullableDom, } impl WorkerGlobalScope { diff --git a/components/script/dom/workernavigator.rs b/components/script/dom/workernavigator.rs index 165deaf5b5d0..d2d99be1264e 100644 --- a/components/script/dom/workernavigator.rs +++ b/components/script/dom/workernavigator.rs @@ -5,7 +5,7 @@ use dom::bindings::codegen::Bindings::WorkerNavigatorBinding; use dom::bindings::codegen::Bindings::WorkerNavigatorBinding::WorkerNavigatorMethods; use dom::bindings::reflector::{DomObject, Reflector, reflect_dom_object}; -use dom::bindings::root::{MutNullableJS, Root}; +use dom::bindings::root::{MutNullableDom, Root}; use dom::bindings::str::DOMString; use dom::navigatorinfo; use dom::permissions::Permissions; @@ -16,7 +16,7 @@ use dom_struct::dom_struct; #[dom_struct] pub struct WorkerNavigator { reflector_: Reflector, - permissions: MutNullableJS, + permissions: MutNullableDom, } impl WorkerNavigator { diff --git a/components/script/dom/xmlhttprequest.rs b/components/script/dom/xmlhttprequest.rs index a4446d55a561..a08982c42558 100644 --- a/components/script/dom/xmlhttprequest.rs +++ b/components/script/dom/xmlhttprequest.rs @@ -16,7 +16,7 @@ use dom::bindings::error::{Error, ErrorResult, Fallible}; use dom::bindings::inheritance::Castable; use dom::bindings::refcounted::Trusted; use dom::bindings::reflector::{DomObject, reflect_dom_object}; -use dom::bindings::root::{Dom, MutNullableJS, Root}; +use dom::bindings::root::{Dom, MutNullableDom, Root}; use dom::bindings::str::{ByteString, DOMString, USVString, is_token}; use dom::blob::{Blob, BlobImpl}; use dom::document::{Document, HasBrowsingContext, IsHTMLDocument}; @@ -129,8 +129,8 @@ pub struct XMLHttpRequest { status_text: DOMRefCell, response: DOMRefCell, response_type: Cell, - response_xml: MutNullableJS, - response_blob: MutNullableJS, + response_xml: MutNullableDom, + response_blob: MutNullableDom, #[ignore_heap_size_of = "Defined in rust-mozjs"] response_json: Heap, #[ignore_heap_size_of = "Defined in hyper"] diff --git a/components/script/script_thread.rs b/components/script/script_thread.rs index 92b8aa4b9d54..6da18b8f28b4 100644 --- a/components/script/script_thread.rs +++ b/components/script/script_thread.rs @@ -34,7 +34,7 @@ use dom::bindings::conversions::{ConversionResult, FromJSValConvertible, Stringi use dom::bindings::inheritance::Castable; use dom::bindings::num::Finite; use dom::bindings::reflector::DomObject; -use dom::bindings::root::{Dom, MutNullableJS, Root, RootCollection}; +use dom::bindings::root::{Dom, MutNullableDom, Root, RootCollection}; use dom::bindings::root::{RootCollectionPtr, RootedReference}; use dom::bindings::str::DOMString; use dom::bindings::structuredclone::StructuredCloneData; @@ -458,7 +458,7 @@ pub struct ScriptThread { js_runtime: Rc, /// The topmost element over the mouse. - topmost_mouse_over_target: MutNullableJS, + topmost_mouse_over_target: MutNullableDom, /// List of pipelines that have been owned and closed by this script thread. closed_pipelines: DOMRefCell>, @@ -846,7 +846,7 @@ impl ScriptThread { devtools_sender: ipc_devtools_sender, js_runtime: Rc::new(runtime), - topmost_mouse_over_target: MutNullableJS::new(Default::default()), + topmost_mouse_over_target: MutNullableDom::new(Default::default()), closed_pipelines: DOMRefCell::new(HashSet::new()), scheduler_chan: state.scheduler_chan, From e2dac78d3600cb4b2b4474f1db4f0fcaadbe24ea Mon Sep 17 00:00:00 2001 From: Anthony Ramine Date: Tue, 26 Sep 2017 01:30:06 +0200 Subject: [PATCH 6/9] Rename LayoutJS to LayoutDom --- components/layout/wrapper.rs | 2 +- components/layout_thread/dom_wrapper.rs | 34 ++++++------- components/script/dom/attr.rs | 4 +- .../dom/bindings/codegen/CodegenRust.py | 2 +- components/script/dom/bindings/root.rs | 48 +++++++++---------- .../script/dom/canvasrenderingcontext2d.rs | 4 +- components/script/dom/characterdata.rs | 4 +- components/script/dom/document.rs | 8 ++-- components/script/dom/element.rs | 6 +-- components/script/dom/htmlbodyelement.rs | 4 +- components/script/dom/htmlcanvaselement.rs | 4 +- components/script/dom/htmlfontelement.rs | 4 +- components/script/dom/htmlhrelement.rs | 4 +- components/script/dom/htmliframeelement.rs | 4 +- components/script/dom/htmlimageelement.rs | 4 +- components/script/dom/htmlinputelement.rs | 8 ++-- components/script/dom/htmltablecellelement.rs | 4 +- components/script/dom/htmltableelement.rs | 4 +- components/script/dom/htmltablerowelement.rs | 4 +- .../script/dom/htmltablesectionelement.rs | 4 +- components/script/dom/htmltextareaelement.rs | 4 +- components/script/dom/mod.rs | 4 +- components/script/dom/node.rs | 28 +++++------ components/script/dom/svgsvgelement.rs | 4 +- .../script/dom/webglrenderingcontext.rs | 4 +- components/script/lib.rs | 2 +- .../script_layout_interface/wrapper_traits.rs | 2 +- 27 files changed, 104 insertions(+), 104 deletions(-) diff --git a/components/layout/wrapper.rs b/components/layout/wrapper.rs index 6abe08748b45..27c9475a8b2a 100644 --- a/components/layout/wrapper.rs +++ b/components/layout/wrapper.rs @@ -12,7 +12,7 @@ //! //! 1. Layout is not allowed to mutate the DOM. //! -//! 2. Layout is not allowed to see anything with `LayoutJS` in the name, because it could hang +//! 2. Layout is not allowed to see anything with `LayoutDom` in the name, because it could hang //! onto these objects and cause use-after-free. //! //! When implementing wrapper functions, be careful that you do not touch the borrow flags, or you diff --git a/components/layout_thread/dom_wrapper.rs b/components/layout_thread/dom_wrapper.rs index f5ad43ba3bad..525e1afb5f08 100644 --- a/components/layout_thread/dom_wrapper.rs +++ b/components/layout_thread/dom_wrapper.rs @@ -12,7 +12,7 @@ //! //! 1. Layout is not allowed to mutate the DOM. //! -//! 2. Layout is not allowed to see anything with `LayoutJS` in the name, because it could hang +//! 2. Layout is not allowed to see anything with `LayoutDom` in the name, because it could hang //! onto these objects and cause use-after-free. //! //! When implementing wrapper functions, be careful that you do not touch the borrow flags, or you @@ -44,7 +44,7 @@ use script::layout_exports::{Document, Element, Node, Text}; use script::layout_exports::{HANDLED_SNAPSHOT, HAS_SNAPSHOT}; use script::layout_exports::{LayoutCharacterDataHelpers, LayoutDocumentHelpers}; use script::layout_exports::{LayoutElementHelpers, LayoutNodeHelpers, RawLayoutElementHelpers}; -use script::layout_exports::LayoutJS; +use script::layout_exports::LayoutDom; use script::layout_exports::PendingRestyle; use script_layout_interface::{HTMLCanvasData, LayoutNodeType, SVGSVGData, TrustedNodeAddress}; use script_layout_interface::{OpaqueStyleAndLayoutData, StyleData}; @@ -87,7 +87,7 @@ pub unsafe fn drop_style_and_layout_data(data: OpaqueStyleAndLayoutData) { #[derive(Clone, Copy)] pub struct ServoLayoutNode<'a> { /// The wrapped node. - node: LayoutJS, + node: LayoutDom, /// Being chained to a PhantomData prevents `LayoutNode`s from escaping. chain: PhantomData<&'a ()>, @@ -115,7 +115,7 @@ impl<'a> PartialEq for ServoLayoutNode<'a> { } impl<'ln> ServoLayoutNode<'ln> { - fn from_layout_js(n: LayoutJS) -> ServoLayoutNode<'ln> { + fn from_layout_js(n: LayoutDom) -> ServoLayoutNode<'ln> { ServoLayoutNode { node: n, chain: PhantomData, @@ -123,11 +123,11 @@ impl<'ln> ServoLayoutNode<'ln> { } pub unsafe fn new(address: &TrustedNodeAddress) -> ServoLayoutNode { - ServoLayoutNode::from_layout_js(LayoutJS::from_trusted_node_address(*address)) + ServoLayoutNode::from_layout_js(LayoutDom::from_trusted_node_address(*address)) } /// Creates a new layout node with the same lifetime as this layout node. - pub unsafe fn new_with_this_lifetime(&self, node: &LayoutJS) -> ServoLayoutNode<'ln> { + pub unsafe fn new_with_this_lifetime(&self, node: &LayoutDom) -> ServoLayoutNode<'ln> { ServoLayoutNode { node: *node, chain: self.chain, @@ -301,9 +301,9 @@ impl<'le> GetLayoutData for ServoThreadSafeLayoutElement<'le> { } impl<'ln> ServoLayoutNode<'ln> { - /// Returns the interior of this node as a `LayoutJS`. This is highly unsafe for layout to + /// Returns the interior of this node as a `LayoutDom`. This is highly unsafe for layout to /// call and as such is marked `unsafe`. - pub unsafe fn get_jsmanaged(&self) -> &LayoutJS { + pub unsafe fn get_jsmanaged(&self) -> &LayoutDom { &self.node } } @@ -311,7 +311,7 @@ impl<'ln> ServoLayoutNode<'ln> { // A wrapper around documents that ensures ayout can only ever access safe properties. #[derive(Clone, Copy)] pub struct ServoLayoutDocument<'ld> { - document: LayoutJS, + document: LayoutDom, chain: PhantomData<&'ld ()>, } @@ -341,7 +341,7 @@ impl<'ld> ServoLayoutDocument<'ld> { unsafe { self.document.style_shared_lock() } } - pub fn from_layout_js(doc: LayoutJS) -> ServoLayoutDocument<'ld> { + pub fn from_layout_js(doc: LayoutDom) -> ServoLayoutDocument<'ld> { ServoLayoutDocument { document: doc, chain: PhantomData, @@ -352,7 +352,7 @@ impl<'ld> ServoLayoutDocument<'ld> { /// A wrapper around elements that ensures layout can only ever access safe properties. #[derive(Clone, Copy)] pub struct ServoLayoutElement<'le> { - element: LayoutJS, + element: LayoutDom, chain: PhantomData<&'le ()>, } @@ -560,7 +560,7 @@ impl<'le> Hash for ServoLayoutElement<'le> { impl<'le> Eq for ServoLayoutElement<'le> {} impl<'le> ServoLayoutElement<'le> { - fn from_layout_js(el: LayoutJS) -> ServoLayoutElement<'le> { + fn from_layout_js(el: LayoutDom) -> ServoLayoutElement<'le> { ServoLayoutElement { element: el, chain: PhantomData, @@ -611,7 +611,7 @@ impl<'le> ServoLayoutElement<'le> { } } -fn as_element<'le>(node: LayoutJS) -> Option> { +fn as_element<'le>(node: LayoutDom) -> Option> { node.downcast().map(ServoLayoutElement::from_layout_js) } @@ -828,7 +828,7 @@ impl<'ln> DangerousThreadSafeLayoutNode for ServoThreadSafeLayoutNode<'ln> { impl<'ln> ServoThreadSafeLayoutNode<'ln> { /// Creates a new layout node with the same lifetime as this layout node. - pub unsafe fn new_with_this_lifetime(&self, node: &LayoutJS) -> ServoThreadSafeLayoutNode<'ln> { + pub unsafe fn new_with_this_lifetime(&self, node: &LayoutDom) -> ServoThreadSafeLayoutNode<'ln> { ServoThreadSafeLayoutNode { node: self.node.new_with_this_lifetime(node), pseudo: PseudoElementType::Normal, @@ -843,9 +843,9 @@ impl<'ln> ServoThreadSafeLayoutNode<'ln> { } } - /// Returns the interior of this node as a `LayoutJS`. This is highly unsafe for layout to + /// Returns the interior of this node as a `LayoutDom`. This is highly unsafe for layout to /// call and as such is marked `unsafe`. - unsafe fn get_jsmanaged(&self) -> &LayoutJS { + unsafe fn get_jsmanaged(&self) -> &LayoutDom { self.node.get_jsmanaged() } } @@ -915,7 +915,7 @@ impl<'ln> ThreadSafeLayoutNode for ServoThreadSafeLayoutNode<'ln> { fn is_ignorable_whitespace(&self, context: &SharedStyleContext) -> bool { unsafe { - let text: LayoutJS = match self.get_jsmanaged().downcast() { + let text: LayoutDom = match self.get_jsmanaged().downcast() { Some(text) => text, None => return false }; diff --git a/components/script/dom/attr.rs b/components/script/dom/attr.rs index d18eed26f65b..ea9f1f23a789 100644 --- a/components/script/dom/attr.rs +++ b/components/script/dom/attr.rs @@ -7,7 +7,7 @@ use dom::bindings::cell::DOMRefCell; use dom::bindings::codegen::Bindings::AttrBinding::{self, AttrMethods}; use dom::bindings::inheritance::Castable; use dom::bindings::reflector::{Reflector, reflect_dom_object}; -use dom::bindings::root::{LayoutJS, MutNullableDom, Root, RootedReference}; +use dom::bindings::root::{LayoutDom, MutNullableDom, Root, RootedReference}; use dom::bindings::str::DOMString; use dom::customelementregistry::CallbackReaction; use dom::element::{AttributeMutation, Element}; @@ -256,7 +256,7 @@ pub trait AttrHelpersForLayout { } #[allow(unsafe_code)] -impl AttrHelpersForLayout for LayoutJS { +impl AttrHelpersForLayout for LayoutDom { #[inline] unsafe fn value_forever(&self) -> &'static AttrValue { // This transmute is used to cheat the lifetime restriction. diff --git a/components/script/dom/bindings/codegen/CodegenRust.py b/components/script/dom/bindings/codegen/CodegenRust.py index 3f99ea37a417..888a17a3a8cc 100644 --- a/components/script/dom/bindings/codegen/CodegenRust.py +++ b/components/script/dom/bindings/codegen/CodegenRust.py @@ -7195,7 +7195,7 @@ def InheritTypes(config): imports = [CGGeneric("use dom::types::*;\n"), CGGeneric("use dom::bindings::conversions::{DerivedFrom, get_dom_class};\n"), CGGeneric("use dom::bindings::inheritance::Castable;\n"), - CGGeneric("use dom::bindings::root::{Dom, LayoutJS, Root};\n"), + CGGeneric("use dom::bindings::root::{Dom, LayoutDom, Root};\n"), CGGeneric("use dom::bindings::trace::JSTraceable;\n"), CGGeneric("use dom::bindings::reflector::DomObject;\n"), CGGeneric("use js::jsapi::JSTracer;\n\n"), diff --git a/components/script/dom/bindings/root.rs b/components/script/dom/bindings/root.rs index dbfe4023d63e..f845bd3bd30c 100644 --- a/components/script/dom/bindings/root.rs +++ b/components/script/dom/bindings/root.rs @@ -68,10 +68,10 @@ impl HeapSizeOf for Dom { } impl Dom { - /// Returns `LayoutJS` containing the same pointer. - pub unsafe fn to_layout(&self) -> LayoutJS { + /// Returns `LayoutDom` containing the same pointer. + pub unsafe fn to_layout(&self) -> LayoutDom { debug_assert!(thread_state::get().is_layout()); - LayoutJS { + LayoutDom { ptr: self.ptr.clone(), } } @@ -124,32 +124,32 @@ unsafe impl JSTraceable for Dom { /// An unrooted reference to a DOM object for use in layout. `Layout*Helpers` /// traits must be implemented on this. #[allow_unrooted_interior] -pub struct LayoutJS { +pub struct LayoutDom { ptr: NonZero<*const T>, } -impl LayoutJS { +impl LayoutDom { /// Cast a DOM object root upwards to one of the interfaces it derives from. - pub fn upcast(&self) -> LayoutJS + pub fn upcast(&self) -> LayoutDom where U: Castable, T: DerivedFrom { debug_assert!(thread_state::get().is_layout()); let ptr: *const T = self.ptr.get(); - LayoutJS { + LayoutDom { ptr: unsafe { NonZero::new_unchecked(ptr as *const U) }, } } /// Cast a DOM object downwards to one of the interfaces it might implement. - pub fn downcast(&self) -> Option> + pub fn downcast(&self) -> Option> where U: DerivedFrom { debug_assert!(thread_state::get().is_layout()); unsafe { if (*self.unsafe_get()).is::() { let ptr: *const T = self.ptr.get(); - Some(LayoutJS { + Some(LayoutDom { ptr: NonZero::new_unchecked(ptr as *const U), }) } else { @@ -159,7 +159,7 @@ impl LayoutJS { } } -impl LayoutJS { +impl LayoutDom { /// Get the reflector. pub unsafe fn get_jsobject(&self) -> *mut JSObject { debug_assert!(thread_state::get().is_layout()); @@ -167,7 +167,7 @@ impl LayoutJS { } } -impl Copy for LayoutJS {} +impl Copy for LayoutDom {} impl PartialEq for Dom { fn eq(&self, other: &Dom) -> bool { @@ -177,13 +177,13 @@ impl PartialEq for Dom { impl Eq for Dom {} -impl PartialEq for LayoutJS { - fn eq(&self, other: &LayoutJS) -> bool { +impl PartialEq for LayoutDom { + fn eq(&self, other: &LayoutDom) -> bool { self.ptr == other.ptr } } -impl Eq for LayoutJS {} +impl Eq for LayoutDom {} impl Hash for Dom { fn hash(&self, state: &mut H) { @@ -191,7 +191,7 @@ impl Hash for Dom { } } -impl Hash for LayoutJS { +impl Hash for LayoutDom { fn hash(&self, state: &mut H) { self.ptr.hash(state) } @@ -208,23 +208,23 @@ impl Clone for Dom { } } -impl Clone for LayoutJS { +impl Clone for LayoutDom { #[inline] - fn clone(&self) -> LayoutJS { + fn clone(&self) -> LayoutDom { debug_assert!(thread_state::get().is_layout()); - LayoutJS { + LayoutDom { ptr: self.ptr.clone(), } } } -impl LayoutJS { +impl LayoutDom { /// Create a new JS-owned value wrapped from an address known to be a /// `Node` pointer. - pub unsafe fn from_trusted_node_address(inner: TrustedNodeAddress) -> LayoutJS { + pub unsafe fn from_trusted_node_address(inner: TrustedNodeAddress) -> LayoutDom { debug_assert!(thread_state::get().is_layout()); let TrustedNodeAddress(addr) = inner; - LayoutJS { + LayoutDom { ptr: NonZero::new_unchecked(addr as *const Node), } } @@ -327,10 +327,10 @@ impl MutNullableDom { } } - /// Retrieve a copy of the inner optional `Dom` as `LayoutJS`. + /// Retrieve a copy of the inner optional `Dom` as `LayoutDom`. /// For use by layout, which can't use safe types like Temporary. #[allow(unrooted_must_root)] - pub unsafe fn get_inner_as_layout(&self) -> Option> { + pub unsafe fn get_inner_as_layout(&self) -> Option> { debug_assert!(thread_state::get().is_layout()); ptr::read(self.ptr.get()).map(|js| js.to_layout()) } @@ -442,7 +442,7 @@ unsafe impl JSTraceable for OnceCellJS { } } -impl LayoutJS { +impl LayoutDom { /// Returns an unsafe pointer to the interior of this JS object. This is /// the only method that be safely accessed from layout. (The fact that /// this is unsafe is what necessitates the layout wrappers.) diff --git a/components/script/dom/canvasrenderingcontext2d.rs b/components/script/dom/canvasrenderingcontext2d.rs index 4eafb0907e8f..cf898b068806 100644 --- a/components/script/dom/canvasrenderingcontext2d.rs +++ b/components/script/dom/canvasrenderingcontext2d.rs @@ -23,7 +23,7 @@ use dom::bindings::error::{Error, ErrorResult, Fallible}; use dom::bindings::inheritance::Castable; use dom::bindings::num::Finite; use dom::bindings::reflector::{DomObject, Reflector, reflect_dom_object}; -use dom::bindings::root::{Dom, LayoutJS, Root}; +use dom::bindings::root::{Dom, LayoutDom, Root}; use dom::bindings::str::DOMString; use dom::canvasgradient::{CanvasGradient, CanvasGradientStyle, ToFillOrStrokeStyle}; use dom::canvaspattern::CanvasPattern; @@ -585,7 +585,7 @@ pub trait LayoutCanvasRenderingContext2DHelpers { unsafe fn get_ipc_renderer(&self) -> IpcSender; } -impl LayoutCanvasRenderingContext2DHelpers for LayoutJS { +impl LayoutCanvasRenderingContext2DHelpers for LayoutDom { #[allow(unsafe_code)] unsafe fn get_ipc_renderer(&self) -> IpcSender { (*self.unsafe_get()).ipc_renderer.clone() diff --git a/components/script/dom/characterdata.rs b/components/script/dom/characterdata.rs index 9db97be00f6a..38a30e8ef50e 100644 --- a/components/script/dom/characterdata.rs +++ b/components/script/dom/characterdata.rs @@ -12,7 +12,7 @@ use dom::bindings::codegen::InheritTypes::{CharacterDataTypeId, NodeTypeId}; use dom::bindings::codegen::UnionTypes::NodeOrString; use dom::bindings::error::{Error, ErrorResult, Fallible}; use dom::bindings::inheritance::Castable; -use dom::bindings::root::{LayoutJS, Root}; +use dom::bindings::root::{LayoutDom, Root}; use dom::bindings::str::DOMString; use dom::comment::Comment; use dom::document::Document; @@ -253,7 +253,7 @@ pub trait LayoutCharacterDataHelpers { } #[allow(unsafe_code)] -impl LayoutCharacterDataHelpers for LayoutJS { +impl LayoutCharacterDataHelpers for LayoutDom { #[inline] unsafe fn data_for_layout(&self) -> &str { &(*self.unsafe_get()).data.borrow_for_layout() diff --git a/components/script/dom/document.rs b/components/script/dom/document.rs index 49dfdb4230e9..48e4103e76ec 100644 --- a/components/script/dom/document.rs +++ b/components/script/dom/document.rs @@ -27,7 +27,7 @@ use dom::bindings::inheritance::{Castable, ElementTypeId, HTMLElementTypeId, Nod use dom::bindings::num::Finite; use dom::bindings::refcounted::{Trusted, TrustedPromise}; use dom::bindings::reflector::{DomObject, reflect_dom_object}; -use dom::bindings::root::{Dom, LayoutJS, MutNullableDom, Root, RootedReference}; +use dom::bindings::root::{Dom, LayoutDom, MutNullableDom, Root, RootedReference}; use dom::bindings::str::{DOMString, USVString}; use dom::bindings::xmlname::{namespace_from_domstring, validate_and_extract, xml_name_type}; use dom::bindings::xmlname::XMLName::InvalidXMLName; @@ -2082,7 +2082,7 @@ pub enum DocumentSource { #[allow(unsafe_code)] pub trait LayoutDocumentHelpers { unsafe fn is_html_document_for_layout(&self) -> bool; - unsafe fn drain_pending_restyles(&self) -> Vec<(LayoutJS, PendingRestyle)>; + unsafe fn drain_pending_restyles(&self) -> Vec<(LayoutDom, PendingRestyle)>; unsafe fn needs_paint_from_layout(&self); unsafe fn will_paint(&self); unsafe fn quirks_mode(&self) -> QuirksMode; @@ -2090,7 +2090,7 @@ pub trait LayoutDocumentHelpers { } #[allow(unsafe_code)] -impl LayoutDocumentHelpers for LayoutJS { +impl LayoutDocumentHelpers for LayoutDom { #[inline] unsafe fn is_html_document_for_layout(&self) -> bool { (*self.unsafe_get()).is_html_document @@ -2098,7 +2098,7 @@ impl LayoutDocumentHelpers for LayoutJS { #[inline] #[allow(unrooted_must_root)] - unsafe fn drain_pending_restyles(&self) -> Vec<(LayoutJS, PendingRestyle)> { + unsafe fn drain_pending_restyles(&self) -> Vec<(LayoutDom, PendingRestyle)> { let mut elements = (*self.unsafe_get()).pending_restyles.borrow_mut_for_layout(); // Elements were in a document when they were adding to this list, but that // may no longer be true when the next layout occurs. diff --git a/components/script/dom/element.rs b/components/script/dom/element.rs index 66c1ac9cbb1c..79bbb3b11e3e 100644 --- a/components/script/dom/element.rs +++ b/components/script/dom/element.rs @@ -24,7 +24,7 @@ use dom::bindings::error::{Error, ErrorResult, Fallible}; use dom::bindings::inheritance::{Castable, ElementTypeId, HTMLElementTypeId, NodeTypeId}; use dom::bindings::refcounted::{Trusted, TrustedPromise}; use dom::bindings::reflector::DomObject; -use dom::bindings::root::{Dom, LayoutJS, MutNullableDom, Root, RootedReference}; +use dom::bindings::root::{Dom, LayoutDom, MutNullableDom, Root, RootedReference}; use dom::bindings::str::DOMString; use dom::bindings::xmlname::{namespace_from_domstring, validate_and_extract, xml_name_type}; use dom::bindings::xmlname::XMLName::InvalidXMLName; @@ -384,7 +384,7 @@ pub trait RawLayoutElementHelpers { #[inline] #[allow(unsafe_code)] pub unsafe fn get_attr_for_layout<'a>(elem: &'a Element, namespace: &Namespace, name: &LocalName) - -> Option> { + -> Option> { // cast to point to T in RefCell directly let attrs = elem.attrs.borrow_for_layout(); attrs.iter().find(|attr| { @@ -453,7 +453,7 @@ pub trait LayoutElementHelpers { fn has_selector_flags(&self, flags: ElementSelectorFlags) -> bool; } -impl LayoutElementHelpers for LayoutJS { +impl LayoutElementHelpers for LayoutDom { #[allow(unsafe_code)] #[inline] unsafe fn has_class_for_layout(&self, name: &Atom, case_sensitivity: CaseSensitivity) -> bool { diff --git a/components/script/dom/htmlbodyelement.rs b/components/script/dom/htmlbodyelement.rs index 3eca3fba978c..3ec993ca3df8 100644 --- a/components/script/dom/htmlbodyelement.rs +++ b/components/script/dom/htmlbodyelement.rs @@ -7,7 +7,7 @@ use dom::attr::Attr; use dom::bindings::codegen::Bindings::HTMLBodyElementBinding::{self, HTMLBodyElementMethods}; use dom::bindings::codegen::Bindings::WindowBinding::WindowMethods; use dom::bindings::inheritance::Castable; -use dom::bindings::root::{LayoutJS, Root}; +use dom::bindings::root::{LayoutDom, Root}; use dom::bindings::str::DOMString; use dom::document::Document; use dom::element::{AttributeMutation, Element, RawLayoutElementHelpers}; @@ -88,7 +88,7 @@ pub trait HTMLBodyElementLayoutHelpers { fn get_background(&self) -> Option; } -impl HTMLBodyElementLayoutHelpers for LayoutJS { +impl HTMLBodyElementLayoutHelpers for LayoutDom { #[allow(unsafe_code)] fn get_background_color(&self) -> Option { unsafe { diff --git a/components/script/dom/htmlcanvaselement.rs b/components/script/dom/htmlcanvaselement.rs index 0e376f63b2d1..de6fc1b1bd42 100644 --- a/components/script/dom/htmlcanvaselement.rs +++ b/components/script/dom/htmlcanvaselement.rs @@ -15,7 +15,7 @@ use dom::bindings::conversions::ConversionResult; use dom::bindings::error::{Error, Fallible}; use dom::bindings::inheritance::Castable; use dom::bindings::num::Finite; -use dom::bindings::root::{Dom, LayoutJS, Root}; +use dom::bindings::root::{Dom, LayoutDom, Root}; use dom::bindings::str::DOMString; use dom::canvasrenderingcontext2d::{CanvasRenderingContext2D, LayoutCanvasRenderingContext2DHelpers}; use dom::document::Document; @@ -101,7 +101,7 @@ pub trait LayoutHTMLCanvasElementHelpers { fn get_height(&self) -> LengthOrPercentageOrAuto; } -impl LayoutHTMLCanvasElementHelpers for LayoutJS { +impl LayoutHTMLCanvasElementHelpers for LayoutDom { #[allow(unsafe_code)] fn data(&self) -> HTMLCanvasData { unsafe { diff --git a/components/script/dom/htmlfontelement.rs b/components/script/dom/htmlfontelement.rs index 77417b899970..e2f9eaeec21b 100644 --- a/components/script/dom/htmlfontelement.rs +++ b/components/script/dom/htmlfontelement.rs @@ -7,7 +7,7 @@ use dom::attr::Attr; use dom::bindings::codegen::Bindings::HTMLFontElementBinding; use dom::bindings::codegen::Bindings::HTMLFontElementBinding::HTMLFontElementMethods; use dom::bindings::inheritance::Castable; -use dom::bindings::root::{LayoutJS, Root}; +use dom::bindings::root::{LayoutDom, Root}; use dom::bindings::str::DOMString; use dom::document::Document; use dom::element::{Element, RawLayoutElementHelpers}; @@ -96,7 +96,7 @@ pub trait HTMLFontElementLayoutHelpers { fn get_size(&self) -> Option; } -impl HTMLFontElementLayoutHelpers for LayoutJS { +impl HTMLFontElementLayoutHelpers for LayoutDom { #[allow(unsafe_code)] fn get_color(&self) -> Option { unsafe { diff --git a/components/script/dom/htmlhrelement.rs b/components/script/dom/htmlhrelement.rs index 38a2f354a6f2..e66494e68433 100644 --- a/components/script/dom/htmlhrelement.rs +++ b/components/script/dom/htmlhrelement.rs @@ -5,7 +5,7 @@ use cssparser::RGBA; use dom::bindings::codegen::Bindings::HTMLHRElementBinding::{self, HTMLHRElementMethods}; use dom::bindings::inheritance::Castable; -use dom::bindings::root::{LayoutJS, Root}; +use dom::bindings::root::{LayoutDom, Root}; use dom::bindings::str::DOMString; use dom::document::Document; use dom::element::{Element, RawLayoutElementHelpers}; @@ -63,7 +63,7 @@ pub trait HTMLHRLayoutHelpers { fn get_width(&self) -> LengthOrPercentageOrAuto; } -impl HTMLHRLayoutHelpers for LayoutJS { +impl HTMLHRLayoutHelpers for LayoutDom { #[allow(unsafe_code)] fn get_color(&self) -> Option { unsafe { diff --git a/components/script/dom/htmliframeelement.rs b/components/script/dom/htmliframeelement.rs index 8e71609a4513..923c0fab2df7 100644 --- a/components/script/dom/htmliframeelement.rs +++ b/components/script/dom/htmliframeelement.rs @@ -21,7 +21,7 @@ use dom::bindings::error::{Error, ErrorResult, Fallible}; use dom::bindings::inheritance::Castable; use dom::bindings::refcounted::Trusted; use dom::bindings::reflector::DomObject; -use dom::bindings::root::{LayoutJS, MutNullableDom, Root}; +use dom::bindings::root::{LayoutDom, MutNullableDom, Root}; use dom::bindings::str::DOMString; use dom::customevent::CustomEvent; use dom::document::Document; @@ -419,7 +419,7 @@ pub trait HTMLIFrameElementLayoutMethods { fn get_height(&self) -> LengthOrPercentageOrAuto; } -impl HTMLIFrameElementLayoutMethods for LayoutJS { +impl HTMLIFrameElementLayoutMethods for LayoutDom { #[inline] #[allow(unsafe_code)] fn pipeline_id(&self) -> Option { diff --git a/components/script/dom/htmlimageelement.rs b/components/script/dom/htmlimageelement.rs index 89873ffc4d84..3a71f8bda484 100644 --- a/components/script/dom/htmlimageelement.rs +++ b/components/script/dom/htmlimageelement.rs @@ -17,7 +17,7 @@ use dom::bindings::error::Fallible; use dom::bindings::inheritance::Castable; use dom::bindings::refcounted::Trusted; use dom::bindings::reflector::DomObject; -use dom::bindings::root::{LayoutJS, MutNullableDom, Root}; +use dom::bindings::root::{LayoutDom, MutNullableDom, Root}; use dom::bindings::str::DOMString; use dom::document::Document; use dom::element::{AttributeMutation, Element, RawLayoutElementHelpers}; @@ -694,7 +694,7 @@ pub trait LayoutHTMLImageElementHelpers { fn get_height(&self) -> LengthOrPercentageOrAuto; } -impl LayoutHTMLImageElementHelpers for LayoutJS { +impl LayoutHTMLImageElementHelpers for LayoutDom { #[allow(unsafe_code)] unsafe fn image(&self) -> Option> { (*self.unsafe_get()).current_request.borrow_for_layout().image.clone() diff --git a/components/script/dom/htmlinputelement.rs b/components/script/dom/htmlinputelement.rs index bd714509dda9..0520a3a3d4f1 100755 --- a/components/script/dom/htmlinputelement.rs +++ b/components/script/dom/htmlinputelement.rs @@ -15,7 +15,7 @@ use dom::bindings::codegen::Bindings::MouseEventBinding::MouseEventMethods; use dom::bindings::codegen::Bindings::WindowBinding::WindowMethods; use dom::bindings::error::{Error, ErrorResult}; use dom::bindings::inheritance::Castable; -use dom::bindings::root::{Dom, LayoutJS, MutNullableDom, Root, RootedReference}; +use dom::bindings::root::{Dom, LayoutDom, MutNullableDom, Root, RootedReference}; use dom::bindings::str::DOMString; use dom::document::Document; use dom::element::{AttributeMutation, Element, LayoutElementHelpers, RawLayoutElementHelpers}; @@ -206,15 +206,15 @@ pub trait LayoutHTMLInputElementHelpers { } #[allow(unsafe_code)] -unsafe fn get_raw_textinput_value(input: LayoutJS) -> DOMString { +unsafe fn get_raw_textinput_value(input: LayoutDom) -> DOMString { (*input.unsafe_get()).textinput.borrow_for_layout().get_content() } -impl LayoutHTMLInputElementHelpers for LayoutJS { +impl LayoutHTMLInputElementHelpers for LayoutDom { #[allow(unsafe_code)] unsafe fn value_for_layout(self) -> String { #[allow(unsafe_code)] - unsafe fn get_raw_attr_value(input: LayoutJS, default: &str) -> String { + unsafe fn get_raw_attr_value(input: LayoutDom, default: &str) -> String { let elem = input.upcast::(); let value = (*elem.unsafe_get()) .get_attr_val_for_layout(&ns!(), &local_name!("value")) diff --git a/components/script/dom/htmltablecellelement.rs b/components/script/dom/htmltablecellelement.rs index 6bbdc65079a2..3be05003a4a4 100644 --- a/components/script/dom/htmltablecellelement.rs +++ b/components/script/dom/htmltablecellelement.rs @@ -6,7 +6,7 @@ use cssparser::RGBA; use dom::bindings::codegen::Bindings::HTMLTableCellElementBinding::HTMLTableCellElementMethods; use dom::bindings::codegen::Bindings::NodeBinding::NodeMethods; use dom::bindings::inheritance::Castable; -use dom::bindings::root::LayoutJS; +use dom::bindings::root::LayoutDom; use dom::bindings::str::DOMString; use dom::document::Document; use dom::element::{Element, RawLayoutElementHelpers}; @@ -88,7 +88,7 @@ pub trait HTMLTableCellElementLayoutHelpers { } #[allow(unsafe_code)] -impl HTMLTableCellElementLayoutHelpers for LayoutJS { +impl HTMLTableCellElementLayoutHelpers for LayoutDom { fn get_background_color(&self) -> Option { unsafe { (&*self.upcast::().unsafe_get()) diff --git a/components/script/dom/htmltableelement.rs b/components/script/dom/htmltableelement.rs index 25069647f6c2..3571dda873d1 100644 --- a/components/script/dom/htmltableelement.rs +++ b/components/script/dom/htmltableelement.rs @@ -10,7 +10,7 @@ use dom::bindings::codegen::Bindings::HTMLTableElementBinding::HTMLTableElementM use dom::bindings::codegen::Bindings::NodeBinding::NodeMethods; use dom::bindings::error::{Error, ErrorResult, Fallible}; use dom::bindings::inheritance::Castable; -use dom::bindings::root::{Dom, LayoutJS, MutNullableDom, Root, RootedReference}; +use dom::bindings::root::{Dom, LayoutDom, MutNullableDom, Root, RootedReference}; use dom::bindings::str::DOMString; use dom::document::Document; use dom::element::{AttributeMutation, Element, RawLayoutElementHelpers}; @@ -379,7 +379,7 @@ pub trait HTMLTableElementLayoutHelpers { fn get_width(&self) -> LengthOrPercentageOrAuto; } -impl HTMLTableElementLayoutHelpers for LayoutJS { +impl HTMLTableElementLayoutHelpers for LayoutDom { #[allow(unsafe_code)] fn get_background_color(&self) -> Option { unsafe { diff --git a/components/script/dom/htmltablerowelement.rs b/components/script/dom/htmltablerowelement.rs index 78246d4444cc..ded30ae590c2 100644 --- a/components/script/dom/htmltablerowelement.rs +++ b/components/script/dom/htmltablerowelement.rs @@ -9,7 +9,7 @@ use dom::bindings::codegen::Bindings::HTMLTableSectionElementBinding::HTMLTableS use dom::bindings::codegen::Bindings::NodeBinding::NodeMethods; use dom::bindings::error::{ErrorResult, Fallible}; use dom::bindings::inheritance::Castable; -use dom::bindings::root::{LayoutJS, MutNullableDom, Root, RootedReference}; +use dom::bindings::root::{LayoutDom, MutNullableDom, Root, RootedReference}; use dom::bindings::str::DOMString; use dom::document::Document; use dom::element::{Element, RawLayoutElementHelpers}; @@ -142,7 +142,7 @@ pub trait HTMLTableRowElementLayoutHelpers { } #[allow(unsafe_code)] -impl HTMLTableRowElementLayoutHelpers for LayoutJS { +impl HTMLTableRowElementLayoutHelpers for LayoutDom { fn get_background_color(&self) -> Option { unsafe { (&*self.upcast::().unsafe_get()) diff --git a/components/script/dom/htmltablesectionelement.rs b/components/script/dom/htmltablesectionelement.rs index e2165843b0fa..ffaaeea04273 100644 --- a/components/script/dom/htmltablesectionelement.rs +++ b/components/script/dom/htmltablesectionelement.rs @@ -7,7 +7,7 @@ use dom::bindings::codegen::Bindings::HTMLTableSectionElementBinding::{self, HTM use dom::bindings::codegen::Bindings::NodeBinding::NodeMethods; use dom::bindings::error::{ErrorResult, Fallible}; use dom::bindings::inheritance::Castable; -use dom::bindings::root::{LayoutJS, Root, RootedReference}; +use dom::bindings::root::{LayoutDom, Root, RootedReference}; use dom::bindings::str::DOMString; use dom::document::Document; use dom::element::{Element, RawLayoutElementHelpers}; @@ -81,7 +81,7 @@ pub trait HTMLTableSectionElementLayoutHelpers { } #[allow(unsafe_code)] -impl HTMLTableSectionElementLayoutHelpers for LayoutJS { +impl HTMLTableSectionElementLayoutHelpers for LayoutDom { fn get_background_color(&self) -> Option { unsafe { (&*self.upcast::().unsafe_get()) diff --git a/components/script/dom/htmltextareaelement.rs b/components/script/dom/htmltextareaelement.rs index 4958d2d3ca9f..6531586ca29b 100755 --- a/components/script/dom/htmltextareaelement.rs +++ b/components/script/dom/htmltextareaelement.rs @@ -9,7 +9,7 @@ use dom::bindings::codegen::Bindings::HTMLTextAreaElementBinding; use dom::bindings::codegen::Bindings::HTMLTextAreaElementBinding::HTMLTextAreaElementMethods; use dom::bindings::codegen::Bindings::NodeBinding::NodeMethods; use dom::bindings::inheritance::Castable; -use dom::bindings::root::{LayoutJS, MutNullableDom, Root}; +use dom::bindings::root::{LayoutDom, MutNullableDom, Root}; use dom::bindings::str::DOMString; use dom::document::Document; use dom::element::{AttributeMutation, Element}; @@ -57,7 +57,7 @@ pub trait LayoutHTMLTextAreaElementHelpers { fn get_rows(self) -> u32; } -impl LayoutHTMLTextAreaElementHelpers for LayoutJS { +impl LayoutHTMLTextAreaElementHelpers for LayoutDom { #[allow(unrooted_must_root)] #[allow(unsafe_code)] unsafe fn get_value_for_layout(self) -> String { diff --git a/components/script/dom/mod.rs b/components/script/dom/mod.rs index b14cca5f8202..8df3660a3f91 100644 --- a/components/script/dom/mod.rs +++ b/components/script/dom/mod.rs @@ -195,11 +195,11 @@ //! ================================= //! //! Layout code can access the DOM through the -//! [`LayoutJS`](bindings/root/struct.LayoutJS.html) smart pointer. This does not +//! [`LayoutDom`](bindings/root/struct.LayoutDom.html) smart pointer. This does not //! keep the DOM object alive; we ensure that no DOM code (Garbage Collection //! in particular) runs while the layout thread is accessing the DOM. //! -//! Methods accessible to layout are implemented on `LayoutJS` using +//! Methods accessible to layout are implemented on `LayoutDom` using //! `LayoutFooHelpers` traits. #[macro_use] diff --git a/components/script/dom/node.rs b/components/script/dom/node.rs index 2ce11daeb0f8..d036e846e573 100644 --- a/components/script/dom/node.rs +++ b/components/script/dom/node.rs @@ -23,7 +23,7 @@ use dom::bindings::inheritance::{Castable, CharacterDataTypeId, ElementTypeId}; use dom::bindings::inheritance::{EventTargetTypeId, HTMLElementTypeId, NodeTypeId}; use dom::bindings::inheritance::{SVGElementTypeId, SVGGraphicsElementTypeId}; use dom::bindings::reflector::{DomObject, reflect_dom_object}; -use dom::bindings::root::{Dom, LayoutJS, MutNullableDom, Root, RootedReference}; +use dom::bindings::root::{Dom, LayoutDom, MutNullableDom, Root, RootedReference}; use dom::bindings::str::{DOMString, USVString}; use dom::bindings::xmlname::namespace_from_domstring; use dom::characterdata::{CharacterData, LayoutCharacterDataHelpers}; @@ -999,13 +999,13 @@ pub unsafe fn from_untrusted_node_address(_runtime: *mut JSRuntime, candidate: U pub trait LayoutNodeHelpers { unsafe fn type_id_for_layout(&self) -> NodeTypeId; - unsafe fn parent_node_ref(&self) -> Option>; - unsafe fn first_child_ref(&self) -> Option>; - unsafe fn last_child_ref(&self) -> Option>; - unsafe fn prev_sibling_ref(&self) -> Option>; - unsafe fn next_sibling_ref(&self) -> Option>; + unsafe fn parent_node_ref(&self) -> Option>; + unsafe fn first_child_ref(&self) -> Option>; + unsafe fn last_child_ref(&self) -> Option>; + unsafe fn prev_sibling_ref(&self) -> Option>; + unsafe fn next_sibling_ref(&self) -> Option>; - unsafe fn owner_doc_for_layout(&self) -> LayoutJS; + unsafe fn owner_doc_for_layout(&self) -> LayoutDom; unsafe fn is_element_for_layout(&self) -> bool; unsafe fn get_flag(&self, flag: NodeFlags) -> bool; @@ -1027,7 +1027,7 @@ pub trait LayoutNodeHelpers { fn opaque(&self) -> OpaqueNode; } -impl LayoutNodeHelpers for LayoutJS { +impl LayoutNodeHelpers for LayoutDom { #[inline] #[allow(unsafe_code)] unsafe fn type_id_for_layout(&self) -> NodeTypeId { @@ -1042,37 +1042,37 @@ impl LayoutNodeHelpers for LayoutJS { #[inline] #[allow(unsafe_code)] - unsafe fn parent_node_ref(&self) -> Option> { + unsafe fn parent_node_ref(&self) -> Option> { (*self.unsafe_get()).parent_node.get_inner_as_layout() } #[inline] #[allow(unsafe_code)] - unsafe fn first_child_ref(&self) -> Option> { + unsafe fn first_child_ref(&self) -> Option> { (*self.unsafe_get()).first_child.get_inner_as_layout() } #[inline] #[allow(unsafe_code)] - unsafe fn last_child_ref(&self) -> Option> { + unsafe fn last_child_ref(&self) -> Option> { (*self.unsafe_get()).last_child.get_inner_as_layout() } #[inline] #[allow(unsafe_code)] - unsafe fn prev_sibling_ref(&self) -> Option> { + unsafe fn prev_sibling_ref(&self) -> Option> { (*self.unsafe_get()).prev_sibling.get_inner_as_layout() } #[inline] #[allow(unsafe_code)] - unsafe fn next_sibling_ref(&self) -> Option> { + unsafe fn next_sibling_ref(&self) -> Option> { (*self.unsafe_get()).next_sibling.get_inner_as_layout() } #[inline] #[allow(unsafe_code)] - unsafe fn owner_doc_for_layout(&self) -> LayoutJS { + unsafe fn owner_doc_for_layout(&self) -> LayoutDom { (*self.unsafe_get()).owner_doc.get_inner_as_layout().unwrap() } diff --git a/components/script/dom/svgsvgelement.rs b/components/script/dom/svgsvgelement.rs index b1ab9ddd50f8..e223d7f0b796 100644 --- a/components/script/dom/svgsvgelement.rs +++ b/components/script/dom/svgsvgelement.rs @@ -5,7 +5,7 @@ use dom::attr::Attr; use dom::bindings::codegen::Bindings::SVGSVGElementBinding; use dom::bindings::inheritance::Castable; -use dom::bindings::root::{LayoutJS, Root}; +use dom::bindings::root::{LayoutDom, Root}; use dom::bindings::str::DOMString; use dom::document::Document; use dom::element::{AttributeMutation, Element, RawLayoutElementHelpers}; @@ -49,7 +49,7 @@ pub trait LayoutSVGSVGElementHelpers { fn data(&self) -> SVGSVGData; } -impl LayoutSVGSVGElementHelpers for LayoutJS { +impl LayoutSVGSVGElementHelpers for LayoutDom { #[allow(unsafe_code)] fn data(&self) -> SVGSVGData { unsafe { diff --git a/components/script/dom/webglrenderingcontext.rs b/components/script/dom/webglrenderingcontext.rs index 9f3b9f286e8b..6ce1718d7995 100644 --- a/components/script/dom/webglrenderingcontext.rs +++ b/components/script/dom/webglrenderingcontext.rs @@ -20,7 +20,7 @@ use dom::bindings::conversions::{ConversionResult, FromJSValConvertible, ToJSVal use dom::bindings::error::{Error, Fallible}; use dom::bindings::inheritance::Castable; use dom::bindings::reflector::{DomObject, Reflector, reflect_dom_object}; -use dom::bindings::root::{Dom, LayoutJS, MutNullableDom, Root}; +use dom::bindings::root::{Dom, LayoutDom, MutNullableDom, Root}; use dom::bindings::str::DOMString; use dom::event::{Event, EventBubbles, EventCancelable}; use dom::htmlcanvaselement::HTMLCanvasElement; @@ -3384,7 +3384,7 @@ pub trait LayoutCanvasWebGLRenderingContextHelpers { unsafe fn canvas_data_source(&self) -> HTMLCanvasDataSource; } -impl LayoutCanvasWebGLRenderingContextHelpers for LayoutJS { +impl LayoutCanvasWebGLRenderingContextHelpers for LayoutDom { #[allow(unsafe_code)] unsafe fn canvas_data_source(&self) -> HTMLCanvasDataSource { HTMLCanvasDataSource::WebGL((*self.unsafe_get()).layout_handle()) diff --git a/components/script/lib.rs b/components/script/lib.rs index d382e95ced80..6a6a40417e3c 100644 --- a/components/script/lib.rs +++ b/components/script/lib.rs @@ -141,7 +141,7 @@ mod webdriver_handlers; pub mod layout_exports { pub use dom::bindings::inheritance::{CharacterDataTypeId, ElementTypeId}; pub use dom::bindings::inheritance::{HTMLElementTypeId, NodeTypeId}; - pub use dom::bindings::root::LayoutJS; + pub use dom::bindings::root::LayoutDom; pub use dom::characterdata::LayoutCharacterDataHelpers; pub use dom::document::{Document, LayoutDocumentHelpers, PendingRestyle}; pub use dom::element::{Element, LayoutElementHelpers, RawLayoutElementHelpers}; diff --git a/components/script_layout_interface/wrapper_traits.rs b/components/script_layout_interface/wrapper_traits.rs index d022360305b6..8221a3f885c3 100644 --- a/components/script_layout_interface/wrapper_traits.rs +++ b/components/script_layout_interface/wrapper_traits.rs @@ -79,7 +79,7 @@ pub trait GetLayoutData { } /// A wrapper so that layout can access only the methods that it should have access to. Layout must -/// only ever see these and must never see instances of `LayoutJS`. +/// only ever see these and must never see instances of `LayoutDom`. pub trait LayoutNode: Debug + GetLayoutData + TNode { type ConcreteThreadSafeLayoutNode: ThreadSafeLayoutNode; fn to_threadsafe(&self) -> Self::ConcreteThreadSafeLayoutNode; From 9a7ba89c841cc9ea2e2500813aa844b4d9c35828 Mon Sep 17 00:00:00 2001 From: Anthony Ramine Date: Tue, 26 Sep 2017 01:31:29 +0200 Subject: [PATCH 7/9] Rename OnceCellJS to DomOnceCell Like DOMRefCell. --- components/script/dom/bindings/root.rs | 14 +++++++------- components/script/dom/htmlformelement.rs | 4 ++-- 2 files changed, 9 insertions(+), 9 deletions(-) diff --git a/components/script/dom/bindings/root.rs b/components/script/dom/bindings/root.rs index f845bd3bd30c..417d4b9de52b 100644 --- a/components/script/dom/bindings/root.rs +++ b/components/script/dom/bindings/root.rs @@ -400,11 +400,11 @@ impl HeapSizeOf for MutNullableDom { /// This should only be used as a field in other DOM objects; see warning /// on `Dom`. #[must_root] -pub struct OnceCellJS { +pub struct DomOnceCell { ptr: OnceCell>, } -impl OnceCellJS { +impl DomOnceCell { /// Retrieve a copy of the current inner value. If it is `None`, it is /// initialized with the result of `cb` first. #[allow(unrooted_must_root)] @@ -416,17 +416,17 @@ impl OnceCellJS { } } -impl Default for OnceCellJS { +impl Default for DomOnceCell { #[allow(unrooted_must_root)] - fn default() -> OnceCellJS { + fn default() -> DomOnceCell { debug_assert!(thread_state::get().is_script()); - OnceCellJS { + DomOnceCell { ptr: OnceCell::new(), } } } -impl HeapSizeOf for OnceCellJS { +impl HeapSizeOf for DomOnceCell { fn heap_size_of_children(&self) -> usize { // See comment on HeapSizeOf for Dom. 0 @@ -434,7 +434,7 @@ impl HeapSizeOf for OnceCellJS { } #[allow(unrooted_must_root)] -unsafe impl JSTraceable for OnceCellJS { +unsafe impl JSTraceable for DomOnceCell { unsafe fn trace(&self, trc: *mut JSTracer) { if let Some(ptr) = self.ptr.as_ref() { ptr.trace(trc); diff --git a/components/script/dom/htmlformelement.rs b/components/script/dom/htmlformelement.rs index 5f553d1d4331..a062ca3f055d 100755 --- a/components/script/dom/htmlformelement.rs +++ b/components/script/dom/htmlformelement.rs @@ -15,7 +15,7 @@ use dom::bindings::codegen::Bindings::HTMLTextAreaElementBinding::HTMLTextAreaEl use dom::bindings::inheritance::{Castable, ElementTypeId, HTMLElementTypeId, NodeTypeId}; use dom::bindings::refcounted::Trusted; use dom::bindings::reflector::DomObject; -use dom::bindings::root::{Dom, OnceCellJS, Root, RootedReference}; +use dom::bindings::root::{Dom, DomOnceCell, Root, RootedReference}; use dom::bindings::str::DOMString; use dom::blob::Blob; use dom::document::Document; @@ -64,7 +64,7 @@ pub struct GenerationId(u32); pub struct HTMLFormElement { htmlelement: HTMLElement, marked_for_reset: Cell, - elements: OnceCellJS, + elements: DomOnceCell, generation_id: Cell, controls: DOMRefCell>>, } From 577370746e2ce3da7fa25a20b8e1bbeed319df65 Mon Sep 17 00:00:00 2001 From: Anthony Ramine Date: Tue, 26 Sep 2017 01:32:40 +0200 Subject: [PATCH 8/9] Rename DOMRefCell to DomRefCell I don't want to do such a gratuitous rename, but with all the other types now having "Dom" as part of their name, and especially with "DomOnceCell", I feel like the other cell type that we already have should also follow the convention. That argument loses weight though when we realise there is still DOMString and other things. --- components/script/dom/attr.rs | 6 +-- components/script/dom/beforeunloadevent.rs | 6 +-- components/script/dom/bindings/cell.rs | 18 +++---- components/script/dom/bindings/trace.rs | 4 +- components/script/dom/blob.rs | 14 ++--- components/script/dom/bluetooth.rs | 12 ++--- components/script/dom/bluetoothdevice.rs | 14 ++--- .../script/dom/bluetoothpermissionresult.rs | 6 +-- .../dom/bluetoothremotegattcharacteristic.rs | 6 +-- .../dom/bluetoothremotegattdescriptor.rs | 6 +-- components/script/dom/canvasgradient.rs | 6 +-- .../script/dom/canvasrenderingcontext2d.rs | 14 ++--- components/script/dom/characterdata.rs | 6 +-- components/script/dom/crypto.rs | 6 +-- components/script/dom/cssrulelist.rs | 6 +-- .../script/dom/customelementregistry.rs | 18 +++---- .../script/dom/dedicatedworkerglobalscope.rs | 6 +-- components/script/dom/document.rs | 54 +++++++++---------- components/script/dom/dommatrixreadonly.rs | 6 +-- components/script/dom/element.rs | 32 +++++------ components/script/dom/errorevent.rs | 10 ++-- components/script/dom/event.rs | 6 +-- components/script/dom/eventsource.rs | 10 ++-- components/script/dom/eventtarget.rs | 6 +-- components/script/dom/filereader.rs | 12 ++--- components/script/dom/formdata.rs | 6 +-- components/script/dom/gamepadlist.rs | 6 +-- components/script/dom/globalscope.rs | 6 +-- components/script/dom/headers.rs | 6 +-- components/script/dom/htmlanchorelement.rs | 6 +-- components/script/dom/htmlcanvaselement.rs | 6 +-- components/script/dom/htmldialogelement.rs | 6 +-- components/script/dom/htmlformelement.rs | 6 +-- components/script/dom/htmliframeelement.rs | 6 +-- components/script/dom/htmlimageelement.rs | 10 ++-- components/script/dom/htmlinputelement.rs | 14 ++--- components/script/dom/htmllinkelement.rs | 6 +-- components/script/dom/htmlmediaelement.rs | 16 +++--- components/script/dom/htmlmetaelement.rs | 6 +-- components/script/dom/htmlobjectelement.rs | 6 +-- components/script/dom/htmlstyleelement.rs | 6 +-- components/script/dom/htmltextareaelement.rs | 10 ++-- components/script/dom/keyboardevent.rs | 10 ++-- components/script/dom/mediaquerylist.rs | 6 +-- components/script/dom/mod.rs | 2 +- components/script/dom/mutationobserver.rs | 6 +-- components/script/dom/node.rs | 4 +- .../script/dom/paintworkletglobalscope.rs | 18 +++---- components/script/dom/performance.rs | 10 ++-- components/script/dom/performanceobserver.rs | 8 +-- .../dom/performanceobserverentrylist.rs | 6 +-- components/script/dom/request.rs | 14 ++--- components/script/dom/response.rs | 34 ++++++------ components/script/dom/serviceworker.rs | 6 +-- components/script/dom/servoparser/mod.rs | 18 +++---- components/script/dom/testbindingiterable.rs | 6 +-- .../script/dom/testbindingpairiterable.rs | 6 +-- .../script/dom/testworkletglobalscope.rs | 4 +- components/script/dom/url.rs | 6 +-- components/script/dom/urlsearchparams.rs | 6 +-- components/script/dom/vr.rs | 10 ++-- components/script/dom/vrdisplay.rs | 22 ++++---- .../script/dom/vrdisplaycapabilities.rs | 6 +-- components/script/dom/vreyeparameters.rs | 6 +-- components/script/dom/vrfieldofview.rs | 6 +-- components/script/dom/vrstageparameters.rs | 6 +-- .../ext/webglvertexarrayobjectoes.rs | 6 +-- .../script/dom/webgl_extensions/extensions.rs | 10 ++-- components/script/dom/webglbuffer.rs | 6 +-- components/script/dom/webglframebuffer.rs | 22 ++++---- .../script/dom/webglrenderingcontext.rs | 6 +-- components/script/dom/webglshader.rs | 10 ++-- components/script/dom/webgltexture.rs | 6 +-- components/script/dom/websocket.rs | 10 ++-- components/script/dom/window.rs | 28 +++++----- components/script/dom/xmlhttprequest.rs | 50 ++++++++--------- components/script/microtask.rs | 4 +- components/script/script_thread.rs | 34 ++++++------ components/script/serviceworkerjob.rs | 6 +-- components/script/test.rs | 2 +- components/script/timers.rs | 10 ++-- .../script_plugins/unrooted_must_root.rs | 4 +- python/tidy/servo_tidy/tidy.py | 6 +-- .../tidy/servo_tidy_tests/ban-domrefcell.rs | 6 +-- python/tidy/servo_tidy_tests/test_tidy.py | 2 +- 85 files changed, 436 insertions(+), 436 deletions(-) diff --git a/components/script/dom/attr.rs b/components/script/dom/attr.rs index ea9f1f23a789..36b0c4c8c269 100644 --- a/components/script/dom/attr.rs +++ b/components/script/dom/attr.rs @@ -3,7 +3,7 @@ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ use devtools_traits::AttrInfo; -use dom::bindings::cell::DOMRefCell; +use dom::bindings::cell::DomRefCell; use dom::bindings::codegen::Bindings::AttrBinding::{self, AttrMethods}; use dom::bindings::inheritance::Castable; use dom::bindings::reflector::{Reflector, reflect_dom_object}; @@ -29,7 +29,7 @@ use style::attr::{AttrIdentifier, AttrValue}; pub struct Attr { reflector_: Reflector, identifier: AttrIdentifier, - value: DOMRefCell, + value: DomRefCell, /// the element that owns this attribute. owner: MutNullableDom, @@ -51,7 +51,7 @@ impl Attr { namespace: namespace, prefix: prefix, }, - value: DOMRefCell::new(value), + value: DomRefCell::new(value), owner: MutNullableDom::new(owner), } } diff --git a/components/script/dom/beforeunloadevent.rs b/components/script/dom/beforeunloadevent.rs index dc435a206205..0f5f476ab598 100644 --- a/components/script/dom/beforeunloadevent.rs +++ b/components/script/dom/beforeunloadevent.rs @@ -4,7 +4,7 @@ #![allow(dead_code)] -use dom::bindings::cell::DOMRefCell; +use dom::bindings::cell::DomRefCell; use dom::bindings::codegen::Bindings::BeforeUnloadEventBinding; use dom::bindings::codegen::Bindings::BeforeUnloadEventBinding::BeforeUnloadEventMethods; use dom::bindings::codegen::Bindings::EventBinding::EventMethods; @@ -21,14 +21,14 @@ use servo_atoms::Atom; #[dom_struct] pub struct BeforeUnloadEvent { event: Event, - return_value: DOMRefCell, + return_value: DomRefCell, } impl BeforeUnloadEvent { fn new_inherited() -> BeforeUnloadEvent { BeforeUnloadEvent { event: Event::new_inherited(), - return_value: DOMRefCell::new(DOMString::new()), + return_value: DomRefCell::new(DOMString::new()), } } diff --git a/components/script/dom/bindings/cell.rs b/components/script/dom/bindings/cell.rs index 8e82de943818..2ae54fce97a1 100644 --- a/components/script/dom/bindings/cell.rs +++ b/components/script/dom/bindings/cell.rs @@ -12,14 +12,14 @@ use style::thread_state; /// This extends the API of `core::cell::RefCell` to allow unsafe access in /// certain situations, with dynamic checking in debug builds. #[derive(Clone, Debug, Default, HeapSizeOf, PartialEq)] -pub struct DOMRefCell { +pub struct DomRefCell { value: RefCell, } -// Functionality specific to Servo's `DOMRefCell` type +// Functionality specific to Servo's `DomRefCell` type // =================================================== -impl DOMRefCell { +impl DomRefCell { /// Return a reference to the contents. /// /// For use in the layout thread only. @@ -59,10 +59,10 @@ impl DOMRefCell { // Functionality duplicated with `core::cell::RefCell` // =================================================== -impl DOMRefCell { - /// Create a new `DOMRefCell` containing `value`. - pub fn new(value: T) -> DOMRefCell { - DOMRefCell { +impl DomRefCell { + /// Create a new `DomRefCell` containing `value`. + pub fn new(value: T) -> DomRefCell { + DomRefCell { value: RefCell::new(value), } } @@ -79,7 +79,7 @@ impl DOMRefCell { /// /// Panics if the value is currently mutably borrowed. pub fn borrow(&self) -> Ref { - self.try_borrow().expect("DOMRefCell already mutably borrowed") + self.try_borrow().expect("DomRefCell already mutably borrowed") } /// Mutably borrows the wrapped value. @@ -93,7 +93,7 @@ impl DOMRefCell { /// /// Panics if the value is currently borrowed. pub fn borrow_mut(&self) -> RefMut { - self.try_borrow_mut().expect("DOMRefCell already borrowed") + self.try_borrow_mut().expect("DomRefCell already borrowed") } /// Attempts to immutably borrow the wrapped value. diff --git a/components/script/dom/bindings/trace.rs b/components/script/dom/bindings/trace.rs index 74b78fa013aa..56b48b5750ca 100644 --- a/components/script/dom/bindings/trace.rs +++ b/components/script/dom/bindings/trace.rs @@ -38,7 +38,7 @@ use canvas_traits::webgl::{WebGLReceiver, WebGLSender, WebGLShaderId, WebGLTextu use cssparser::RGBA; use devtools_traits::{CSSError, TimelineMarkerType, WorkerId}; use dom::abstractworker::SharedRt; -use dom::bindings::cell::DOMRefCell; +use dom::bindings::cell::DomRefCell; use dom::bindings::error::Error; use dom::bindings::refcounted::{Trusted, TrustedPromise}; use dom::bindings::reflector::{DomObject, Reflector}; @@ -202,7 +202,7 @@ unsafe impl JSTraceable for UnsafeCell { } } -unsafe impl JSTraceable for DOMRefCell { +unsafe impl JSTraceable for DomRefCell { unsafe fn trace(&self, trc: *mut JSTracer) { (*self).borrow_for_gc_trace().trace(trc) } diff --git a/components/script/dom/blob.rs b/components/script/dom/blob.rs index 835c17c9334c..7317f9f8d56b 100644 --- a/components/script/dom/blob.rs +++ b/components/script/dom/blob.rs @@ -2,7 +2,7 @@ * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ -use dom::bindings::cell::DOMRefCell; +use dom::bindings::cell::DomRefCell; use dom::bindings::codegen::Bindings::BlobBinding; use dom::bindings::codegen::Bindings::BlobBinding::BlobMethods; use dom::bindings::codegen::UnionTypes::BlobOrString; @@ -27,7 +27,7 @@ use uuid::Uuid; pub struct FileBlob { id: Uuid, name: Option, - cache: DOMRefCell>>, + cache: DomRefCell>>, size: u64, } @@ -59,7 +59,7 @@ impl BlobImpl { BlobImpl::File(FileBlob { id: file_id, name: Some(name), - cache: DOMRefCell::new(None), + cache: DomRefCell::new(None), size: size, }) } @@ -70,7 +70,7 @@ impl BlobImpl { pub struct Blob { reflector_: Reflector, #[ignore_heap_size_of = "No clear owner"] - blob_impl: DOMRefCell, + blob_impl: DomRefCell, /// content-type string type_string: String, } @@ -88,7 +88,7 @@ impl Blob { pub fn new_inherited(blob_impl: BlobImpl, type_string: String) -> Blob { Blob { reflector_: Reflector::new(), - blob_impl: DOMRefCell::new(blob_impl), + blob_impl: DomRefCell::new(blob_impl), // NOTE: Guarding the format correctness here, // https://w3c.github.io/FileAPI/#dfn-type type_string: normalize_type_string(&type_string), @@ -237,7 +237,7 @@ impl Blob { *self.blob_impl.borrow_mut() = BlobImpl::File(FileBlob { id: id.clone(), name: None, - cache: DOMRefCell::new(Some(bytes.to_vec())), + cache: DomRefCell::new(Some(bytes.to_vec())), size: bytes.len() as u64, }); id @@ -262,7 +262,7 @@ impl Blob { *self.blob_impl.borrow_mut() = BlobImpl::File(FileBlob { id: new_id.clone(), name: None, - cache: DOMRefCell::new(None), + cache: DomRefCell::new(None), size: rel_pos.to_abs_range(parent_len as usize).len() as u64, }); diff --git a/components/script/dom/bluetooth.rs b/components/script/dom/bluetooth.rs index 34f5e37ba616..1815a1a07bc4 100644 --- a/components/script/dom/bluetooth.rs +++ b/components/script/dom/bluetooth.rs @@ -8,7 +8,7 @@ use bluetooth_traits::blocklist::{Blocklist, uuid_is_blocklisted}; use bluetooth_traits::scanfilter::{BluetoothScanfilter, BluetoothScanfilterSequence}; use bluetooth_traits::scanfilter::{RequestDeviceoptions, ServiceUUIDSequence}; use core::clone::Clone; -use dom::bindings::cell::DOMRefCell; +use dom::bindings::cell::DomRefCell; use dom::bindings::codegen::Bindings::BluetoothBinding::{self, BluetoothDataFilterInit, BluetoothLEScanFilterInit}; use dom::bindings::codegen::Bindings::BluetoothBinding::{BluetoothMethods, RequestDeviceOptions}; use dom::bindings::codegen::Bindings::BluetoothPermissionResultBinding::BluetoothPermissionDescriptor; @@ -65,13 +65,13 @@ pub struct AllowedBluetoothDevice { #[derive(HeapSizeOf, JSTraceable)] pub struct BluetoothExtraPermissionData { - allowed_devices: DOMRefCell>, + allowed_devices: DomRefCell>, } impl BluetoothExtraPermissionData { pub fn new() -> BluetoothExtraPermissionData { BluetoothExtraPermissionData { - allowed_devices: DOMRefCell::new(Vec::new()), + allowed_devices: DomRefCell::new(Vec::new()), } } @@ -120,14 +120,14 @@ where #[dom_struct] pub struct Bluetooth { eventtarget: EventTarget, - device_instance_map: DOMRefCell>>, + device_instance_map: DomRefCell>>, } impl Bluetooth { pub fn new_inherited() -> Bluetooth { Bluetooth { eventtarget: EventTarget::new_inherited(), - device_instance_map: DOMRefCell::new(HashMap::new()), + device_instance_map: DomRefCell::new(HashMap::new()), } } @@ -141,7 +141,7 @@ impl Bluetooth { self.global().as_window().bluetooth_thread() } - pub fn get_device_map(&self) -> &DOMRefCell>> { + pub fn get_device_map(&self) -> &DomRefCell>> { &self.device_instance_map } diff --git a/components/script/dom/bluetoothdevice.rs b/components/script/dom/bluetoothdevice.rs index d98a1ed42f5f..ce2f2845b2af 100644 --- a/components/script/dom/bluetoothdevice.rs +++ b/components/script/dom/bluetoothdevice.rs @@ -4,7 +4,7 @@ use bluetooth_traits::{BluetoothCharacteristicMsg, BluetoothDescriptorMsg}; use bluetooth_traits::{BluetoothRequest, BluetoothResponse, BluetoothServiceMsg}; -use dom::bindings::cell::DOMRefCell; +use dom::bindings::cell::DomRefCell; use dom::bindings::codegen::Bindings::BluetoothDeviceBinding; use dom::bindings::codegen::Bindings::BluetoothDeviceBinding::BluetoothDeviceMethods; use dom::bindings::codegen::Bindings::BluetoothRemoteGATTServerBinding::BluetoothRemoteGATTServerMethods; @@ -37,9 +37,9 @@ pub struct BluetoothDevice { name: Option, gatt: MutNullableDom, context: Dom, - attribute_instance_map: (DOMRefCell>>, - DOMRefCell>>, - DOMRefCell>>), + attribute_instance_map: (DomRefCell>>, + DomRefCell>>, + DomRefCell>>), watching_advertisements: Cell, } @@ -54,9 +54,9 @@ impl BluetoothDevice { name: name, gatt: Default::default(), context: Dom::from_ref(context), - attribute_instance_map: (DOMRefCell::new(HashMap::new()), - DOMRefCell::new(HashMap::new()), - DOMRefCell::new(HashMap::new())), + attribute_instance_map: (DomRefCell::new(HashMap::new()), + DomRefCell::new(HashMap::new()), + DomRefCell::new(HashMap::new())), watching_advertisements: Cell::new(false), } } diff --git a/components/script/dom/bluetoothpermissionresult.rs b/components/script/dom/bluetoothpermissionresult.rs index 05aeaf065203..57e22968726b 100644 --- a/components/script/dom/bluetoothpermissionresult.rs +++ b/components/script/dom/bluetoothpermissionresult.rs @@ -3,7 +3,7 @@ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ use bluetooth_traits::{BluetoothRequest, BluetoothResponse}; -use dom::bindings::cell::DOMRefCell; +use dom::bindings::cell::DomRefCell; use dom::bindings::codegen::Bindings::BluetoothPermissionResultBinding::{self, BluetoothPermissionResultMethods}; use dom::bindings::codegen::Bindings::NavigatorBinding::NavigatorBinding::NavigatorMethods; use dom::bindings::codegen::Bindings::PermissionStatusBinding::{PermissionName, PermissionState}; @@ -26,7 +26,7 @@ use std::rc::Rc; #[dom_struct] pub struct BluetoothPermissionResult { status: PermissionStatus, - devices: DOMRefCell>>, + devices: DomRefCell>>, } impl BluetoothPermissionResult { @@ -34,7 +34,7 @@ impl BluetoothPermissionResult { fn new_inherited(status: &PermissionStatus) -> BluetoothPermissionResult { let result = BluetoothPermissionResult { status: PermissionStatus::new_inherited(status.get_query()), - devices: DOMRefCell::new(Vec::new()), + devices: DomRefCell::new(Vec::new()), }; result.status.set_state(status.State()); result diff --git a/components/script/dom/bluetoothremotegattcharacteristic.rs b/components/script/dom/bluetoothremotegattcharacteristic.rs index 276afafa7bcb..daefa2dea2f7 100644 --- a/components/script/dom/bluetoothremotegattcharacteristic.rs +++ b/components/script/dom/bluetoothremotegattcharacteristic.rs @@ -4,7 +4,7 @@ use bluetooth_traits::{BluetoothRequest, BluetoothResponse, GATTType}; use bluetooth_traits::blocklist::{Blocklist, uuid_is_blocklisted}; -use dom::bindings::cell::DOMRefCell; +use dom::bindings::cell::DomRefCell; use dom::bindings::codegen::Bindings::BluetoothCharacteristicPropertiesBinding:: BluetoothCharacteristicPropertiesMethods; use dom::bindings::codegen::Bindings::BluetoothRemoteGATTCharacteristicBinding; @@ -39,7 +39,7 @@ pub struct BluetoothRemoteGATTCharacteristic { service: Dom, uuid: DOMString, properties: Dom, - value: DOMRefCell>, + value: DomRefCell>, instance_id: String, } @@ -54,7 +54,7 @@ impl BluetoothRemoteGATTCharacteristic { service: Dom::from_ref(service), uuid: uuid, properties: Dom::from_ref(properties), - value: DOMRefCell::new(None), + value: DomRefCell::new(None), instance_id: instance_id, } } diff --git a/components/script/dom/bluetoothremotegattdescriptor.rs b/components/script/dom/bluetoothremotegattdescriptor.rs index b9f33b0313e4..66a07e3b4f0e 100644 --- a/components/script/dom/bluetoothremotegattdescriptor.rs +++ b/components/script/dom/bluetoothremotegattdescriptor.rs @@ -4,7 +4,7 @@ use bluetooth_traits::{BluetoothRequest, BluetoothResponse}; use bluetooth_traits::blocklist::{Blocklist, uuid_is_blocklisted}; -use dom::bindings::cell::DOMRefCell; +use dom::bindings::cell::DomRefCell; use dom::bindings::codegen::Bindings::BluetoothRemoteGATTCharacteristicBinding:: BluetoothRemoteGATTCharacteristicMethods; use dom::bindings::codegen::Bindings::BluetoothRemoteGATTDescriptorBinding; @@ -29,7 +29,7 @@ pub struct BluetoothRemoteGATTDescriptor { reflector_: Reflector, characteristic: Dom, uuid: DOMString, - value: DOMRefCell>, + value: DomRefCell>, instance_id: String, } @@ -42,7 +42,7 @@ impl BluetoothRemoteGATTDescriptor { reflector_: Reflector::new(), characteristic: Dom::from_ref(characteristic), uuid: uuid, - value: DOMRefCell::new(None), + value: DomRefCell::new(None), instance_id: instance_id, } } diff --git a/components/script/dom/canvasgradient.rs b/components/script/dom/canvasgradient.rs index afa782b6e9d2..b6568119cfb6 100644 --- a/components/script/dom/canvasgradient.rs +++ b/components/script/dom/canvasgradient.rs @@ -5,7 +5,7 @@ use canvas_traits::canvas::{CanvasGradientStop, FillOrStrokeStyle, LinearGradientStyle, RadialGradientStyle}; use cssparser::{Parser, ParserInput, RGBA}; use cssparser::Color as CSSColor; -use dom::bindings::cell::DOMRefCell; +use dom::bindings::cell::DomRefCell; use dom::bindings::codegen::Bindings::CanvasGradientBinding; use dom::bindings::codegen::Bindings::CanvasGradientBinding::CanvasGradientMethods; use dom::bindings::error::{Error, ErrorResult}; @@ -21,7 +21,7 @@ use dom_struct::dom_struct; pub struct CanvasGradient { reflector_: Reflector, style: CanvasGradientStyle, - stops: DOMRefCell>, + stops: DomRefCell>, } #[derive(Clone, HeapSizeOf, JSTraceable)] @@ -35,7 +35,7 @@ impl CanvasGradient { CanvasGradient { reflector_: Reflector::new(), style: style, - stops: DOMRefCell::new(Vec::new()), + stops: DomRefCell::new(Vec::new()), } } diff --git a/components/script/dom/canvasrenderingcontext2d.rs b/components/script/dom/canvasrenderingcontext2d.rs index cf898b068806..b9e7def9a1ca 100644 --- a/components/script/dom/canvasrenderingcontext2d.rs +++ b/components/script/dom/canvasrenderingcontext2d.rs @@ -8,7 +8,7 @@ use canvas_traits::canvas::{LineCapStyle, LineJoinStyle, LinearGradientStyle}; use canvas_traits::canvas::{RadialGradientStyle, RepetitionStyle, byte_swap_and_premultiply}; use cssparser::{Parser, ParserInput, RGBA}; use cssparser::Color as CSSColor; -use dom::bindings::cell::DOMRefCell; +use dom::bindings::cell::DomRefCell; use dom::bindings::codegen::Bindings::CSSStyleDeclarationBinding::CSSStyleDeclarationMethods; use dom::bindings::codegen::Bindings::CanvasRenderingContext2DBinding; use dom::bindings::codegen::Bindings::CanvasRenderingContext2DBinding::CanvasFillRule; @@ -71,12 +71,12 @@ pub struct CanvasRenderingContext2D { #[ignore_heap_size_of = "Arc"] image_cache: Arc, /// Any missing image URLs. - missing_image_urls: DOMRefCell>, + missing_image_urls: DomRefCell>, /// The base URL for resolving CSS image URL values. /// Needed because of https://github.com/servo/servo/issues/17625 base_url: ServoUrl, - state: DOMRefCell, - saved_states: DOMRefCell>, + state: DomRefCell, + saved_states: DomRefCell>, origin_clean: Cell, } @@ -140,10 +140,10 @@ impl CanvasRenderingContext2D { ipc_renderer: ipc_renderer, canvas: canvas.map(Dom::from_ref), image_cache: image_cache, - missing_image_urls: DOMRefCell::new(Vec::new()), + missing_image_urls: DomRefCell::new(Vec::new()), base_url: base_url, - state: DOMRefCell::new(CanvasContextState::new()), - saved_states: DOMRefCell::new(Vec::new()), + state: DomRefCell::new(CanvasContextState::new()), + saved_states: DomRefCell::new(Vec::new()), origin_clean: Cell::new(true), } } diff --git a/components/script/dom/characterdata.rs b/components/script/dom/characterdata.rs index 38a30e8ef50e..4d6c3a8f0112 100644 --- a/components/script/dom/characterdata.rs +++ b/components/script/dom/characterdata.rs @@ -4,7 +4,7 @@ //! DOM bindings for `CharacterData`. -use dom::bindings::cell::DOMRefCell; +use dom::bindings::cell::DomRefCell; use dom::bindings::codegen::Bindings::CharacterDataBinding::CharacterDataMethods; use dom::bindings::codegen::Bindings::NodeBinding::NodeBinding::NodeMethods; use dom::bindings::codegen::Bindings::ProcessingInstructionBinding::ProcessingInstructionMethods; @@ -29,14 +29,14 @@ use std::cell::Ref; #[dom_struct] pub struct CharacterData { node: Node, - data: DOMRefCell, + data: DomRefCell, } impl CharacterData { pub fn new_inherited(data: DOMString, document: &Document) -> CharacterData { CharacterData { node: Node::new_inherited(document), - data: DOMRefCell::new(data), + data: DomRefCell::new(data), } } diff --git a/components/script/dom/crypto.rs b/components/script/dom/crypto.rs index 117f1ff2b1ff..afde6f47be92 100644 --- a/components/script/dom/crypto.rs +++ b/components/script/dom/crypto.rs @@ -3,7 +3,7 @@ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ use core::nonzero::NonZero; -use dom::bindings::cell::DOMRefCell; +use dom::bindings::cell::DomRefCell; use dom::bindings::codegen::Bindings::CryptoBinding; use dom::bindings::codegen::Bindings::CryptoBinding::CryptoMethods; use dom::bindings::error::{Error, Fallible}; @@ -22,14 +22,14 @@ unsafe_no_jsmanaged_fields!(ServoRng); pub struct Crypto { reflector_: Reflector, #[ignore_heap_size_of = "Defined in rand"] - rng: DOMRefCell, + rng: DomRefCell, } impl Crypto { fn new_inherited() -> Crypto { Crypto { reflector_: Reflector::new(), - rng: DOMRefCell::new(ServoRng::new()), + rng: DomRefCell::new(ServoRng::new()), } } diff --git a/components/script/dom/cssrulelist.rs b/components/script/dom/cssrulelist.rs index 8fdef21c4d0e..1690b2f71d11 100644 --- a/components/script/dom/cssrulelist.rs +++ b/components/script/dom/cssrulelist.rs @@ -2,7 +2,7 @@ * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ -use dom::bindings::cell::DOMRefCell; +use dom::bindings::cell::DomRefCell; use dom::bindings::codegen::Bindings::CSSRuleListBinding; use dom::bindings::codegen::Bindings::CSSRuleListBinding::CSSRuleListMethods; use dom::bindings::error::{Error, ErrorResult, Fallible}; @@ -39,7 +39,7 @@ pub struct CSSRuleList { parent_stylesheet: Dom, #[ignore_heap_size_of = "Arc"] rules: RulesSource, - dom_rules: DOMRefCell>> + dom_rules: DomRefCell>> } pub enum RulesSource { @@ -64,7 +64,7 @@ impl CSSRuleList { reflector_: Reflector::new(), parent_stylesheet: Dom::from_ref(parent_stylesheet), rules: rules, - dom_rules: DOMRefCell::new(dom_rules), + dom_rules: DomRefCell::new(dom_rules), } } diff --git a/components/script/dom/customelementregistry.rs b/components/script/dom/customelementregistry.rs index 25a824c5d78a..503605428ab5 100644 --- a/components/script/dom/customelementregistry.rs +++ b/components/script/dom/customelementregistry.rs @@ -3,7 +3,7 @@ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ use dom::bindings::callback::{CallbackContainer, ExceptionHandling}; -use dom::bindings::cell::DOMRefCell; +use dom::bindings::cell::DomRefCell; use dom::bindings::codegen::Bindings::CustomElementRegistryBinding; use dom::bindings::codegen::Bindings::CustomElementRegistryBinding::CustomElementRegistryMethods; use dom::bindings::codegen::Bindings::CustomElementRegistryBinding::ElementDefinitionOptions; @@ -48,12 +48,12 @@ pub struct CustomElementRegistry { window: Dom, #[ignore_heap_size_of = "Rc"] - when_defined: DOMRefCell>>, + when_defined: DomRefCell>>, element_definition_is_running: Cell, #[ignore_heap_size_of = "Rc"] - definitions: DOMRefCell>>, + definitions: DomRefCell>>, } impl CustomElementRegistry { @@ -61,9 +61,9 @@ impl CustomElementRegistry { CustomElementRegistry { reflector_: Reflector::new(), window: Dom::from_ref(window), - when_defined: DOMRefCell::new(HashMap::new()), + when_defined: DomRefCell::new(HashMap::new()), element_definition_is_running: Cell::new(false), - definitions: DOMRefCell::new(HashMap::new()), + definitions: DomRefCell::new(HashMap::new()), } } @@ -404,7 +404,7 @@ pub struct CustomElementDefinition { pub callbacks: LifecycleCallbacks, - pub construction_stack: DOMRefCell>, + pub construction_stack: DomRefCell>, } impl CustomElementDefinition { @@ -627,7 +627,7 @@ enum BackupElementQueueFlag { #[derive(HeapSizeOf, JSTraceable)] #[must_root] pub struct CustomElementReactionStack { - stack: DOMRefCell>, + stack: DomRefCell>, backup_queue: ElementQueue, processing_backup_element_queue: Cell, } @@ -635,7 +635,7 @@ pub struct CustomElementReactionStack { impl CustomElementReactionStack { pub fn new() -> CustomElementReactionStack { CustomElementReactionStack { - stack: DOMRefCell::new(Vec::new()), + stack: DomRefCell::new(Vec::new()), backup_queue: ElementQueue::new(), processing_backup_element_queue: Cell::new(BackupElementQueueFlag::NotProcessing), } @@ -776,7 +776,7 @@ impl CustomElementReactionStack { #[derive(HeapSizeOf, JSTraceable)] #[must_root] struct ElementQueue { - queue: DOMRefCell>>, + queue: DomRefCell>>, } impl ElementQueue { diff --git a/components/script/dom/dedicatedworkerglobalscope.rs b/components/script/dom/dedicatedworkerglobalscope.rs index c77c857db5f9..a52738652835 100644 --- a/components/script/dom/dedicatedworkerglobalscope.rs +++ b/components/script/dom/dedicatedworkerglobalscope.rs @@ -6,7 +6,7 @@ use devtools; use devtools_traits::DevtoolScriptControlMsg; use dom::abstractworker::{SharedRt, SimpleWorkerErrorHandler, WorkerScriptMsg}; use dom::abstractworkerglobalscope::{SendableWorkerScriptChan, WorkerThreadWorkerChan}; -use dom::bindings::cell::DOMRefCell; +use dom::bindings::cell::DomRefCell; use dom::bindings::codegen::Bindings::DedicatedWorkerGlobalScopeBinding; use dom::bindings::codegen::Bindings::DedicatedWorkerGlobalScopeBinding::DedicatedWorkerGlobalScopeMethods; use dom::bindings::error::{ErrorInfo, ErrorResult}; @@ -87,7 +87,7 @@ pub struct DedicatedWorkerGlobalScope { #[ignore_heap_size_of = "Defined in std"] timer_event_port: Receiver<(TrustedWorkerAddress, TimerEvent)>, #[ignore_heap_size_of = "Trusted has unclear ownership like Dom"] - worker: DOMRefCell>, + worker: DomRefCell>, #[ignore_heap_size_of = "Can't measure trait objects"] /// Sender to the parent thread. parent_sender: Box, @@ -116,7 +116,7 @@ impl DedicatedWorkerGlobalScope { own_sender: own_sender, timer_event_port: timer_event_port, parent_sender: parent_sender, - worker: DOMRefCell::new(None), + worker: DomRefCell::new(None), } } diff --git a/components/script/dom/document.rs b/components/script/dom/document.rs index 48e4103e76ec..7b6bd5e793c5 100644 --- a/components/script/dom/document.rs +++ b/components/script/dom/document.rs @@ -10,7 +10,7 @@ use dom::activation::{ActivationSource, synthetic_click_activation}; use dom::attr::Attr; use dom::beforeunloadevent::BeforeUnloadEvent; use dom::bindings::callback::ExceptionHandling; -use dom::bindings::cell::DOMRefCell; +use dom::bindings::cell::DomRefCell; use dom::bindings::codegen::Bindings::DOMRectBinding::DOMRectMethods; use dom::bindings::codegen::Bindings::DocumentBinding; use dom::bindings::codegen::Bindings::DocumentBinding::{DocumentMethods, DocumentReadyState, ElementCreationOptions}; @@ -231,14 +231,14 @@ pub struct Document { has_browsing_context: bool, is_html_document: bool, activity: Cell, - url: DOMRefCell, + url: DomRefCell, #[ignore_heap_size_of = "defined in selectors"] quirks_mode: Cell, /// Caches for the getElement methods - id_map: DOMRefCell>>>, - tag_map: DOMRefCell>>, - tagns_map: DOMRefCell>>, - classes_map: DOMRefCell, Dom>>, + id_map: DomRefCell>>>, + tag_map: DomRefCell>>, + tagns_map: DomRefCell>>, + classes_map: DomRefCell, Dom>>, images: MutNullableDom, embeds: MutNullableDom, links: MutNullableDom, @@ -250,7 +250,7 @@ pub struct Document { /// Can be acquired once for accessing many objects. style_shared_lock: StyleSharedRwLock, /// List of stylesheets associated with nodes in this document. |None| if the list needs to be refreshed. - stylesheets: DOMRefCell>, + stylesheets: DomRefCell>, stylesheet_list: MutNullableDom, ready_state: Cell, /// Whether the DOMContentLoaded event has already been dispatched. @@ -262,7 +262,7 @@ pub struct Document { /// The script element that is currently executing. current_script: MutNullableDom, /// https://html.spec.whatwg.org/multipage/#pending-parsing-blocking-script - pending_parsing_blocking_script: DOMRefCell>, + pending_parsing_blocking_script: DomRefCell>, /// Number of stylesheets that block executing the next parser-inserted script script_blocking_stylesheets_count: Cell, /// https://html.spec.whatwg.org/multipage/#list-of-scripts-that-will-execute-when-the-document-has-finished-parsing @@ -270,7 +270,7 @@ pub struct Document { /// https://html.spec.whatwg.org/multipage/#list-of-scripts-that-will-execute-in-order-as-soon-as-possible asap_in_order_scripts_list: PendingInOrderScriptVec, /// https://html.spec.whatwg.org/multipage/#set-of-scripts-that-will-execute-as-soon-as-possible - asap_scripts_set: DOMRefCell>>, + asap_scripts_set: DomRefCell>>, /// https://html.spec.whatwg.org/multipage/#concept-n-noscript /// True if scripting is enabled for all scripts in this document scripting_enabled: bool, @@ -279,14 +279,14 @@ pub struct Document { animation_frame_ident: Cell, /// https://html.spec.whatwg.org/multipage/#list-of-animation-frame-callbacks /// List of animation frame callbacks - animation_frame_list: DOMRefCell)>>, + animation_frame_list: DomRefCell)>>, /// Whether we're in the process of running animation callbacks. /// /// Tracking this is not necessary for correctness. Instead, it is an optimization to avoid /// sending needless `ChangeRunningAnimationsState` messages to the compositor. running_animation_callbacks: Cell, /// Tracks all outstanding loads related to this document. - loader: DOMRefCell, + loader: DomRefCell, /// The current active HTML parser, to allow resuming after interruptions. current_parser: MutNullableDom, /// When we should kick off a reflow. This happens during parsing. @@ -298,12 +298,12 @@ pub struct Document { appropriate_template_contents_owner_document: MutNullableDom, /// Information on elements needing restyle to ship over to the layout thread when the /// time comes. - pending_restyles: DOMRefCell, PendingRestyle>>, + pending_restyles: DomRefCell, PendingRestyle>>, /// This flag will be true if layout suppressed a reflow attempt that was /// needed in order for the page to be painted. needs_paint: Cell, /// http://w3c.github.io/touch-events/#dfn-active-touch-point - active_touch_points: DOMRefCell>>, + active_touch_points: DomRefCell>>, /// Navigation Timing properties: /// https://w3c.github.io/navigation-timing/#sec-PerformanceNavigationTiming dom_loading: Cell, @@ -326,7 +326,7 @@ pub struct Document { target_element: MutNullableDom, /// https://w3c.github.io/uievents/#event-type-dblclick #[ignore_heap_size_of = "Defined in std"] - last_click_info: DOMRefCell)>>, + last_click_info: DomRefCell)>>, /// https://html.spec.whatwg.org/multipage/#ignore-destructive-writes-counter ignore_destructive_writes_counter: Cell, /// The number of spurious `requestAnimationFrame()` requests we've received. @@ -347,7 +347,7 @@ pub struct Document { /// whenever any element with the same ID as the form attribute /// is inserted or removed from the document. /// See https://html.spec.whatwg.org/multipage/#form-owner - form_id_listener_map: DOMRefCell>>>, + form_id_listener_map: DomRefCell>>>, } #[derive(HeapSizeOf, JSTraceable)] @@ -2230,17 +2230,17 @@ impl Document { }), }, last_modified: last_modified, - url: DOMRefCell::new(url), + url: DomRefCell::new(url), // https://dom.spec.whatwg.org/#concept-document-quirks quirks_mode: Cell::new(QuirksMode::NoQuirks), // https://dom.spec.whatwg.org/#concept-document-encoding encoding: Cell::new(UTF_8), is_html_document: is_html_document == IsHTMLDocument::HTMLDocument, activity: Cell::new(activity), - id_map: DOMRefCell::new(HashMap::new()), - tag_map: DOMRefCell::new(HashMap::new()), - tagns_map: DOMRefCell::new(HashMap::new()), - classes_map: DOMRefCell::new(HashMap::new()), + id_map: DomRefCell::new(HashMap::new()), + tag_map: DomRefCell::new(HashMap::new()), + tagns_map: DomRefCell::new(HashMap::new()), + classes_map: DomRefCell::new(HashMap::new()), images: Default::default(), embeds: Default::default(), links: Default::default(), @@ -2263,7 +2263,7 @@ impl Document { PER_PROCESS_AUTHOR_SHARED_LOCK.clone() //StyleSharedRwLock::new() }, - stylesheets: DOMRefCell::new(StylesheetSet::new()), + stylesheets: DomRefCell::new(StylesheetSet::new()), stylesheet_list: MutNullableDom::new(None), ready_state: Cell::new(ready_state), domcontentloaded_dispatched: Cell::new(domcontentloaded_dispatched), @@ -2277,16 +2277,16 @@ impl Document { asap_scripts_set: Default::default(), scripting_enabled: has_browsing_context == HasBrowsingContext::Yes, animation_frame_ident: Cell::new(0), - animation_frame_list: DOMRefCell::new(vec![]), + animation_frame_list: DomRefCell::new(vec![]), running_animation_callbacks: Cell::new(false), - loader: DOMRefCell::new(doc_loader), + loader: DomRefCell::new(doc_loader), current_parser: Default::default(), reflow_timeout: Cell::new(None), base_element: Default::default(), appropriate_template_contents_owner_document: Default::default(), - pending_restyles: DOMRefCell::new(HashMap::new()), + pending_restyles: DomRefCell::new(HashMap::new()), needs_paint: Cell::new(false), - active_touch_points: DOMRefCell::new(Vec::new()), + active_touch_points: DomRefCell::new(Vec::new()), dom_loading: Cell::new(Default::default()), dom_interactive: Cell::new(Default::default()), dom_content_loaded_event_start: Cell::new(Default::default()), @@ -2300,7 +2300,7 @@ impl Document { referrer: referrer, referrer_policy: Cell::new(referrer_policy), target_element: MutNullableDom::new(None), - last_click_info: DOMRefCell::new(None), + last_click_info: DomRefCell::new(None), ignore_destructive_writes_counter: Default::default(), spurious_animation_frames: Cell::new(0), dom_count: Cell::new(1), @@ -4081,7 +4081,7 @@ impl AnimationFrameCallback { #[derive(Default, HeapSizeOf, JSTraceable)] #[must_root] struct PendingInOrderScriptVec { - scripts: DOMRefCell>, + scripts: DomRefCell>, } impl PendingInOrderScriptVec { diff --git a/components/script/dom/dommatrixreadonly.rs b/components/script/dom/dommatrixreadonly.rs index df4e0d74dfe9..0b6e8be3b6ac 100644 --- a/components/script/dom/dommatrixreadonly.rs +++ b/components/script/dom/dommatrixreadonly.rs @@ -2,7 +2,7 @@ * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ -use dom::bindings::cell::DOMRefCell; +use dom::bindings::cell::DomRefCell; use dom::bindings::codegen::Bindings::DOMMatrixBinding::{DOMMatrixInit, DOMMatrixMethods}; use dom::bindings::codegen::Bindings::DOMMatrixReadOnlyBinding::{DOMMatrixReadOnlyMethods, Wrap}; use dom::bindings::codegen::Bindings::DOMPointBinding::DOMPointInit; @@ -21,7 +21,7 @@ use std::f64; #[dom_struct] pub struct DOMMatrixReadOnly { reflector_: Reflector, - matrix: DOMRefCell>, + matrix: DomRefCell>, is2D: Cell, } @@ -35,7 +35,7 @@ impl DOMMatrixReadOnly { pub fn new_inherited(is2D: bool, matrix: Transform3D) -> Self { DOMMatrixReadOnly { reflector_: Reflector::new(), - matrix: DOMRefCell::new(matrix), + matrix: DomRefCell::new(matrix), is2D: Cell::new(is2D), } } diff --git a/components/script/dom/element.rs b/components/script/dom/element.rs index 79bbb3b11e3e..30fa0b59b4a7 100644 --- a/components/script/dom/element.rs +++ b/components/script/dom/element.rs @@ -7,7 +7,7 @@ use devtools_traits::AttrInfo; use dom::activation::Activatable; use dom::attr::{Attr, AttrHelpersForLayout}; -use dom::bindings::cell::DOMRefCell; +use dom::bindings::cell::DomRefCell; use dom::bindings::codegen::Bindings::AttrBinding::AttrMethods; use dom::bindings::codegen::Bindings::DocumentBinding::DocumentMethods; use dom::bindings::codegen::Bindings::ElementBinding; @@ -130,12 +130,12 @@ pub struct Element { local_name: LocalName, tag_name: TagName, namespace: Namespace, - prefix: DOMRefCell>, - attrs: DOMRefCell>>, - id_attribute: DOMRefCell>, - is: DOMRefCell>, + prefix: DomRefCell>, + attrs: DomRefCell>>, + id_attribute: DomRefCell>, + is: DomRefCell>, #[ignore_heap_size_of = "Arc"] - style_attribute: DOMRefCell>>>, + style_attribute: DomRefCell>>>, attr_list: MutNullableDom, class_list: MutNullableDom, state: Cell, @@ -146,10 +146,10 @@ pub struct Element { #[ignore_heap_size_of = "bitflags defined in rust-selectors"] selector_flags: Cell, /// https://html.spec.whatwg.org/multipage/#custom-element-reaction-queue - custom_element_reaction_queue: DOMRefCell>, + custom_element_reaction_queue: DomRefCell>, /// https://dom.spec.whatwg.org/#concept-element-custom-element-definition #[ignore_heap_size_of = "Rc"] - custom_element_definition: DOMRefCell>>, + custom_element_definition: DomRefCell>>, /// https://dom.spec.whatwg.org/#concept-element-custom-element-state custom_element_state: Cell, } @@ -255,11 +255,11 @@ impl Element { local_name: local_name, tag_name: TagName::new(), namespace: namespace, - prefix: DOMRefCell::new(prefix), - attrs: DOMRefCell::new(vec![]), - id_attribute: DOMRefCell::new(None), - is: DOMRefCell::new(None), - style_attribute: DOMRefCell::new(None), + prefix: DomRefCell::new(prefix), + attrs: DomRefCell::new(vec![]), + id_attribute: DomRefCell::new(None), + is: DomRefCell::new(None), + style_attribute: DomRefCell::new(None), attr_list: Default::default(), class_list: Default::default(), state: Cell::new(state), @@ -958,7 +958,7 @@ impl Element { ns!() } - pub fn style_attribute(&self) -> &DOMRefCell>>> { + pub fn style_attribute(&self) -> &DomRefCell>>> { &self.style_attribute } @@ -3006,12 +3006,12 @@ impl<'a> AttributeMutation<'a> { /// owner changes. #[derive(HeapSizeOf, JSTraceable)] struct TagName { - ptr: DOMRefCell>, + ptr: DomRefCell>, } impl TagName { fn new() -> TagName { - TagName { ptr: DOMRefCell::new(None) } + TagName { ptr: DomRefCell::new(None) } } /// Retrieve a copy of the current inner value. If it is `None`, it is diff --git a/components/script/dom/errorevent.rs b/components/script/dom/errorevent.rs index c3f4ac95525c..337e4f34fcc3 100644 --- a/components/script/dom/errorevent.rs +++ b/components/script/dom/errorevent.rs @@ -2,7 +2,7 @@ * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ -use dom::bindings::cell::DOMRefCell; +use dom::bindings::cell::DomRefCell; use dom::bindings::codegen::Bindings::ErrorEventBinding; use dom::bindings::codegen::Bindings::ErrorEventBinding::ErrorEventMethods; use dom::bindings::codegen::Bindings::EventBinding::EventMethods; @@ -23,8 +23,8 @@ use std::cell::Cell; #[dom_struct] pub struct ErrorEvent { event: Event, - message: DOMRefCell, - filename: DOMRefCell, + message: DomRefCell, + filename: DomRefCell, lineno: Cell, colno: Cell, #[ignore_heap_size_of = "Defined in rust-mozjs"] @@ -35,8 +35,8 @@ impl ErrorEvent { fn new_inherited() -> ErrorEvent { ErrorEvent { event: Event::new_inherited(), - message: DOMRefCell::new(DOMString::new()), - filename: DOMRefCell::new(DOMString::new()), + message: DomRefCell::new(DOMString::new()), + filename: DomRefCell::new(DOMString::new()), lineno: Cell::new(0), colno: Cell::new(0), error: Heap::default() diff --git a/components/script/dom/event.rs b/components/script/dom/event.rs index c00ed9a00119..24674147bc5d 100644 --- a/components/script/dom/event.rs +++ b/components/script/dom/event.rs @@ -4,7 +4,7 @@ use devtools_traits::{TimelineMarker, TimelineMarkerType}; use dom::bindings::callback::ExceptionHandling; -use dom::bindings::cell::DOMRefCell; +use dom::bindings::cell::DomRefCell; use dom::bindings::codegen::Bindings::EventBinding; use dom::bindings::codegen::Bindings::EventBinding::{EventConstants, EventMethods}; use dom::bindings::error::Fallible; @@ -31,7 +31,7 @@ pub struct Event { reflector_: Reflector, current_target: MutNullableDom, target: MutNullableDom, - type_: DOMRefCell, + type_: DomRefCell, phase: Cell, canceled: Cell, stop_propagation: Cell, @@ -50,7 +50,7 @@ impl Event { reflector_: Reflector::new(), current_target: Default::default(), target: Default::default(), - type_: DOMRefCell::new(atom!("")), + type_: DomRefCell::new(atom!("")), phase: Cell::new(EventPhase::None), canceled: Cell::new(EventDefault::Allowed), stop_propagation: Cell::new(false), diff --git a/components/script/dom/eventsource.rs b/components/script/dom/eventsource.rs index 01f25ec281c9..82aa62bba260 100644 --- a/components/script/dom/eventsource.rs +++ b/components/script/dom/eventsource.rs @@ -2,7 +2,7 @@ * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ -use dom::bindings::cell::DOMRefCell; +use dom::bindings::cell::DomRefCell; use dom::bindings::codegen::Bindings::EventSourceBinding::{EventSourceInit, EventSourceMethods, Wrap}; use dom::bindings::error::{Error, Fallible}; use dom::bindings::inheritance::Castable; @@ -56,8 +56,8 @@ enum ReadyState { pub struct EventSource { eventtarget: EventTarget, url: ServoUrl, - request: DOMRefCell>, - last_event_id: DOMRefCell, + request: DomRefCell>, + last_event_id: DomRefCell, reconnection_time: Cell, generation_id: Cell, @@ -402,8 +402,8 @@ impl EventSource { EventSource { eventtarget: EventTarget::new_inherited(), url: url, - request: DOMRefCell::new(None), - last_event_id: DOMRefCell::new(DOMString::from("")), + request: DomRefCell::new(None), + last_event_id: DomRefCell::new(DOMString::from("")), reconnection_time: Cell::new(DEFAULT_RECONNECTION_TIME), generation_id: Cell::new(GenerationId(0)), diff --git a/components/script/dom/eventtarget.rs b/components/script/dom/eventtarget.rs index ed9ec8603c1c..64c903e4de6f 100644 --- a/components/script/dom/eventtarget.rs +++ b/components/script/dom/eventtarget.rs @@ -4,7 +4,7 @@ use dom::beforeunloadevent::BeforeUnloadEvent; use dom::bindings::callback::{CallbackContainer, ExceptionHandling, CallbackFunction}; -use dom::bindings::cell::DOMRefCell; +use dom::bindings::cell::DomRefCell; use dom::bindings::codegen::Bindings::BeforeUnloadEventBinding::BeforeUnloadEventMethods; use dom::bindings::codegen::Bindings::ErrorEventBinding::ErrorEventMethods; use dom::bindings::codegen::Bindings::EventBinding::EventMethods; @@ -276,14 +276,14 @@ impl EventListeners { #[dom_struct] pub struct EventTarget { reflector_: Reflector, - handlers: DOMRefCell>>, + handlers: DomRefCell>>, } impl EventTarget { pub fn new_inherited() -> EventTarget { EventTarget { reflector_: Reflector::new(), - handlers: DOMRefCell::new(Default::default()), + handlers: DomRefCell::new(Default::default()), } } diff --git a/components/script/dom/filereader.rs b/components/script/dom/filereader.rs index 2e5721cc9100..d8ed3788f194 100644 --- a/components/script/dom/filereader.rs +++ b/components/script/dom/filereader.rs @@ -3,7 +3,7 @@ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ use base64; -use dom::bindings::cell::DOMRefCell; +use dom::bindings::cell::DomRefCell; use dom::bindings::codegen::Bindings::BlobBinding::BlobMethods; use dom::bindings::codegen::Bindings::FileReaderBinding::{self, FileReaderConstants, FileReaderMethods}; use dom::bindings::codegen::UnionTypes::StringOrObject; @@ -88,7 +88,7 @@ pub struct FileReader { eventtarget: EventTarget, ready_state: Cell, error: MutNullableDom, - result: DOMRefCell>, + result: DomRefCell>, generation_id: Cell, } @@ -98,7 +98,7 @@ impl FileReader { eventtarget: EventTarget::new_inherited(), ready_state: Cell::new(FileReaderReadyState::Empty), error: MutNullableDom::new(None), - result: DOMRefCell::new(None), + result: DomRefCell::new(None), generation_id: Cell::new(GenerationId(0)), } } @@ -216,7 +216,7 @@ impl FileReader { } // https://w3c.github.io/FileAPI/#dfn-readAsText - fn perform_readastext(result: &DOMRefCell>, data: ReadMetaData, blob_bytes: &[u8]) { + fn perform_readastext(result: &DomRefCell>, data: ReadMetaData, blob_bytes: &[u8]) { let blob_label = &data.label; let blob_type = &data.blobtype; @@ -246,7 +246,7 @@ impl FileReader { } //https://w3c.github.io/FileAPI/#dfn-readAsDataURL - fn perform_readasdataurl(result: &DOMRefCell>, data: ReadMetaData, bytes: &[u8]) { + fn perform_readasdataurl(result: &DomRefCell>, data: ReadMetaData, bytes: &[u8]) { let base64 = base64::encode(bytes); let output = if data.blobtype.is_empty() { @@ -260,7 +260,7 @@ impl FileReader { // https://w3c.github.io/FileAPI/#dfn-readAsArrayBuffer #[allow(unsafe_code)] - fn perform_readasarraybuffer(result: &DOMRefCell>, + fn perform_readasarraybuffer(result: &DomRefCell>, cx: *mut JSContext, _: ReadMetaData, bytes: &[u8]) { unsafe { rooted!(in(cx) let mut array_buffer = ptr::null_mut()); diff --git a/components/script/dom/formdata.rs b/components/script/dom/formdata.rs index 8181fd43d07e..100684505dd5 100644 --- a/components/script/dom/formdata.rs +++ b/components/script/dom/formdata.rs @@ -2,7 +2,7 @@ * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ -use dom::bindings::cell::DOMRefCell; +use dom::bindings::cell::DomRefCell; use dom::bindings::codegen::Bindings::FormDataBinding::FormDataMethods; use dom::bindings::codegen::Bindings::FormDataBinding::FormDataWrap; use dom::bindings::codegen::UnionTypes::FileOrUSVString; @@ -25,7 +25,7 @@ use std::iter; #[dom_struct] pub struct FormData { reflector_: Reflector, - data: DOMRefCell>>, + data: DomRefCell>>, } impl FormData { @@ -43,7 +43,7 @@ impl FormData { FormData { reflector_: Reflector::new(), - data: DOMRefCell::new(hashmap), + data: DomRefCell::new(hashmap), } } diff --git a/components/script/dom/gamepadlist.rs b/components/script/dom/gamepadlist.rs index dec21410c9da..26e78cda654c 100644 --- a/components/script/dom/gamepadlist.rs +++ b/components/script/dom/gamepadlist.rs @@ -2,7 +2,7 @@ * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ -use dom::bindings::cell::DOMRefCell; +use dom::bindings::cell::DomRefCell; use dom::bindings::codegen::Bindings::GamepadListBinding; use dom::bindings::codegen::Bindings::GamepadListBinding::GamepadListMethods; use dom::bindings::reflector::{Reflector, reflect_dom_object}; @@ -15,14 +15,14 @@ use dom_struct::dom_struct; #[dom_struct] pub struct GamepadList { reflector_: Reflector, - list: DOMRefCell>> + list: DomRefCell>> } impl GamepadList { fn new_inherited(list: &[&Gamepad]) -> GamepadList { GamepadList { reflector_: Reflector::new(), - list: DOMRefCell::new(list.iter().map(|g| Dom::from_ref(&**g)).collect()) + list: DomRefCell::new(list.iter().map(|g| Dom::from_ref(&**g)).collect()) } } diff --git a/components/script/dom/globalscope.rs b/components/script/dom/globalscope.rs index e9854d4f991e..ed5ed5cd941b 100644 --- a/components/script/dom/globalscope.rs +++ b/components/script/dom/globalscope.rs @@ -3,7 +3,7 @@ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ use devtools_traits::{ScriptToDevtoolsControlMsg, WorkerId}; -use dom::bindings::cell::DOMRefCell; +use dom::bindings::cell::DomRefCell; use dom::bindings::codegen::Bindings::WindowBinding::WindowMethods; use dom::bindings::codegen::Bindings::WorkerGlobalScopeBinding::WorkerGlobalScopeMethods; use dom::bindings::conversions::root_from_object; @@ -69,7 +69,7 @@ pub struct GlobalScope { devtools_wants_updates: Cell, /// Timers used by the Console API. - console_timers: DOMRefCell>, + console_timers: DomRefCell>, /// For providing instructions to an optional devtools server. #[ignore_heap_size_of = "channels are hard"] @@ -131,7 +131,7 @@ impl GlobalScope { next_worker_id: Cell::new(WorkerId(0)), pipeline_id, devtools_wants_updates: Default::default(), - console_timers: DOMRefCell::new(Default::default()), + console_timers: DomRefCell::new(Default::default()), devtools_chan, mem_profiler_chan, time_profiler_chan, diff --git a/components/script/dom/headers.rs b/components/script/dom/headers.rs index f5ac52e10060..7bd2eeff8e2a 100644 --- a/components/script/dom/headers.rs +++ b/components/script/dom/headers.rs @@ -2,7 +2,7 @@ * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ -use dom::bindings::cell::DOMRefCell; +use dom::bindings::cell::DomRefCell; use dom::bindings::codegen::Bindings::HeadersBinding::{HeadersInit, HeadersMethods, HeadersWrap}; use dom::bindings::error::{Error, ErrorResult, Fallible}; use dom::bindings::iterable::Iterable; @@ -22,7 +22,7 @@ pub struct Headers { reflector_: Reflector, guard: Cell, #[ignore_heap_size_of = "Defined in hyper"] - header_list: DOMRefCell + header_list: DomRefCell } // https://fetch.spec.whatwg.org/#concept-headers-guard @@ -40,7 +40,7 @@ impl Headers { Headers { reflector_: Reflector::new(), guard: Cell::new(Guard::None), - header_list: DOMRefCell::new(HyperHeaders::new()), + header_list: DomRefCell::new(HyperHeaders::new()), } } diff --git a/components/script/dom/htmlanchorelement.rs b/components/script/dom/htmlanchorelement.rs index bd363e316c68..bb5c1b67d69e 100644 --- a/components/script/dom/htmlanchorelement.rs +++ b/components/script/dom/htmlanchorelement.rs @@ -3,7 +3,7 @@ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ use dom::activation::Activatable; -use dom::bindings::cell::DOMRefCell; +use dom::bindings::cell::DomRefCell; use dom::bindings::codegen::Bindings::AttrBinding::AttrMethods; use dom::bindings::codegen::Bindings::DOMTokenListBinding::DOMTokenListMethods; use dom::bindings::codegen::Bindings::HTMLAnchorElementBinding; @@ -38,7 +38,7 @@ use style::attr::AttrValue; pub struct HTMLAnchorElement { htmlelement: HTMLElement, rel_list: MutNullableDom, - url: DOMRefCell>, + url: DomRefCell>, } impl HTMLAnchorElement { @@ -49,7 +49,7 @@ impl HTMLAnchorElement { htmlelement: HTMLElement::new_inherited(local_name, prefix, document), rel_list: Default::default(), - url: DOMRefCell::new(None), + url: DomRefCell::new(None), } } diff --git a/components/script/dom/htmlcanvaselement.rs b/components/script/dom/htmlcanvaselement.rs index de6fc1b1bd42..d277c85fd8a2 100644 --- a/components/script/dom/htmlcanvaselement.rs +++ b/components/script/dom/htmlcanvaselement.rs @@ -5,7 +5,7 @@ use base64; use canvas_traits::canvas::{CanvasMsg, FromScriptMsg}; use dom::attr::Attr; -use dom::bindings::cell::DOMRefCell; +use dom::bindings::cell::DomRefCell; use dom::bindings::codegen::Bindings::CanvasRenderingContext2DBinding::CanvasRenderingContext2DMethods; use dom::bindings::codegen::Bindings::HTMLCanvasElementBinding; use dom::bindings::codegen::Bindings::HTMLCanvasElementBinding::HTMLCanvasElementMethods; @@ -51,7 +51,7 @@ pub enum CanvasContext { #[dom_struct] pub struct HTMLCanvasElement { htmlelement: HTMLElement, - context: DOMRefCell>, + context: DomRefCell>, } impl HTMLCanvasElement { @@ -60,7 +60,7 @@ impl HTMLCanvasElement { document: &Document) -> HTMLCanvasElement { HTMLCanvasElement { htmlelement: HTMLElement::new_inherited(local_name, prefix, document), - context: DOMRefCell::new(None), + context: DomRefCell::new(None), } } diff --git a/components/script/dom/htmldialogelement.rs b/components/script/dom/htmldialogelement.rs index 96671be699d5..2d26f150628a 100644 --- a/components/script/dom/htmldialogelement.rs +++ b/components/script/dom/htmldialogelement.rs @@ -2,7 +2,7 @@ * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ -use dom::bindings::cell::DOMRefCell; +use dom::bindings::cell::DomRefCell; use dom::bindings::codegen::Bindings::HTMLDialogElementBinding; use dom::bindings::codegen::Bindings::HTMLDialogElementBinding::HTMLDialogElementMethods; use dom::bindings::inheritance::Castable; @@ -19,7 +19,7 @@ use html5ever::{LocalName, Prefix}; #[dom_struct] pub struct HTMLDialogElement { htmlelement: HTMLElement, - return_value: DOMRefCell, + return_value: DomRefCell, } impl HTMLDialogElement { @@ -29,7 +29,7 @@ impl HTMLDialogElement { HTMLDialogElement { htmlelement: HTMLElement::new_inherited(local_name, prefix, document), - return_value: DOMRefCell::new(DOMString::new()), + return_value: DomRefCell::new(DOMString::new()), } } diff --git a/components/script/dom/htmlformelement.rs b/components/script/dom/htmlformelement.rs index a062ca3f055d..abb064fbb19d 100755 --- a/components/script/dom/htmlformelement.rs +++ b/components/script/dom/htmlformelement.rs @@ -2,7 +2,7 @@ * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ -use dom::bindings::cell::DOMRefCell; +use dom::bindings::cell::DomRefCell; use dom::bindings::codegen::Bindings::BlobBinding::BlobMethods; use dom::bindings::codegen::Bindings::DocumentBinding::DocumentMethods; use dom::bindings::codegen::Bindings::EventBinding::EventMethods; @@ -66,7 +66,7 @@ pub struct HTMLFormElement { marked_for_reset: Cell, elements: DomOnceCell, generation_id: Cell, - controls: DOMRefCell>>, + controls: DomRefCell>>, } impl HTMLFormElement { @@ -78,7 +78,7 @@ impl HTMLFormElement { marked_for_reset: Cell::new(false), elements: Default::default(), generation_id: Cell::new(GenerationId(0)), - controls: DOMRefCell::new(Vec::new()), + controls: DomRefCell::new(Vec::new()), } } diff --git a/components/script/dom/htmliframeelement.rs b/components/script/dom/htmliframeelement.rs index 923c0fab2df7..39bb2e672b49 100644 --- a/components/script/dom/htmliframeelement.rs +++ b/components/script/dom/htmliframeelement.rs @@ -4,7 +4,7 @@ use document_loader::{LoadBlocker, LoadType}; use dom::attr::Attr; -use dom::bindings::cell::DOMRefCell; +use dom::bindings::cell::DomRefCell; use dom::bindings::codegen::Bindings::BrowserElementBinding::BrowserElementErrorEventDetail; use dom::bindings::codegen::Bindings::BrowserElementBinding::BrowserElementIconChangeEventDetail; use dom::bindings::codegen::Bindings::BrowserElementBinding::BrowserElementLocationChangeEventDetail; @@ -90,7 +90,7 @@ pub struct HTMLIFrameElement { pending_pipeline_id: Cell>, sandbox: MutNullableDom, sandbox_allowance: Cell>, - load_blocker: DOMRefCell>, + load_blocker: DomRefCell>, visibility: Cell, } @@ -329,7 +329,7 @@ impl HTMLIFrameElement { pending_pipeline_id: Cell::new(None), sandbox: Default::default(), sandbox_allowance: Cell::new(None), - load_blocker: DOMRefCell::new(None), + load_blocker: DomRefCell::new(None), visibility: Cell::new(true), } } diff --git a/components/script/dom/htmlimageelement.rs b/components/script/dom/htmlimageelement.rs index 3a71f8bda484..dac6c9556260 100644 --- a/components/script/dom/htmlimageelement.rs +++ b/components/script/dom/htmlimageelement.rs @@ -6,7 +6,7 @@ use app_units::{Au, AU_PER_PX}; use document_loader::{LoadType, LoadBlocker}; use dom::activation::Activatable; use dom::attr::Attr; -use dom::bindings::cell::DOMRefCell; +use dom::bindings::cell::DomRefCell; use dom::bindings::codegen::Bindings::DOMRectBinding::DOMRectBinding::DOMRectMethods; use dom::bindings::codegen::Bindings::ElementBinding::ElementBinding::ElementMethods; use dom::bindings::codegen::Bindings::HTMLImageElementBinding; @@ -87,8 +87,8 @@ struct ImageRequest { pub struct HTMLImageElement { htmlelement: HTMLElement, image_request: Cell, - current_request: DOMRefCell, - pending_request: DOMRefCell, + current_request: DomRefCell, + pending_request: DomRefCell, form_owner: MutNullableDom, generation: Cell, } @@ -579,7 +579,7 @@ impl HTMLImageElement { HTMLImageElement { htmlelement: HTMLElement::new_inherited(local_name, prefix, document), image_request: Cell::new(ImageRequestPhase::Current), - current_request: DOMRefCell::new(ImageRequest { + current_request: DomRefCell::new(ImageRequest { state: State::Unavailable, parsed_url: None, source_url: None, @@ -588,7 +588,7 @@ impl HTMLImageElement { blocker: None, final_url: None, }), - pending_request: DOMRefCell::new(ImageRequest { + pending_request: DomRefCell::new(ImageRequest { state: State::Unavailable, parsed_url: None, source_url: None, diff --git a/components/script/dom/htmlinputelement.rs b/components/script/dom/htmlinputelement.rs index 0520a3a3d4f1..77ddc6eb8e3d 100755 --- a/components/script/dom/htmlinputelement.rs +++ b/components/script/dom/htmlinputelement.rs @@ -5,7 +5,7 @@ use caseless::compatibility_caseless_match_str; use dom::activation::{Activatable, ActivationSource, synthetic_click_activation}; use dom::attr::Attr; -use dom::bindings::cell::DOMRefCell; +use dom::bindings::cell::DomRefCell; use dom::bindings::codegen::Bindings::EventBinding::EventMethods; use dom::bindings::codegen::Bindings::FileListBinding::FileListMethods; use dom::bindings::codegen::Bindings::HTMLInputElementBinding; @@ -88,14 +88,14 @@ pub struct HTMLInputElement { htmlelement: HTMLElement, input_type: Cell, checked_changed: Cell, - placeholder: DOMRefCell, + placeholder: DomRefCell, value_changed: Cell, size: Cell, maxlength: Cell, minlength: Cell, #[ignore_heap_size_of = "#7193"] - textinput: DOMRefCell>, - activation_state: DOMRefCell, + textinput: DomRefCell>, + activation_state: DomRefCell, // https://html.spec.whatwg.org/multipage/#concept-input-value-dirty-flag value_dirty: Cell, @@ -142,19 +142,19 @@ impl HTMLInputElement { HTMLElement::new_inherited_with_state(IN_ENABLED_STATE | IN_READ_WRITE_STATE, local_name, prefix, document), input_type: Cell::new(InputType::InputText), - placeholder: DOMRefCell::new(DOMString::new()), + placeholder: DomRefCell::new(DOMString::new()), checked_changed: Cell::new(false), value_changed: Cell::new(false), maxlength: Cell::new(DEFAULT_MAX_LENGTH), minlength: Cell::new(DEFAULT_MIN_LENGTH), size: Cell::new(DEFAULT_INPUT_SIZE), - textinput: DOMRefCell::new(TextInput::new(Single, + textinput: DomRefCell::new(TextInput::new(Single, DOMString::new(), chan, None, None, SelectionDirection::None)), - activation_state: DOMRefCell::new(InputActivationState::new()), + activation_state: DomRefCell::new(InputActivationState::new()), value_dirty: Cell::new(false), filelist: MutNullableDom::new(None), form_owner: Default::default(), diff --git a/components/script/dom/htmllinkelement.rs b/components/script/dom/htmllinkelement.rs index b229e331ed62..42b6f59d6bce 100644 --- a/components/script/dom/htmllinkelement.rs +++ b/components/script/dom/htmllinkelement.rs @@ -4,7 +4,7 @@ use cssparser::{Parser as CssParser, ParserInput}; use dom::attr::Attr; -use dom::bindings::cell::DOMRefCell; +use dom::bindings::cell::DomRefCell; use dom::bindings::codegen::Bindings::DOMTokenListBinding::DOMTokenListBinding::DOMTokenListMethods; use dom::bindings::codegen::Bindings::HTMLLinkElementBinding; use dom::bindings::codegen::Bindings::HTMLLinkElementBinding::HTMLLinkElementMethods; @@ -52,7 +52,7 @@ pub struct HTMLLinkElement { htmlelement: HTMLElement, rel_list: MutNullableDom, #[ignore_heap_size_of = "Arc"] - stylesheet: DOMRefCell>>, + stylesheet: DomRefCell>>, cssom_stylesheet: MutNullableDom, /// https://html.spec.whatwg.org/multipage/#a-style-sheet-that-is-blocking-scripts @@ -73,7 +73,7 @@ impl HTMLLinkElement { htmlelement: HTMLElement::new_inherited(local_name, prefix, document), rel_list: Default::default(), parser_inserted: Cell::new(creator.is_parser_created()), - stylesheet: DOMRefCell::new(None), + stylesheet: DomRefCell::new(None), cssom_stylesheet: MutNullableDom::new(None), pending_loads: Cell::new(0), any_failed_load: Cell::new(false), diff --git a/components/script/dom/htmlmediaelement.rs b/components/script/dom/htmlmediaelement.rs index 81708864742f..74f8c87b77b0 100644 --- a/components/script/dom/htmlmediaelement.rs +++ b/components/script/dom/htmlmediaelement.rs @@ -5,7 +5,7 @@ use audio_video_metadata; use document_loader::{LoadBlocker, LoadType}; use dom::attr::Attr; -use dom::bindings::cell::DOMRefCell; +use dom::bindings::cell::DomRefCell; use dom::bindings::codegen::Bindings::AttrBinding::AttrMethods; use dom::bindings::codegen::Bindings::HTMLMediaElementBinding::CanPlayTypeResult; use dom::bindings::codegen::Bindings::HTMLMediaElementBinding::HTMLMediaElementConstants; @@ -58,7 +58,7 @@ pub struct HTMLMediaElement { /// https://html.spec.whatwg.org/multipage/#dom-media-readystate ready_state: Cell, /// https://html.spec.whatwg.org/multipage/#dom-media-currentsrc - current_src: DOMRefCell, + current_src: DomRefCell, /// Incremented whenever tasks associated with this element are cancelled. generation_id: Cell, /// https://html.spec.whatwg.org/multipage/#fire-loadeddata @@ -72,16 +72,16 @@ pub struct HTMLMediaElement { /// https://html.spec.whatwg.org/multipage/#attr-media-autoplay autoplaying: Cell, /// https://html.spec.whatwg.org/multipage/#delaying-the-load-event-flag - delaying_the_load_event_flag: DOMRefCell>, + delaying_the_load_event_flag: DomRefCell>, /// https://html.spec.whatwg.org/multipage/#list-of-pending-play-promises #[ignore_heap_size_of = "promises are hard"] - pending_play_promises: DOMRefCell>>, + pending_play_promises: DomRefCell>>, /// Play promises which are soon to be fulfilled by a queued task. #[ignore_heap_size_of = "promises are hard"] - in_flight_play_promises_queue: DOMRefCell]>, ErrorResult)>>, + in_flight_play_promises_queue: DomRefCell]>, ErrorResult)>>, /// The details of the video currently related to this media element. // FIXME(nox): Why isn't this in HTMLVideoElement? - video: DOMRefCell>, + video: DomRefCell>, } /// https://html.spec.whatwg.org/multipage/#dom-media-networkstate @@ -126,7 +126,7 @@ impl HTMLMediaElement { htmlelement: HTMLElement::new_inherited(tag_name, prefix, document), network_state: Cell::new(NetworkState::Empty), ready_state: Cell::new(ReadyState::HaveNothing), - current_src: DOMRefCell::new("".to_owned()), + current_src: DomRefCell::new("".to_owned()), generation_id: Cell::new(0), fired_loadeddata_event: Cell::new(false), error: Default::default(), @@ -136,7 +136,7 @@ impl HTMLMediaElement { delaying_the_load_event_flag: Default::default(), pending_play_promises: Default::default(), in_flight_play_promises_queue: Default::default(), - video: DOMRefCell::new(None), + video: DomRefCell::new(None), } } diff --git a/components/script/dom/htmlmetaelement.rs b/components/script/dom/htmlmetaelement.rs index 41ae52a1b4c3..ea79406c336c 100644 --- a/components/script/dom/htmlmetaelement.rs +++ b/components/script/dom/htmlmetaelement.rs @@ -3,7 +3,7 @@ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ use dom::attr::Attr; -use dom::bindings::cell::DOMRefCell; +use dom::bindings::cell::DomRefCell; use dom::bindings::codegen::Bindings::HTMLMetaElementBinding; use dom::bindings::codegen::Bindings::HTMLMetaElementBinding::HTMLMetaElementMethods; use dom::bindings::codegen::Bindings::NodeBinding::NodeMethods; @@ -33,7 +33,7 @@ use style::stylesheets::{Stylesheet, StylesheetContents, CssRule, CssRules, Orig pub struct HTMLMetaElement { htmlelement: HTMLElement, #[ignore_heap_size_of = "Arc"] - stylesheet: DOMRefCell>>, + stylesheet: DomRefCell>>, cssom_stylesheet: MutNullableDom, } @@ -43,7 +43,7 @@ impl HTMLMetaElement { document: &Document) -> HTMLMetaElement { HTMLMetaElement { htmlelement: HTMLElement::new_inherited(local_name, prefix, document), - stylesheet: DOMRefCell::new(None), + stylesheet: DomRefCell::new(None), cssom_stylesheet: MutNullableDom::new(None), } } diff --git a/components/script/dom/htmlobjectelement.rs b/components/script/dom/htmlobjectelement.rs index 121dde5d2ae8..bd84b1bdd0b0 100755 --- a/components/script/dom/htmlobjectelement.rs +++ b/components/script/dom/htmlobjectelement.rs @@ -3,7 +3,7 @@ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ use dom::attr::Attr; -use dom::bindings::cell::DOMRefCell; +use dom::bindings::cell::DomRefCell; use dom::bindings::codegen::Bindings::HTMLObjectElementBinding; use dom::bindings::codegen::Bindings::HTMLObjectElementBinding::HTMLObjectElementMethods; use dom::bindings::inheritance::Castable; @@ -27,7 +27,7 @@ use std::default::Default; pub struct HTMLObjectElement { htmlelement: HTMLElement, #[ignore_heap_size_of = "Arc"] - image: DOMRefCell>>, + image: DomRefCell>>, form_owner: MutNullableDom, } @@ -38,7 +38,7 @@ impl HTMLObjectElement { HTMLObjectElement { htmlelement: HTMLElement::new_inherited(local_name, prefix, document), - image: DOMRefCell::new(None), + image: DomRefCell::new(None), form_owner: Default::default(), } } diff --git a/components/script/dom/htmlstyleelement.rs b/components/script/dom/htmlstyleelement.rs index a66ede9c930b..0ba69b635499 100644 --- a/components/script/dom/htmlstyleelement.rs +++ b/components/script/dom/htmlstyleelement.rs @@ -3,7 +3,7 @@ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ use cssparser::{Parser as CssParser, ParserInput}; -use dom::bindings::cell::DOMRefCell; +use dom::bindings::cell::DomRefCell; use dom::bindings::codegen::Bindings::HTMLStyleElementBinding; use dom::bindings::codegen::Bindings::HTMLStyleElementBinding::HTMLStyleElementMethods; use dom::bindings::codegen::Bindings::NodeBinding::NodeMethods; @@ -32,7 +32,7 @@ use stylesheet_loader::{StylesheetLoader, StylesheetOwner}; pub struct HTMLStyleElement { htmlelement: HTMLElement, #[ignore_heap_size_of = "Arc"] - stylesheet: DOMRefCell>>, + stylesheet: DomRefCell>>, cssom_stylesheet: MutNullableDom, /// https://html.spec.whatwg.org/multipage/#a-style-sheet-that-is-blocking-scripts parser_inserted: Cell, @@ -49,7 +49,7 @@ impl HTMLStyleElement { creator: ElementCreator) -> HTMLStyleElement { HTMLStyleElement { htmlelement: HTMLElement::new_inherited(local_name, prefix, document), - stylesheet: DOMRefCell::new(None), + stylesheet: DomRefCell::new(None), cssom_stylesheet: MutNullableDom::new(None), parser_inserted: Cell::new(creator.is_parser_created()), in_stack_of_open_elements: Cell::new(creator.is_parser_created()), diff --git a/components/script/dom/htmltextareaelement.rs b/components/script/dom/htmltextareaelement.rs index 6531586ca29b..3d0cc360deb3 100755 --- a/components/script/dom/htmltextareaelement.rs +++ b/components/script/dom/htmltextareaelement.rs @@ -3,7 +3,7 @@ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ use dom::attr::Attr; -use dom::bindings::cell::DOMRefCell; +use dom::bindings::cell::DomRefCell; use dom::bindings::codegen::Bindings::EventBinding::EventMethods; use dom::bindings::codegen::Bindings::HTMLTextAreaElementBinding; use dom::bindings::codegen::Bindings::HTMLTextAreaElementBinding::HTMLTextAreaElementMethods; @@ -39,8 +39,8 @@ use textinput::{KeyReaction, Lines, SelectionDirection, TextInput}; pub struct HTMLTextAreaElement { htmlelement: HTMLElement, #[ignore_heap_size_of = "#7193"] - textinput: DOMRefCell>, - placeholder: DOMRefCell, + textinput: DomRefCell>, + placeholder: DomRefCell, // https://html.spec.whatwg.org/multipage/#concept-textarea-dirty value_changed: Cell, form_owner: MutNullableDom, @@ -113,8 +113,8 @@ impl HTMLTextAreaElement { htmlelement: HTMLElement::new_inherited_with_state(IN_ENABLED_STATE | IN_READ_WRITE_STATE, local_name, prefix, document), - placeholder: DOMRefCell::new(DOMString::new()), - textinput: DOMRefCell::new(TextInput::new( + placeholder: DomRefCell::new(DOMString::new()), + textinput: DomRefCell::new(TextInput::new( Lines::Multiple, DOMString::new(), chan, None, None, SelectionDirection::None)), value_changed: Cell::new(false), form_owner: Default::default(), diff --git a/components/script/dom/keyboardevent.rs b/components/script/dom/keyboardevent.rs index b9f2e354022e..4107c809d3e4 100644 --- a/components/script/dom/keyboardevent.rs +++ b/components/script/dom/keyboardevent.rs @@ -2,7 +2,7 @@ * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ -use dom::bindings::cell::DOMRefCell; +use dom::bindings::cell::DomRefCell; use dom::bindings::codegen::Bindings::KeyboardEventBinding; use dom::bindings::codegen::Bindings::KeyboardEventBinding::{KeyboardEventConstants, KeyboardEventMethods}; use dom::bindings::codegen::Bindings::UIEventBinding::UIEventMethods; @@ -26,8 +26,8 @@ unsafe_no_jsmanaged_fields!(Key); pub struct KeyboardEvent { uievent: UIEvent, key: Cell>, - key_string: DOMRefCell, - code: DOMRefCell, + key_string: DomRefCell, + code: DomRefCell, location: Cell, ctrl: Cell, alt: Cell, @@ -45,8 +45,8 @@ impl KeyboardEvent { KeyboardEvent { uievent: UIEvent::new_inherited(), key: Cell::new(None), - key_string: DOMRefCell::new(DOMString::new()), - code: DOMRefCell::new(DOMString::new()), + key_string: DomRefCell::new(DOMString::new()), + code: DomRefCell::new(DOMString::new()), location: Cell::new(0), ctrl: Cell::new(false), alt: Cell::new(false), diff --git a/components/script/dom/mediaquerylist.rs b/components/script/dom/mediaquerylist.rs index b60632e7ebf1..4c23ee080bac 100644 --- a/components/script/dom/mediaquerylist.rs +++ b/components/script/dom/mediaquerylist.rs @@ -2,7 +2,7 @@ * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ -use dom::bindings::cell::DOMRefCell; +use dom::bindings::cell::DomRefCell; use dom::bindings::codegen::Bindings::EventListenerBinding::EventListener; use dom::bindings::codegen::Bindings::EventTargetBinding::EventTargetMethods; use dom::bindings::codegen::Bindings::MediaQueryListBinding::{self, MediaQueryListMethods}; @@ -113,13 +113,13 @@ impl MediaQueryListMethods for MediaQueryList { #[derive(HeapSizeOf)] pub struct WeakMediaQueryListVec { - cell: DOMRefCell>, + cell: DomRefCell>, } impl WeakMediaQueryListVec { /// Create a new vector of weak references to MediaQueryList pub fn new() -> Self { - WeakMediaQueryListVec { cell: DOMRefCell::new(WeakRefVec::new()) } + WeakMediaQueryListVec { cell: DomRefCell::new(WeakRefVec::new()) } } pub fn push(&self, mql: &MediaQueryList) { diff --git a/components/script/dom/mod.rs b/components/script/dom/mod.rs index 8df3660a3f91..deede3622d07 100644 --- a/components/script/dom/mod.rs +++ b/components/script/dom/mod.rs @@ -123,7 +123,7 @@ //! //! Reflectors are JavaScript objects, and as such can be freely aliased. As //! Rust does not allow mutable aliasing, mutable borrows of DOM objects are -//! not allowed. In particular, any mutable fields use `Cell` or `DOMRefCell` +//! not allowed. In particular, any mutable fields use `Cell` or `DomRefCell` //! to manage their mutability. //! //! `Reflector` and `DomObject` diff --git a/components/script/dom/mutationobserver.rs b/components/script/dom/mutationobserver.rs index ced20d1ec4a8..6a411b7833fa 100644 --- a/components/script/dom/mutationobserver.rs +++ b/components/script/dom/mutationobserver.rs @@ -3,7 +3,7 @@ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ use dom::bindings::callback::ExceptionHandling; -use dom::bindings::cell::DOMRefCell; +use dom::bindings::cell::DomRefCell; use dom::bindings::codegen::Bindings::MutationObserverBinding; use dom::bindings::codegen::Bindings::MutationObserverBinding::MutationCallback; use dom::bindings::codegen::Bindings::MutationObserverBinding::MutationObserverBinding::MutationObserverMethods; @@ -26,7 +26,7 @@ pub struct MutationObserver { reflector_: Reflector, #[ignore_heap_size_of = "can't measure Rc values"] callback: Rc, - record_queue: DOMRefCell>>, + record_queue: DomRefCell>>, } pub enum Mutation<'a> { @@ -62,7 +62,7 @@ impl MutationObserver { MutationObserver { reflector_: Reflector::new(), callback: callback, - record_queue: DOMRefCell::new(vec![]), + record_queue: DomRefCell::new(vec![]), } } diff --git a/components/script/dom/node.rs b/components/script/dom/node.rs index d036e846e573..28f1979a53e5 100644 --- a/components/script/dom/node.rs +++ b/components/script/dom/node.rs @@ -7,7 +7,7 @@ use app_units::Au; use devtools_traits::NodeInfo; use document_loader::DocumentLoader; -use dom::bindings::cell::DOMRefCell; +use dom::bindings::cell::DomRefCell; use dom::bindings::codegen::Bindings::CharacterDataBinding::CharacterDataMethods; use dom::bindings::codegen::Bindings::DocumentBinding::DocumentMethods; use dom::bindings::codegen::Bindings::ElementBinding::ElementMethods; @@ -140,7 +140,7 @@ pub struct Node { style_and_layout_data: Cell>, /// Registered observers for this node. - mutation_observers: DOMRefCell>, + mutation_observers: DomRefCell>, unique_id: UniqueId, } diff --git a/components/script/dom/paintworkletglobalscope.rs b/components/script/dom/paintworkletglobalscope.rs index daf8a0d35c21..24bd7e7d9404 100644 --- a/components/script/dom/paintworkletglobalscope.rs +++ b/components/script/dom/paintworkletglobalscope.rs @@ -3,7 +3,7 @@ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ use dom::bindings::callback::CallbackContainer; -use dom::bindings::cell::DOMRefCell; +use dom::bindings::cell::DomRefCell; use dom::bindings::codegen::Bindings::PaintWorkletGlobalScopeBinding; use dom::bindings::codegen::Bindings::PaintWorkletGlobalScopeBinding::PaintWorkletGlobalScopeMethods; use dom::bindings::codegen::Bindings::VoidFunctionBinding::VoidFunction; @@ -71,21 +71,21 @@ pub struct PaintWorkletGlobalScope { #[ignore_heap_size_of = "Arc"] image_cache: Arc, /// https://drafts.css-houdini.org/css-paint-api/#paint-definitions - paint_definitions: DOMRefCell>>, + paint_definitions: DomRefCell>>, /// https://drafts.css-houdini.org/css-paint-api/#paint-class-instances - paint_class_instances: DOMRefCell>>>, + paint_class_instances: DomRefCell>>>, /// The most recent name the worklet was called with - cached_name: DOMRefCell, + cached_name: DomRefCell, /// The most recent size the worklet was drawn at cached_size: Cell>, /// The most recent device pixel ratio the worklet was drawn at cached_device_pixel_ratio: Cell>, /// The most recent properties the worklet was drawn at - cached_properties: DOMRefCell>, + cached_properties: DomRefCell>, /// The most recent arguments the worklet was drawn at - cached_arguments: DOMRefCell>, + cached_arguments: DomRefCell>, /// The most recent result - cached_result: DOMRefCell, + cached_result: DomRefCell, } impl PaintWorkletGlobalScope { @@ -102,12 +102,12 @@ impl PaintWorkletGlobalScope { image_cache: init.image_cache.clone(), paint_definitions: Default::default(), paint_class_instances: Default::default(), - cached_name: DOMRefCell::new(Atom::from("")), + cached_name: DomRefCell::new(Atom::from("")), cached_size: Cell::new(TypedSize2D::zero()), cached_device_pixel_ratio: Cell::new(ScaleFactor::new(1.0)), cached_properties: Default::default(), cached_arguments: Default::default(), - cached_result: DOMRefCell::new(DrawAPaintImageResult { + cached_result: DomRefCell::new(DrawAPaintImageResult { width: 0, height: 0, format: PixelFormat::BGRA8, diff --git a/components/script/dom/performance.rs b/components/script/dom/performance.rs index b0fbae9b8449..5df6f1bc9a8c 100644 --- a/components/script/dom/performance.rs +++ b/components/script/dom/performance.rs @@ -2,7 +2,7 @@ * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ -use dom::bindings::cell::DOMRefCell; +use dom::bindings::cell::DomRefCell; use dom::bindings::codegen::Bindings::PerformanceBinding; use dom::bindings::codegen::Bindings::PerformanceBinding::{DOMHighResTimeStamp, PerformanceMethods}; use dom::bindings::codegen::Bindings::PerformanceBinding::PerformanceEntryList as DOMPerformanceEntryList; @@ -111,8 +111,8 @@ struct PerformanceObserver { pub struct Performance { reflector_: Reflector, timing: Option>, - entries: DOMRefCell, - observers: DOMRefCell>, + entries: DomRefCell, + observers: DomRefCell>, pending_notification_observers_task: Cell, navigation_start_precise: f64, } @@ -130,8 +130,8 @@ impl Performance { } else { None }, - entries: DOMRefCell::new(PerformanceEntryList::new(Vec::new())), - observers: DOMRefCell::new(Vec::new()), + entries: DomRefCell::new(PerformanceEntryList::new(Vec::new())), + observers: DomRefCell::new(Vec::new()), pending_notification_observers_task: Cell::new(false), navigation_start_precise, } diff --git a/components/script/dom/performanceobserver.rs b/components/script/dom/performanceobserver.rs index ac28a7f42972..86b45f67a405 100644 --- a/components/script/dom/performanceobserver.rs +++ b/components/script/dom/performanceobserver.rs @@ -3,7 +3,7 @@ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ use dom::bindings::callback::ExceptionHandling; -use dom::bindings::cell::DOMRefCell; +use dom::bindings::cell::DomRefCell; use dom::bindings::codegen::Bindings::PerformanceBinding::PerformanceEntryList as DOMPerformanceEntryList; use dom::bindings::codegen::Bindings::PerformanceObserverBinding; use dom::bindings::codegen::Bindings::PerformanceObserverBinding::PerformanceObserverCallback; @@ -34,12 +34,12 @@ pub struct PerformanceObserver { reflector_: Reflector, #[ignore_heap_size_of = "can't measure Rc values"] callback: Rc, - entries: DOMRefCell, + entries: DomRefCell, } impl PerformanceObserver { fn new_inherited(callback: Rc, - entries: DOMRefCell) + entries: DomRefCell) -> PerformanceObserver { PerformanceObserver { reflector_: Reflector::new(), @@ -53,7 +53,7 @@ impl PerformanceObserver { callback: Rc, entries: DOMPerformanceEntryList) -> Root { - let observer = PerformanceObserver::new_inherited(callback, DOMRefCell::new(entries)); + let observer = PerformanceObserver::new_inherited(callback, DomRefCell::new(entries)); reflect_dom_object(box observer, global, PerformanceObserverBinding::Wrap) } diff --git a/components/script/dom/performanceobserverentrylist.rs b/components/script/dom/performanceobserverentrylist.rs index 2b127ec75f7d..558ad749e5d9 100644 --- a/components/script/dom/performanceobserverentrylist.rs +++ b/components/script/dom/performanceobserverentrylist.rs @@ -2,7 +2,7 @@ * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ -use dom::bindings::cell::DOMRefCell; +use dom::bindings::cell::DomRefCell; use dom::bindings::codegen::Bindings::PerformanceObserverEntryListBinding; use dom::bindings::codegen::Bindings::PerformanceObserverEntryListBinding::PerformanceObserverEntryListMethods; use dom::bindings::reflector::{Reflector, reflect_dom_object}; @@ -16,14 +16,14 @@ use dom_struct::dom_struct; #[dom_struct] pub struct PerformanceObserverEntryList { reflector_: Reflector, - entries: DOMRefCell, + entries: DomRefCell, } impl PerformanceObserverEntryList { fn new_inherited(entries: PerformanceEntryList) -> PerformanceObserverEntryList { PerformanceObserverEntryList { reflector_: Reflector::new(), - entries: DOMRefCell::new(entries), + entries: DomRefCell::new(entries), } } diff --git a/components/script/dom/request.rs b/components/script/dom/request.rs index 1d9d20629d05..6f7f5518c57a 100644 --- a/components/script/dom/request.rs +++ b/components/script/dom/request.rs @@ -3,7 +3,7 @@ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ use body::{BodyOperations, BodyType, consume_body}; -use dom::bindings::cell::DOMRefCell; +use dom::bindings::cell::DomRefCell; use dom::bindings::codegen::Bindings::HeadersBinding::{HeadersInit, HeadersMethods}; use dom::bindings::codegen::Bindings::RequestBinding; use dom::bindings::codegen::Bindings::RequestBinding::ReferrerPolicy; @@ -44,12 +44,12 @@ use std::rc::Rc; #[dom_struct] pub struct Request { reflector_: Reflector, - request: DOMRefCell, + request: DomRefCell, body_used: Cell, headers: MutNullableDom, - mime_type: DOMRefCell>, + mime_type: DomRefCell>, #[ignore_heap_size_of = "Rc"] - body_promise: DOMRefCell, BodyType)>>, + body_promise: DomRefCell, BodyType)>>, } impl Request { @@ -57,12 +57,12 @@ impl Request { url: ServoUrl) -> Request { Request { reflector_: Reflector::new(), - request: DOMRefCell::new( + request: DomRefCell::new( net_request_from_global(global, url)), body_used: Cell::new(false), headers: Default::default(), - mime_type: DOMRefCell::new("".to_string().into_bytes()), - body_promise: DOMRefCell::new(None), + mime_type: DomRefCell::new("".to_string().into_bytes()), + body_promise: DomRefCell::new(None), } } diff --git a/components/script/dom/response.rs b/components/script/dom/response.rs index 55c942e88fc9..269803feaa21 100644 --- a/components/script/dom/response.rs +++ b/components/script/dom/response.rs @@ -4,7 +4,7 @@ use body::{BodyOperations, BodyType, consume_body, consume_body_with_promise}; use core::cell::Cell; -use dom::bindings::cell::DOMRefCell; +use dom::bindings::cell::DomRefCell; use dom::bindings::codegen::Bindings::HeadersBinding::{HeadersInit, HeadersMethods}; use dom::bindings::codegen::Bindings::ResponseBinding; use dom::bindings::codegen::Bindings::ResponseBinding::{ResponseMethods, ResponseType as DOMResponseType}; @@ -34,19 +34,19 @@ use url::Position; pub struct Response { reflector_: Reflector, headers_reflector: MutNullableDom, - mime_type: DOMRefCell>, + mime_type: DomRefCell>, body_used: Cell, /// `None` can be considered a StatusCode of `0`. #[ignore_heap_size_of = "Defined in hyper"] - status: DOMRefCell>, - raw_status: DOMRefCell)>>, - response_type: DOMRefCell, - url: DOMRefCell>, - url_list: DOMRefCell>, + status: DomRefCell>, + raw_status: DomRefCell)>>, + response_type: DomRefCell, + url: DomRefCell>, + url_list: DomRefCell>, // For now use the existing NetTraitsResponseBody enum - body: DOMRefCell, + body: DomRefCell, #[ignore_heap_size_of = "Rc"] - body_promise: DOMRefCell, BodyType)>>, + body_promise: DomRefCell, BodyType)>>, } impl Response { @@ -54,15 +54,15 @@ impl Response { Response { reflector_: Reflector::new(), headers_reflector: Default::default(), - mime_type: DOMRefCell::new("".to_string().into_bytes()), + mime_type: DomRefCell::new("".to_string().into_bytes()), body_used: Cell::new(false), - status: DOMRefCell::new(Some(StatusCode::Ok)), - raw_status: DOMRefCell::new(Some((200, b"OK".to_vec()))), - response_type: DOMRefCell::new(DOMResponseType::Default), - url: DOMRefCell::new(None), - url_list: DOMRefCell::new(vec![]), - body: DOMRefCell::new(NetTraitsResponseBody::Empty), - body_promise: DOMRefCell::new(None), + status: DomRefCell::new(Some(StatusCode::Ok)), + raw_status: DomRefCell::new(Some((200, b"OK".to_vec()))), + response_type: DomRefCell::new(DOMResponseType::Default), + url: DomRefCell::new(None), + url_list: DomRefCell::new(vec![]), + body: DomRefCell::new(NetTraitsResponseBody::Empty), + body_promise: DomRefCell::new(None), } } diff --git a/components/script/dom/serviceworker.rs b/components/script/dom/serviceworker.rs index adc4796a2706..4078daabf4f6 100644 --- a/components/script/dom/serviceworker.rs +++ b/components/script/dom/serviceworker.rs @@ -3,7 +3,7 @@ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ use dom::abstractworker::SimpleWorkerErrorHandler; -use dom::bindings::cell::DOMRefCell; +use dom::bindings::cell::DomRefCell; use dom::bindings::codegen::Bindings::ServiceWorkerBinding::{ServiceWorkerMethods, ServiceWorkerState, Wrap}; use dom::bindings::error::{ErrorResult, Error}; use dom::bindings::inheritance::Castable; @@ -26,7 +26,7 @@ pub type TrustedServiceWorkerAddress = Trusted; #[dom_struct] pub struct ServiceWorker { eventtarget: EventTarget, - script_url: DOMRefCell, + script_url: DomRefCell, scope_url: ServoUrl, state: Cell, skip_waiting: Cell @@ -38,7 +38,7 @@ impl ServiceWorker { scope_url: ServoUrl) -> ServiceWorker { ServiceWorker { eventtarget: EventTarget::new_inherited(), - script_url: DOMRefCell::new(String::from(script_url)), + script_url: DomRefCell::new(String::from(script_url)), state: Cell::new(ServiceWorkerState::Installing), scope_url: scope_url, skip_waiting: Cell::new(skip_waiting) diff --git a/components/script/dom/servoparser/mod.rs b/components/script/dom/servoparser/mod.rs index 0da5d9391d74..3bc3a98babab 100644 --- a/components/script/dom/servoparser/mod.rs +++ b/components/script/dom/servoparser/mod.rs @@ -3,7 +3,7 @@ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ use document_loader::{DocumentLoader, LoadType}; -use dom::bindings::cell::DOMRefCell; +use dom::bindings::cell::DomRefCell; use dom::bindings::codegen::Bindings::DocumentBinding::{DocumentMethods, DocumentReadyState}; use dom::bindings::codegen::Bindings::HTMLImageElementBinding::HTMLImageElementMethods; use dom::bindings::codegen::Bindings::HTMLTemplateElementBinding::HTMLTemplateElementMethods; @@ -75,15 +75,15 @@ pub struct ServoParser { document: Dom, /// Input received from network. #[ignore_heap_size_of = "Defined in html5ever"] - network_input: DOMRefCell, + network_input: DomRefCell, /// Part of an UTF-8 code point spanning input chunks #[ignore_heap_size_of = "Defined in html5ever"] - incomplete_utf8: DOMRefCell>, + incomplete_utf8: DomRefCell>, /// Input received from script. Used only to support document.write(). #[ignore_heap_size_of = "Defined in html5ever"] - script_input: DOMRefCell, + script_input: DomRefCell, /// The tokenizer of this parser. - tokenizer: DOMRefCell, + tokenizer: DomRefCell, /// Whether to expect any further input from the associated network request. last_chunk_received: Cell, /// Whether this parser should avoid passing any further data to the tokenizer. @@ -320,10 +320,10 @@ impl ServoParser { ServoParser { reflector: Reflector::new(), document: Dom::from_ref(document), - incomplete_utf8: DOMRefCell::new(None), - network_input: DOMRefCell::new(BufferQueue::new()), - script_input: DOMRefCell::new(BufferQueue::new()), - tokenizer: DOMRefCell::new(tokenizer), + incomplete_utf8: DomRefCell::new(None), + network_input: DomRefCell::new(BufferQueue::new()), + script_input: DomRefCell::new(BufferQueue::new()), + tokenizer: DomRefCell::new(tokenizer), last_chunk_received: Cell::new(last_chunk_state == LastChunkState::Received), suspended: Default::default(), script_nesting_level: Default::default(), diff --git a/components/script/dom/testbindingiterable.rs b/components/script/dom/testbindingiterable.rs index 2ee9fca631d4..a412c5e288d4 100644 --- a/components/script/dom/testbindingiterable.rs +++ b/components/script/dom/testbindingiterable.rs @@ -4,7 +4,7 @@ // check-tidy: no specs after this line -use dom::bindings::cell::DOMRefCell; +use dom::bindings::cell::DomRefCell; use dom::bindings::codegen::Bindings::TestBindingIterableBinding::{self, TestBindingIterableMethods}; use dom::bindings::error::Fallible; use dom::bindings::reflector::{Reflector, reflect_dom_object}; @@ -16,14 +16,14 @@ use dom_struct::dom_struct; #[dom_struct] pub struct TestBindingIterable { reflector: Reflector, - vals: DOMRefCell>, + vals: DomRefCell>, } impl TestBindingIterable { fn new(global: &GlobalScope) -> Root { reflect_dom_object(box TestBindingIterable { reflector: Reflector::new(), - vals: DOMRefCell::new(vec![]), + vals: DomRefCell::new(vec![]), }, global, TestBindingIterableBinding::Wrap) } diff --git a/components/script/dom/testbindingpairiterable.rs b/components/script/dom/testbindingpairiterable.rs index 7d95e95e7d70..106fb5e850b7 100644 --- a/components/script/dom/testbindingpairiterable.rs +++ b/components/script/dom/testbindingpairiterable.rs @@ -4,7 +4,7 @@ // check-tidy: no specs after this line -use dom::bindings::cell::DOMRefCell; +use dom::bindings::cell::DomRefCell; use dom::bindings::codegen::Bindings::TestBindingPairIterableBinding; use dom::bindings::codegen::Bindings::TestBindingPairIterableBinding::TestBindingPairIterableMethods; use dom::bindings::error::Fallible; @@ -18,7 +18,7 @@ use dom_struct::dom_struct; #[dom_struct] pub struct TestBindingPairIterable { reflector: Reflector, - map: DOMRefCell>, + map: DomRefCell>, } impl Iterable for TestBindingPairIterable { @@ -39,7 +39,7 @@ impl TestBindingPairIterable { fn new(global: &GlobalScope) -> Root { reflect_dom_object(box TestBindingPairIterable { reflector: Reflector::new(), - map: DOMRefCell::new(vec![]), + map: DomRefCell::new(vec![]), }, global, TestBindingPairIterableBinding::TestBindingPairIterableWrap) } diff --git a/components/script/dom/testworkletglobalscope.rs b/components/script/dom/testworkletglobalscope.rs index f548fb0544f9..ed29e8a4f30c 100644 --- a/components/script/dom/testworkletglobalscope.rs +++ b/components/script/dom/testworkletglobalscope.rs @@ -2,7 +2,7 @@ * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ -use dom::bindings::cell::DOMRefCell; +use dom::bindings::cell::DomRefCell; use dom::bindings::codegen::Bindings::TestWorkletGlobalScopeBinding; use dom::bindings::codegen::Bindings::TestWorkletGlobalScopeBinding::TestWorkletGlobalScopeMethods; use dom::bindings::root::Root; @@ -24,7 +24,7 @@ pub struct TestWorkletGlobalScope { // The worklet global for this object worklet_global: WorkletGlobalScope, // The key/value pairs - lookup_table: DOMRefCell>, + lookup_table: DomRefCell>, } impl TestWorkletGlobalScope { diff --git a/components/script/dom/url.rs b/components/script/dom/url.rs index b19d2337142f..73832c4e5a47 100644 --- a/components/script/dom/url.rs +++ b/components/script/dom/url.rs @@ -2,7 +2,7 @@ * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ -use dom::bindings::cell::DOMRefCell; +use dom::bindings::cell::DomRefCell; use dom::bindings::codegen::Bindings::URLBinding::{self, URLMethods}; use dom::bindings::error::{Error, ErrorResult, Fallible}; use dom::bindings::reflector::{DomObject, Reflector, reflect_dom_object}; @@ -27,7 +27,7 @@ pub struct URL { reflector_: Reflector, // https://url.spec.whatwg.org/#concept-url-url - url: DOMRefCell, + url: DomRefCell, // https://url.spec.whatwg.org/#dom-url-searchparams search_params: MutNullableDom, @@ -37,7 +37,7 @@ impl URL { fn new_inherited(url: ServoUrl) -> URL { URL { reflector_: Reflector::new(), - url: DOMRefCell::new(url), + url: DomRefCell::new(url), search_params: Default::default(), } } diff --git a/components/script/dom/urlsearchparams.rs b/components/script/dom/urlsearchparams.rs index cdb215a2c95e..6ac19c05db7c 100644 --- a/components/script/dom/urlsearchparams.rs +++ b/components/script/dom/urlsearchparams.rs @@ -2,7 +2,7 @@ * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ -use dom::bindings::cell::DOMRefCell; +use dom::bindings::cell::DomRefCell; use dom::bindings::codegen::Bindings::URLSearchParamsBinding::URLSearchParamsMethods; use dom::bindings::codegen::Bindings::URLSearchParamsBinding::URLSearchParamsWrap; use dom::bindings::codegen::UnionTypes::USVStringOrURLSearchParams; @@ -23,7 +23,7 @@ use url::form_urlencoded; pub struct URLSearchParams { reflector_: Reflector, // https://url.spec.whatwg.org/#concept-urlsearchparams-list - list: DOMRefCell>, + list: DomRefCell>, // https://url.spec.whatwg.org/#concept-urlsearchparams-url-object url: MutableWeakRef, } @@ -32,7 +32,7 @@ impl URLSearchParams { fn new_inherited(url: Option<&URL>) -> URLSearchParams { URLSearchParams { reflector_: Reflector::new(), - list: DOMRefCell::new(url.map_or(Vec::new(), |url| url.query_pairs())), + list: DomRefCell::new(url.map_or(Vec::new(), |url| url.query_pairs())), url: MutableWeakRef::new(url), } } diff --git a/components/script/dom/vr.rs b/components/script/dom/vr.rs index 83e75931e6aa..ea77bde63f84 100644 --- a/components/script/dom/vr.rs +++ b/components/script/dom/vr.rs @@ -2,7 +2,7 @@ * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ -use dom::bindings::cell::DOMRefCell; +use dom::bindings::cell::DomRefCell; use dom::bindings::codegen::Bindings::VRBinding; use dom::bindings::codegen::Bindings::VRBinding::VRMethods; use dom::bindings::codegen::Bindings::VRDisplayBinding::VRDisplayMethods; @@ -28,16 +28,16 @@ use webvr_traits::{WebVRGamepadData, WebVRGamepadEvent, WebVRGamepadState}; #[dom_struct] pub struct VR { reflector_: Reflector, - displays: DOMRefCell>>, - gamepads: DOMRefCell>> + displays: DomRefCell>>, + gamepads: DomRefCell>> } impl VR { fn new_inherited() -> VR { VR { reflector_: Reflector::new(), - displays: DOMRefCell::new(Vec::new()), - gamepads: DOMRefCell::new(Vec::new()), + displays: DomRefCell::new(Vec::new()), + gamepads: DomRefCell::new(Vec::new()), } } diff --git a/components/script/dom/vrdisplay.rs b/components/script/dom/vrdisplay.rs index c05ff88b19a7..81399b894e9e 100644 --- a/components/script/dom/vrdisplay.rs +++ b/components/script/dom/vrdisplay.rs @@ -5,7 +5,7 @@ use canvas_traits::webgl::{webgl_channel, WebGLReceiver, WebVRCommand}; use core::ops::Deref; use dom::bindings::callback::ExceptionHandling; -use dom::bindings::cell::DOMRefCell; +use dom::bindings::cell::DomRefCell; use dom::bindings::codegen::Bindings::PerformanceBinding::PerformanceBinding::PerformanceMethods; use dom::bindings::codegen::Bindings::VRDisplayBinding; use dom::bindings::codegen::Bindings::VRDisplayBinding::VRDisplayMethods; @@ -47,7 +47,7 @@ use webvr_traits::{WebVRDisplayData, WebVRDisplayEvent, WebVRFrameData, WebVRLay pub struct VRDisplay { eventtarget: EventTarget, #[ignore_heap_size_of = "Defined in rust-webvr"] - display: DOMRefCell, + display: DomRefCell, depth_near: Cell, depth_far: Cell, presenting: Cell, @@ -56,19 +56,19 @@ pub struct VRDisplay { capabilities: MutDom, stage_params: MutNullableDom, #[ignore_heap_size_of = "Defined in rust-webvr"] - frame_data: DOMRefCell, + frame_data: DomRefCell, #[ignore_heap_size_of = "Defined in rust-webvr"] - layer: DOMRefCell, + layer: DomRefCell, layer_ctx: MutNullableDom, #[ignore_heap_size_of = "Defined in rust-webvr"] next_raf_id: Cell, /// List of request animation frame callbacks #[ignore_heap_size_of = "closures are hard"] - raf_callback_list: DOMRefCell>)>>, + raf_callback_list: DomRefCell>)>>, // Compositor VRFrameData synchonization frame_data_status: Cell, #[ignore_heap_size_of = "channels are hard"] - frame_data_receiver: DOMRefCell, ()>>>>, + frame_data_receiver: DomRefCell, ()>>>>, running_display_raf: Cell, paused: Cell, stopped_on_pause: Cell, @@ -96,7 +96,7 @@ impl VRDisplay { VRDisplay { eventtarget: EventTarget::new_inherited(), - display: DOMRefCell::new(display.clone()), + display: DomRefCell::new(display.clone()), depth_near: Cell::new(0.01), depth_far: Cell::new(10000.0), presenting: Cell::new(false), @@ -104,13 +104,13 @@ impl VRDisplay { right_eye_params: MutDom::new(&*VREyeParameters::new(display.right_eye_parameters.clone(), &global)), capabilities: MutDom::new(&*VRDisplayCapabilities::new(display.capabilities.clone(), &global)), stage_params: MutNullableDom::new(stage.as_ref().map(|v| v.deref())), - frame_data: DOMRefCell::new(Default::default()), - layer: DOMRefCell::new(Default::default()), + frame_data: DomRefCell::new(Default::default()), + layer: DomRefCell::new(Default::default()), layer_ctx: MutNullableDom::default(), next_raf_id: Cell::new(1), - raf_callback_list: DOMRefCell::new(vec![]), + raf_callback_list: DomRefCell::new(vec![]), frame_data_status: Cell::new(VRFrameDataStatus::Waiting), - frame_data_receiver: DOMRefCell::new(None), + frame_data_receiver: DomRefCell::new(None), running_display_raf: Cell::new(false), // Some VR implementations (e.g. Daydream) can be paused in some life cycle situations // such as showing and hiding the controller pairing screen. diff --git a/components/script/dom/vrdisplaycapabilities.rs b/components/script/dom/vrdisplaycapabilities.rs index 39e8dabc854c..340a29428208 100644 --- a/components/script/dom/vrdisplaycapabilities.rs +++ b/components/script/dom/vrdisplaycapabilities.rs @@ -2,7 +2,7 @@ * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ -use dom::bindings::cell::DOMRefCell; +use dom::bindings::cell::DomRefCell; use dom::bindings::codegen::Bindings::VRDisplayCapabilitiesBinding; use dom::bindings::codegen::Bindings::VRDisplayCapabilitiesBinding::VRDisplayCapabilitiesMethods; use dom::bindings::reflector::{Reflector, reflect_dom_object}; @@ -15,7 +15,7 @@ use webvr_traits::WebVRDisplayCapabilities; pub struct VRDisplayCapabilities { reflector_: Reflector, #[ignore_heap_size_of = "Defined in rust-webvr"] - capabilities: DOMRefCell + capabilities: DomRefCell } unsafe_no_jsmanaged_fields!(WebVRDisplayCapabilities); @@ -24,7 +24,7 @@ impl VRDisplayCapabilities { fn new_inherited(capabilities: WebVRDisplayCapabilities) -> VRDisplayCapabilities { VRDisplayCapabilities { reflector_: Reflector::new(), - capabilities: DOMRefCell::new(capabilities) + capabilities: DomRefCell::new(capabilities) } } diff --git a/components/script/dom/vreyeparameters.rs b/components/script/dom/vreyeparameters.rs index 8df18c91e043..337f70d2b464 100644 --- a/components/script/dom/vreyeparameters.rs +++ b/components/script/dom/vreyeparameters.rs @@ -3,7 +3,7 @@ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ use core::nonzero::NonZero; -use dom::bindings::cell::DOMRefCell; +use dom::bindings::cell::DomRefCell; use dom::bindings::codegen::Bindings::VREyeParametersBinding; use dom::bindings::codegen::Bindings::VREyeParametersBinding::VREyeParametersMethods; use dom::bindings::reflector::{Reflector, reflect_dom_object}; @@ -21,7 +21,7 @@ use webvr_traits::WebVREyeParameters; pub struct VREyeParameters { reflector_: Reflector, #[ignore_heap_size_of = "Defined in rust-webvr"] - parameters: DOMRefCell, + parameters: DomRefCell, offset: Heap<*mut JSObject>, fov: Dom, } @@ -32,7 +32,7 @@ impl VREyeParameters { fn new_inherited(parameters: WebVREyeParameters, fov: &VRFieldOfView) -> VREyeParameters { VREyeParameters { reflector_: Reflector::new(), - parameters: DOMRefCell::new(parameters), + parameters: DomRefCell::new(parameters), offset: Heap::default(), fov: Dom::from_ref(&*fov) } diff --git a/components/script/dom/vrfieldofview.rs b/components/script/dom/vrfieldofview.rs index a91bb13fa83b..93f72bc77b5c 100644 --- a/components/script/dom/vrfieldofview.rs +++ b/components/script/dom/vrfieldofview.rs @@ -2,7 +2,7 @@ * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ -use dom::bindings::cell::DOMRefCell; +use dom::bindings::cell::DomRefCell; use dom::bindings::codegen::Bindings::VRFieldOfViewBinding; use dom::bindings::codegen::Bindings::VRFieldOfViewBinding::VRFieldOfViewMethods; use dom::bindings::num::Finite; @@ -16,7 +16,7 @@ use webvr_traits::WebVRFieldOfView; pub struct VRFieldOfView { reflector_: Reflector, #[ignore_heap_size_of = "Defined in rust-webvr"] - fov: DOMRefCell + fov: DomRefCell } unsafe_no_jsmanaged_fields!(WebVRFieldOfView); @@ -25,7 +25,7 @@ impl VRFieldOfView { fn new_inherited(fov: WebVRFieldOfView) -> VRFieldOfView { VRFieldOfView { reflector_: Reflector::new(), - fov: DOMRefCell::new(fov) + fov: DomRefCell::new(fov) } } diff --git a/components/script/dom/vrstageparameters.rs b/components/script/dom/vrstageparameters.rs index 2161b215560e..c2731d1193bc 100644 --- a/components/script/dom/vrstageparameters.rs +++ b/components/script/dom/vrstageparameters.rs @@ -3,7 +3,7 @@ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ use core::nonzero::NonZero; -use dom::bindings::cell::DOMRefCell; +use dom::bindings::cell::DomRefCell; use dom::bindings::codegen::Bindings::VRStageParametersBinding; use dom::bindings::codegen::Bindings::VRStageParametersBinding::VRStageParametersMethods; use dom::bindings::num::Finite; @@ -20,7 +20,7 @@ use webvr_traits::WebVRStageParameters; pub struct VRStageParameters { reflector_: Reflector, #[ignore_heap_size_of = "Defined in rust-webvr"] - parameters: DOMRefCell, + parameters: DomRefCell, transform: Heap<*mut JSObject>, } @@ -30,7 +30,7 @@ impl VRStageParameters { fn new_inherited(parameters: WebVRStageParameters) -> VRStageParameters { VRStageParameters { reflector_: Reflector::new(), - parameters: DOMRefCell::new(parameters), + parameters: DomRefCell::new(parameters), transform: Heap::default() } } diff --git a/components/script/dom/webgl_extensions/ext/webglvertexarrayobjectoes.rs b/components/script/dom/webgl_extensions/ext/webglvertexarrayobjectoes.rs index 3ef5f8bbefa0..cdbe9f2e2e81 100644 --- a/components/script/dom/webgl_extensions/ext/webglvertexarrayobjectoes.rs +++ b/components/script/dom/webgl_extensions/ext/webglvertexarrayobjectoes.rs @@ -5,7 +5,7 @@ use canvas_traits::webgl::WebGLVertexArrayId; use core::cell::Ref; use core::iter::FromIterator; -use dom::bindings::cell::DOMRefCell; +use dom::bindings::cell::DomRefCell; use dom::bindings::codegen::Bindings::WebGLVertexArrayObjectOESBinding; use dom::bindings::reflector::reflect_dom_object; use dom::bindings::root::{Dom, MutNullableDom, Root}; @@ -22,7 +22,7 @@ pub struct WebGLVertexArrayObjectOES { id: WebGLVertexArrayId, ever_bound: Cell, is_deleted: Cell, - bound_attrib_buffers: DOMRefCell>>, + bound_attrib_buffers: DomRefCell>>, bound_buffer_element_array: MutNullableDom, } @@ -33,7 +33,7 @@ impl WebGLVertexArrayObjectOES { id: id, ever_bound: Cell::new(false), is_deleted: Cell::new(false), - bound_attrib_buffers: DOMRefCell::new(HashMap::new()), + bound_attrib_buffers: DomRefCell::new(HashMap::new()), bound_buffer_element_array: MutNullableDom::new(None), } } diff --git a/components/script/dom/webgl_extensions/extensions.rs b/components/script/dom/webgl_extensions/extensions.rs index 1eca2aac3ca2..ebadaf9a6128 100644 --- a/components/script/dom/webgl_extensions/extensions.rs +++ b/components/script/dom/webgl_extensions/extensions.rs @@ -5,7 +5,7 @@ use canvas_traits::webgl::WebGLError; use core::iter::FromIterator; use core::nonzero::NonZero; -use dom::bindings::cell::DOMRefCell; +use dom::bindings::cell::DomRefCell; use dom::bindings::codegen::Bindings::OESStandardDerivativesBinding::OESStandardDerivativesConstants; use dom::bindings::codegen::Bindings::OESTextureHalfFloatBinding::OESTextureHalfFloatConstants; use dom::bindings::codegen::Bindings::WebGLRenderingContextBinding::WebGLRenderingContextConstants as constants; @@ -76,15 +76,15 @@ impl Default for WebGLExtensionFeatures { #[must_root] #[derive(HeapSizeOf, JSTraceable)] pub struct WebGLExtensions { - extensions: DOMRefCell>>, - features: DOMRefCell, + extensions: DomRefCell>>, + features: DomRefCell, } impl WebGLExtensions { pub fn new() -> WebGLExtensions { Self { - extensions: DOMRefCell::new(HashMap::new()), - features: DOMRefCell::new(Default::default()) + extensions: DomRefCell::new(HashMap::new()), + features: DomRefCell::new(Default::default()) } } diff --git a/components/script/dom/webglbuffer.rs b/components/script/dom/webglbuffer.rs index 4a3e26344534..63859fb9afe6 100644 --- a/components/script/dom/webglbuffer.rs +++ b/components/script/dom/webglbuffer.rs @@ -5,7 +5,7 @@ // https://www.khronos.org/registry/webgl/specs/latest/1.0/webgl.idl use canvas_traits::webgl::{WebGLBufferId, WebGLCommand, WebGLError, WebGLMsgSender, WebGLResult, WebGLVertexArrayId}; use canvas_traits::webgl::webgl_channel; -use dom::bindings::cell::DOMRefCell; +use dom::bindings::cell::DomRefCell; use dom::bindings::codegen::Bindings::WebGLBufferBinding; use dom::bindings::reflector::reflect_dom_object; use dom::bindings::root::Root; @@ -25,7 +25,7 @@ pub struct WebGLBuffer { capacity: Cell, is_deleted: Cell, // The Vertex Array Objects that are referencing this buffer - vao_references: DOMRefCell>>, + vao_references: DomRefCell>>, pending_delete: Cell, #[ignore_heap_size_of = "Defined in ipc-channel"] renderer: WebGLMsgSender, @@ -41,7 +41,7 @@ impl WebGLBuffer { target: Cell::new(None), capacity: Cell::new(0), is_deleted: Cell::new(false), - vao_references: DOMRefCell::new(None), + vao_references: DomRefCell::new(None), pending_delete: Cell::new(false), renderer: renderer, } diff --git a/components/script/dom/webglframebuffer.rs b/components/script/dom/webglframebuffer.rs index 0a8df198cdb8..35698c5a4d2a 100644 --- a/components/script/dom/webglframebuffer.rs +++ b/components/script/dom/webglframebuffer.rs @@ -6,7 +6,7 @@ use canvas_traits::webgl::{WebGLCommand, WebGLFramebufferBindingRequest, WebGLFramebufferId}; use canvas_traits::webgl::{WebGLMsgSender, WebGLResult, WebGLError}; use canvas_traits::webgl::webgl_channel; -use dom::bindings::cell::DOMRefCell; +use dom::bindings::cell::DomRefCell; use dom::bindings::codegen::Bindings::WebGLFramebufferBinding; use dom::bindings::codegen::Bindings::WebGLRenderingContextBinding::WebGLRenderingContextConstants as constants; use dom::bindings::reflector::reflect_dom_object; @@ -39,10 +39,10 @@ pub struct WebGLFramebuffer { // The attachment points for textures and renderbuffers on this // FBO. - color: DOMRefCell>, - depth: DOMRefCell>, - stencil: DOMRefCell>, - depthstencil: DOMRefCell>, + color: DomRefCell>, + depth: DomRefCell>, + stencil: DomRefCell>, + depthstencil: DomRefCell>, } impl WebGLFramebuffer { @@ -57,10 +57,10 @@ impl WebGLFramebuffer { renderer: renderer, size: Cell::new(None), status: Cell::new(constants::FRAMEBUFFER_UNSUPPORTED), - color: DOMRefCell::new(None), - depth: DOMRefCell::new(None), - stencil: DOMRefCell::new(None), - depthstencil: DOMRefCell::new(None), + color: DomRefCell::new(None), + depth: DomRefCell::new(None), + stencil: DomRefCell::new(None), + depthstencil: DomRefCell::new(None), } } @@ -291,7 +291,7 @@ impl WebGLFramebuffer { } fn with_matching_renderbuffers(&self, rb: &WebGLRenderbuffer, mut closure: F) - where F: FnMut(&DOMRefCell>) + where F: FnMut(&DomRefCell>) { let attachments = [&self.color, &self.depth, @@ -314,7 +314,7 @@ impl WebGLFramebuffer { } fn with_matching_textures(&self, texture: &WebGLTexture, mut closure: F) - where F: FnMut(&DOMRefCell>) + where F: FnMut(&DomRefCell>) { let attachments = [&self.color, &self.depth, diff --git a/components/script/dom/webglrenderingcontext.rs b/components/script/dom/webglrenderingcontext.rs index 6ce1718d7995..dd0c802ab09e 100644 --- a/components/script/dom/webglrenderingcontext.rs +++ b/components/script/dom/webglrenderingcontext.rs @@ -11,7 +11,7 @@ use canvas_traits::webgl::webgl_channel; use core::cell::Ref; use core::iter::FromIterator; use core::nonzero::NonZero; -use dom::bindings::cell::DOMRefCell; +use dom::bindings::cell::DomRefCell; use dom::bindings::codegen::Bindings::WebGLRenderingContextBinding::{self, WebGLContextAttributes}; use dom::bindings::codegen::Bindings::WebGLRenderingContextBinding::WebGLRenderingContextConstants as constants; use dom::bindings::codegen::Bindings::WebGLRenderingContextBinding::WebGLRenderingContextMethods; @@ -151,7 +151,7 @@ pub struct WebGLRenderingContext { bound_texture_cube_map: MutNullableDom, bound_buffer_array: MutNullableDom, bound_buffer_element_array: MutNullableDom, - bound_attrib_buffers: DOMRefCell>>, + bound_attrib_buffers: DomRefCell>>, current_program: MutNullableDom, #[ignore_heap_size_of = "Because it's small"] current_vertex_attrib_0: Cell<(f32, f32, f32, f32)>, @@ -194,7 +194,7 @@ impl WebGLRenderingContext { bound_texture_cube_map: MutNullableDom::new(None), bound_buffer_array: MutNullableDom::new(None), bound_buffer_element_array: MutNullableDom::new(None), - bound_attrib_buffers: DOMRefCell::new(Default::default()), + bound_attrib_buffers: DomRefCell::new(Default::default()), bound_renderbuffer: MutNullableDom::new(None), current_program: MutNullableDom::new(None), current_vertex_attrib_0: Cell::new((0f32, 0f32, 0f32, 1f32)), diff --git a/components/script/dom/webglshader.rs b/components/script/dom/webglshader.rs index 8f9c0f78f3b1..54f2a743446b 100644 --- a/components/script/dom/webglshader.rs +++ b/components/script/dom/webglshader.rs @@ -5,7 +5,7 @@ // https://www.khronos.org/registry/webgl/specs/latest/1.0/webgl.idl use angle::hl::{BuiltInResources, Output, ShaderValidator}; use canvas_traits::webgl::{webgl_channel, WebGLCommand, WebGLMsgSender, WebGLParameter, WebGLResult, WebGLShaderId}; -use dom::bindings::cell::DOMRefCell; +use dom::bindings::cell::DomRefCell; use dom::bindings::codegen::Bindings::WebGLShaderBinding; use dom::bindings::reflector::reflect_dom_object; use dom::bindings::root::Root; @@ -30,8 +30,8 @@ pub struct WebGLShader { webgl_object: WebGLObject, id: WebGLShaderId, gl_type: u32, - source: DOMRefCell>, - info_log: DOMRefCell>, + source: DomRefCell>, + info_log: DomRefCell>, is_deleted: Cell, attached_counter: Cell, compilation_status: Cell, @@ -57,8 +57,8 @@ impl WebGLShader { webgl_object: WebGLObject::new_inherited(), id: id, gl_type: shader_type, - source: DOMRefCell::new(None), - info_log: DOMRefCell::new(None), + source: DomRefCell::new(None), + info_log: DomRefCell::new(None), is_deleted: Cell::new(false), attached_counter: Cell::new(0), compilation_status: Cell::new(ShaderCompilationStatus::NotCompiled), diff --git a/components/script/dom/webgltexture.rs b/components/script/dom/webgltexture.rs index 22800430a6b0..fe323b53efda 100644 --- a/components/script/dom/webgltexture.rs +++ b/components/script/dom/webgltexture.rs @@ -5,7 +5,7 @@ // https://www.khronos.org/registry/webgl/specs/latest/1.0/webgl.idl use canvas_traits::webgl::{webgl_channel, WebGLCommand, WebGLError, WebGLMsgSender, WebGLResult, WebGLTextureId}; -use dom::bindings::cell::DOMRefCell; +use dom::bindings::cell::DomRefCell; use dom::bindings::codegen::Bindings::WebGLRenderingContextBinding::WebGLRenderingContextConstants as constants; use dom::bindings::codegen::Bindings::WebGLTextureBinding; use dom::bindings::reflector::reflect_dom_object; @@ -36,7 +36,7 @@ pub struct WebGLTexture { is_deleted: Cell, /// Stores information about mipmap levels and cubemap faces. #[ignore_heap_size_of = "Arrays are cumbersome"] - image_info_array: DOMRefCell<[ImageInfo; MAX_LEVEL_COUNT * MAX_FACE_COUNT]>, + image_info_array: DomRefCell<[ImageInfo; MAX_LEVEL_COUNT * MAX_FACE_COUNT]>, /// Face count can only be 1 or 6 face_count: Cell, base_mipmap_level: u32, @@ -60,7 +60,7 @@ impl WebGLTexture { base_mipmap_level: 0, min_filter: Cell::new(None), mag_filter: Cell::new(None), - image_info_array: DOMRefCell::new([ImageInfo::new(); MAX_LEVEL_COUNT * MAX_FACE_COUNT]), + image_info_array: DomRefCell::new([ImageInfo::new(); MAX_LEVEL_COUNT * MAX_FACE_COUNT]), renderer: renderer, } } diff --git a/components/script/dom/websocket.rs b/components/script/dom/websocket.rs index 4e25a64fce70..132c616ae498 100644 --- a/components/script/dom/websocket.rs +++ b/components/script/dom/websocket.rs @@ -2,7 +2,7 @@ * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ -use dom::bindings::cell::DOMRefCell; +use dom::bindings::cell::DomRefCell; use dom::bindings::codegen::Bindings::BlobBinding::BlobMethods; use dom::bindings::codegen::Bindings::WebSocketBinding; use dom::bindings::codegen::Bindings::WebSocketBinding::{BinaryType, WebSocketMethods}; @@ -105,9 +105,9 @@ pub struct WebSocket { buffered_amount: Cell, clearing_buffer: Cell, //Flag to tell if there is a running thread to clear buffered_amount #[ignore_heap_size_of = "Defined in std"] - sender: DOMRefCell>>, + sender: DomRefCell>>, binary_type: Cell, - protocol: DOMRefCell, //Subprotocol selected by server + protocol: DomRefCell, //Subprotocol selected by server } impl WebSocket { @@ -118,9 +118,9 @@ impl WebSocket { ready_state: Cell::new(WebSocketRequestState::Connecting), buffered_amount: Cell::new(0), clearing_buffer: Cell::new(false), - sender: DOMRefCell::new(None), + sender: DomRefCell::new(None), binary_type: Cell::new(BinaryType::Blob), - protocol: DOMRefCell::new("".to_owned()), + protocol: DomRefCell::new("".to_owned()), } } diff --git a/components/script/dom/window.rs b/components/script/dom/window.rs index 1cb9bd37158f..10e0299b0aed 100644 --- a/components/script/dom/window.rs +++ b/components/script/dom/window.rs @@ -8,7 +8,7 @@ use bluetooth_traits::BluetoothRequest; use canvas_traits::webgl::WebGLChan; use cssparser::{Parser, ParserInput}; use devtools_traits::{ScriptToDevtoolsControlMsg, TimelineMarker, TimelineMarkerType}; -use dom::bindings::cell::DOMRefCell; +use dom::bindings::cell::DomRefCell; use dom::bindings::codegen::Bindings::DocumentBinding::{DocumentMethods, DocumentReadyState}; use dom::bindings::codegen::Bindings::FunctionBinding::Function; use dom::bindings::codegen::Bindings::PermissionStatusBinding::PermissionState; @@ -192,13 +192,13 @@ pub struct Window { screen: MutNullableDom, session_storage: MutNullableDom, local_storage: MutNullableDom, - status: DOMRefCell, + status: DomRefCell, /// For sending timeline markers. Will be ignored if /// no devtools server - devtools_markers: DOMRefCell>, + devtools_markers: DomRefCell>, #[ignore_heap_size_of = "channels are hard"] - devtools_marker_sender: DOMRefCell>>>, + devtools_marker_sender: DomRefCell>>>, /// Pending resize event, if any. resize_event: Cell>, @@ -211,7 +211,7 @@ pub struct Window { /// The JavaScript runtime. #[ignore_heap_size_of = "Rc is hard"] - js_runtime: DOMRefCell>>, + js_runtime: DomRefCell>>, /// A handle for communicating messages to the layout thread. #[ignore_heap_size_of = "channels are hard"] @@ -244,7 +244,7 @@ pub struct Window { /// A channel for communicating results of async scripts back to the webdriver server #[ignore_heap_size_of = "channels are hard"] - webdriver_script_chan: DOMRefCell>>, + webdriver_script_chan: DomRefCell>>, /// The current state of the window object current_state: Cell, @@ -253,12 +253,12 @@ pub struct Window { /// A flag to prevent async events from attempting to interact with this window. #[ignore_heap_size_of = "defined in std"] - ignore_further_async_events: DOMRefCell>, + ignore_further_async_events: DomRefCell>, error_reporter: CSSErrorReporter, /// A list of scroll offsets for each scrollable element. - scroll_offsets: DOMRefCell>>, + scroll_offsets: DomRefCell>>, /// All the MediaQueryLists we need to update media_query_lists: WeakMediaQueryListVec, @@ -274,17 +274,17 @@ pub struct Window { webvr_chan: Option>, /// A map for storing the previous permission state read results. - permission_state_invocation_results: DOMRefCell>, + permission_state_invocation_results: DomRefCell>, /// All of the elements that have an outstanding image request that was /// initiated by layout during a reflow. They are stored in the script thread /// to ensure that the element can be marked dirty when the image data becomes /// available at some point in the future. - pending_layout_images: DOMRefCell>>>, + pending_layout_images: DomRefCell>>>, /// Directory to store unminified scripts for this window if unminify-js /// opt is enabled. - unminified_js_dir: DOMRefCell>, + unminified_js_dir: DomRefCell>, /// Worklets test_worklet: MutNullableDom, @@ -404,7 +404,7 @@ impl Window { Worklet::new(self, WorkletGlobalScopeType::Paint) } - pub fn permission_state_invocation_results(&self) -> &DOMRefCell> { + pub fn permission_state_invocation_results(&self) -> &DomRefCell> { &self.permission_state_invocation_results } @@ -1866,10 +1866,10 @@ impl Window { screen: Default::default(), session_storage: Default::default(), local_storage: Default::default(), - status: DOMRefCell::new(DOMString::new()), + status: DomRefCell::new(DOMString::new()), parent_info, dom_static: GlobalStaticData::new(), - js_runtime: DOMRefCell::new(Some(runtime.clone())), + js_runtime: DomRefCell::new(Some(runtime.clone())), bluetooth_thread, bluetooth_extra_permission_data: BluetoothExtraPermissionData::new(), page_clip_rect: Cell::new(max_rect()), diff --git a/components/script/dom/xmlhttprequest.rs b/components/script/dom/xmlhttprequest.rs index a08982c42558..16c14cb2e5b8 100644 --- a/components/script/dom/xmlhttprequest.rs +++ b/components/script/dom/xmlhttprequest.rs @@ -3,7 +3,7 @@ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ use document_loader::DocumentLoader; -use dom::bindings::cell::DOMRefCell; +use dom::bindings::cell::DomRefCell; use dom::bindings::codegen::Bindings::BlobBinding::BlobBinding::BlobMethods; use dom::bindings::codegen::Bindings::WindowBinding::WindowMethods; use dom::bindings::codegen::Bindings::XMLHttpRequestBinding; @@ -90,8 +90,8 @@ pub struct GenerationId(u32); struct XHRContext { xhr: TrustedXHRAddress, gen_id: GenerationId, - buf: DOMRefCell>, - sync_status: DOMRefCell>, + buf: DomRefCell>, + sync_status: DomRefCell>, } #[derive(Clone)] @@ -124,34 +124,34 @@ pub struct XMLHttpRequest { timeout: Cell, with_credentials: Cell, upload: Dom, - response_url: DOMRefCell, + response_url: DomRefCell, status: Cell, - status_text: DOMRefCell, - response: DOMRefCell, + status_text: DomRefCell, + response: DomRefCell, response_type: Cell, response_xml: MutNullableDom, response_blob: MutNullableDom, #[ignore_heap_size_of = "Defined in rust-mozjs"] response_json: Heap, #[ignore_heap_size_of = "Defined in hyper"] - response_headers: DOMRefCell, + response_headers: DomRefCell, #[ignore_heap_size_of = "Defined in hyper"] - override_mime_type: DOMRefCell>, + override_mime_type: DomRefCell>, #[ignore_heap_size_of = "Defined in rust-encoding"] - override_charset: DOMRefCell>, + override_charset: DomRefCell>, // Associated concepts #[ignore_heap_size_of = "Defined in hyper"] - request_method: DOMRefCell, - request_url: DOMRefCell>, + request_method: DomRefCell, + request_url: DomRefCell>, #[ignore_heap_size_of = "Defined in hyper"] - request_headers: DOMRefCell, + request_headers: DomRefCell, request_body_len: Cell, sync: Cell, upload_complete: Cell, send_flag: Cell, - timeout_cancel: DOMRefCell>, + timeout_cancel: DomRefCell>, fetch_time: Cell, generation_id: Cell, response_status: Cell>, @@ -175,27 +175,27 @@ impl XMLHttpRequest { timeout: Cell::new(0u32), with_credentials: Cell::new(false), upload: Dom::from_ref(&*XMLHttpRequestUpload::new(global)), - response_url: DOMRefCell::new(String::new()), + response_url: DomRefCell::new(String::new()), status: Cell::new(0), - status_text: DOMRefCell::new(ByteString::new(vec!())), - response: DOMRefCell::new(ByteString::new(vec!())), + status_text: DomRefCell::new(ByteString::new(vec!())), + response: DomRefCell::new(ByteString::new(vec!())), response_type: Cell::new(XMLHttpRequestResponseType::_empty), response_xml: Default::default(), response_blob: Default::default(), response_json: Heap::default(), - response_headers: DOMRefCell::new(Headers::new()), - override_mime_type: DOMRefCell::new(None), - override_charset: DOMRefCell::new(None), + response_headers: DomRefCell::new(Headers::new()), + override_mime_type: DomRefCell::new(None), + override_charset: DomRefCell::new(None), - request_method: DOMRefCell::new(Method::Get), - request_url: DOMRefCell::new(None), - request_headers: DOMRefCell::new(Headers::new()), + request_method: DomRefCell::new(Method::Get), + request_url: DomRefCell::new(None), + request_headers: DomRefCell::new(Headers::new()), request_body_len: Cell::new(0), sync: Cell::new(false), upload_complete: Cell::new(false), send_flag: Cell::new(false), - timeout_cancel: DOMRefCell::new(None), + timeout_cancel: DomRefCell::new(None), fetch_time: Cell::new(0), generation_id: Cell::new(GenerationId(0)), response_status: Cell::new(Ok(())), @@ -1279,8 +1279,8 @@ impl XMLHttpRequest { let context = Arc::new(Mutex::new(XHRContext { xhr: xhr, gen_id: self.generation_id.get(), - buf: DOMRefCell::new(vec!()), - sync_status: DOMRefCell::new(None), + buf: DomRefCell::new(vec!()), + sync_status: DomRefCell::new(None), })); let (task_source, script_port) = if self.sync.get() { diff --git a/components/script/microtask.rs b/components/script/microtask.rs index f88f6e8fa4c7..476a551c25cc 100644 --- a/components/script/microtask.rs +++ b/components/script/microtask.rs @@ -7,7 +7,7 @@ //! perform checkpoints at appropriate times, as well as enqueue microtasks as required. use dom::bindings::callback::ExceptionHandling; -use dom::bindings::cell::DOMRefCell; +use dom::bindings::cell::DomRefCell; use dom::bindings::codegen::Bindings::PromiseBinding::PromiseJobCallback; use dom::bindings::root::Root; use dom::globalscope::GlobalScope; @@ -24,7 +24,7 @@ use std::rc::Rc; #[derive(Default, HeapSizeOf, JSTraceable)] pub struct MicrotaskQueue { /// The list of enqueued microtasks that will be invoked at the next microtask checkpoint. - microtask_queue: DOMRefCell>, + microtask_queue: DomRefCell>, /// https://html.spec.whatwg.org/multipage/#performing-a-microtask-checkpoint performing_a_microtask_checkpoint: Cell, } diff --git a/components/script/script_thread.rs b/components/script/script_thread.rs index 6da18b8f28b4..5957b3a88578 100644 --- a/components/script/script_thread.rs +++ b/components/script/script_thread.rs @@ -24,7 +24,7 @@ use devtools_traits::{DevtoolScriptControlMsg, DevtoolsPageInfo}; use devtools_traits::{ScriptToDevtoolsControlMsg, WorkerId}; use devtools_traits::CSSError; use document_loader::DocumentLoader; -use dom::bindings::cell::DOMRefCell; +use dom::bindings::cell::DomRefCell; use dom::bindings::codegen::Bindings::CSSStyleDeclarationBinding::CSSStyleDeclarationMethods; use dom::bindings::codegen::Bindings::DocumentBinding::{DocumentMethods, DocumentReadyState}; use dom::bindings::codegen::Bindings::EventBinding::EventInit; @@ -385,16 +385,16 @@ impl<'a> Iterator for DocumentsIter<'a> { #[allow(unrooted_must_root)] pub struct ScriptThread { /// The documents for pipelines managed by this thread - documents: DOMRefCell, + documents: DomRefCell, /// The window proxies known by this thread /// TODO: this map grows, but never shrinks. Issue #15258. - window_proxies: DOMRefCell>>, + window_proxies: DomRefCell>>, /// A list of data pertaining to loads that have not yet received a network response - incomplete_loads: DOMRefCell>, + incomplete_loads: DomRefCell>, /// A vector containing parser contexts which have not yet been fully processed - incomplete_parser_contexts: DOMRefCell>, + incomplete_parser_contexts: DomRefCell>, /// A map to store service worker registrations for a given origin - registration_map: DOMRefCell>>, + registration_map: DomRefCell>>, /// A job queue for Service Workers keyed by their scope url job_queue_map: Rc, /// Image cache for this script thread. @@ -461,7 +461,7 @@ pub struct ScriptThread { topmost_mouse_over_target: MutNullableDom, /// List of pipelines that have been owned and closed by this script thread. - closed_pipelines: DOMRefCell>, + closed_pipelines: DomRefCell>, scheduler_chan: IpcSender, timer_event_chan: Sender, @@ -476,7 +476,7 @@ pub struct ScriptThread { mutation_observer_compound_microtask_queued: Cell, /// The unit of related similar-origin browsing contexts' list of MutationObserver objects - mutation_observers: DOMRefCell>>, + mutation_observers: DomRefCell>>, /// A handle to the webgl thread webgl_chan: WebGLPipeline, @@ -485,15 +485,15 @@ pub struct ScriptThread { webvr_chan: Option>, /// The worklet thread pool - worklet_thread_pool: DOMRefCell>>, + worklet_thread_pool: DomRefCell>>, /// A list of pipelines containing documents that finished loading all their blocking /// resources during a turn of the event loop. - docs_with_no_blocking_loads: DOMRefCell>>, + docs_with_no_blocking_loads: DomRefCell>>, /// A list of nodes with in-progress CSS transitions, which roots them for the duration /// of the transition. - transitioning_nodes: DOMRefCell>>, + transitioning_nodes: DomRefCell>>, /// https://html.spec.whatwg.org/multipage/#custom-element-reactions-stack custom_element_reaction_stack: CustomElementReactionStack, @@ -811,11 +811,11 @@ impl ScriptThread { let (image_cache_channel, image_cache_port) = channel(); ScriptThread { - documents: DOMRefCell::new(Documents::new()), - window_proxies: DOMRefCell::new(HashMap::new()), - incomplete_loads: DOMRefCell::new(vec!()), - incomplete_parser_contexts: DOMRefCell::new(vec!()), - registration_map: DOMRefCell::new(HashMap::new()), + documents: DomRefCell::new(Documents::new()), + window_proxies: DomRefCell::new(HashMap::new()), + incomplete_loads: DomRefCell::new(vec!()), + incomplete_parser_contexts: DomRefCell::new(vec!()), + registration_map: DomRefCell::new(HashMap::new()), job_queue_map: Rc::new(JobQueue::new()), image_cache: state.image_cache.clone(), @@ -847,7 +847,7 @@ impl ScriptThread { js_runtime: Rc::new(runtime), topmost_mouse_over_target: MutNullableDom::new(Default::default()), - closed_pipelines: DOMRefCell::new(HashSet::new()), + closed_pipelines: DomRefCell::new(HashSet::new()), scheduler_chan: state.scheduler_chan, timer_event_chan: timer_event_chan, diff --git a/components/script/serviceworkerjob.rs b/components/script/serviceworkerjob.rs index 76276d7b5cef..1a146f82c618 100644 --- a/components/script/serviceworkerjob.rs +++ b/components/script/serviceworkerjob.rs @@ -7,7 +7,7 @@ //! the script thread. The script thread contains a JobQueue, which stores all scheduled Jobs //! by multiple service worker clients in a Vec. -use dom::bindings::cell::DOMRefCell; +use dom::bindings::cell::DomRefCell; use dom::bindings::error::Error; use dom::bindings::refcounted::{Trusted, TrustedPromise}; use dom::bindings::reflector::DomObject; @@ -93,11 +93,11 @@ impl PartialEq for Job { #[must_root] #[derive(JSTraceable)] -pub struct JobQueue(pub DOMRefCell>>); +pub struct JobQueue(pub DomRefCell>>); impl JobQueue { pub fn new() -> JobQueue { - JobQueue(DOMRefCell::new(HashMap::new())) + JobQueue(DomRefCell::new(HashMap::new())) } #[allow(unrooted_must_root)] // https://w3c.github.io/ServiceWorker/#schedule-job-algorithm diff --git a/components/script/test.rs b/components/script/test.rs index 18d8754d8318..0ff6811b14da 100644 --- a/components/script/test.rs +++ b/components/script/test.rs @@ -6,7 +6,7 @@ pub use dom::bindings::str::{ByteString, DOMString}; pub use dom::headers::normalize_value; // For compile-fail tests only. -pub use dom::bindings::cell::DOMRefCell; +pub use dom::bindings::cell::DomRefCell; pub use dom::bindings::root::Dom; pub use dom::node::Node; pub use dom::bindings::refcounted::TrustedPromise; diff --git a/components/script/timers.rs b/components/script/timers.rs index 7d219bbb199d..1f69eca03ba9 100644 --- a/components/script/timers.rs +++ b/components/script/timers.rs @@ -3,7 +3,7 @@ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ use dom::bindings::callback::ExceptionHandling::Report; -use dom::bindings::cell::DOMRefCell; +use dom::bindings::cell::DomRefCell; use dom::bindings::codegen::Bindings::FunctionBinding::Function; use dom::bindings::reflector::DomObject; use dom::bindings::str::DOMString; @@ -38,7 +38,7 @@ pub struct OneshotTimers { #[ignore_heap_size_of = "Defined in std"] scheduler_chan: IpcSender, next_timer_handle: Cell, - timers: DOMRefCell>, + timers: DomRefCell>, suspended_since: Cell>, /// Initially 0, increased whenever the associated document is reactivated /// by the amount of ms the document was inactive. The current time can be @@ -117,7 +117,7 @@ impl OneshotTimers { timer_event_chan: timer_event_chan, scheduler_chan: scheduler_chan, next_timer_handle: Cell::new(OneshotTimerHandle(1)), - timers: DOMRefCell::new(Vec::new()), + timers: DomRefCell::new(Vec::new()), suspended_since: Cell::new(None), suspension_offset: Cell::new(Length::new(0)), expected_event_id: Cell::new(TimerEventId(0)), @@ -307,7 +307,7 @@ pub struct JsTimerHandle(i32); #[derive(DenyPublicFields, HeapSizeOf, JSTraceable)] pub struct JsTimers { next_timer_handle: Cell, - active_timers: DOMRefCell>, + active_timers: DomRefCell>, /// The nesting level of the currently executing timer task or 0. nesting_level: Cell, /// Used to introduce a minimum delay in event intervals @@ -364,7 +364,7 @@ impl JsTimers { pub fn new() -> JsTimers { JsTimers { next_timer_handle: Cell::new(JsTimerHandle(1)), - active_timers: DOMRefCell::new(HashMap::new()), + active_timers: DomRefCell::new(HashMap::new()), nesting_level: Cell::new(0), min_duration: Cell::new(None), } diff --git a/components/script_plugins/unrooted_must_root.rs b/components/script_plugins/unrooted_must_root.rs index b0b409862c51..5b5647794dcb 100644 --- a/components/script_plugins/unrooted_must_root.rs +++ b/components/script_plugins/unrooted_must_root.rs @@ -186,11 +186,11 @@ impl<'a, 'b, 'tcx> visit::Visitor<'tcx> for FnDefVisitor<'a, 'b, 'tcx> { hir::ExprCast(ref subexpr, _) => require_rooted(cx, self.in_new_function, &*subexpr), // This catches assignments... the main point of this would be to catch mutable // references to `JS`. - // FIXME: Enable this? Triggers on certain kinds of uses of DOMRefCell. + // FIXME: Enable this? Triggers on certain kinds of uses of DomRefCell. // hir::ExprAssign(_, ref rhs) => require_rooted(cx, self.in_new_function, &*rhs), // This catches calls; basically, this enforces the constraint that only constructors // can call other constructors. - // FIXME: Enable this? Currently triggers with constructs involving DOMRefCell, and + // FIXME: Enable this? Currently triggers with constructs involving DomRefCell, and // constructs like Vec> and RootedVec>. // hir::ExprCall(..) if !self.in_new_function => { // require_rooted(cx, self.in_new_function, expr); diff --git a/python/tidy/servo_tidy/tidy.py b/python/tidy/servo_tidy/tidy.py index d7c83ee8cee1..e23834c0c58c 100644 --- a/python/tidy/servo_tidy/tidy.py +++ b/python/tidy/servo_tidy/tidy.py @@ -574,11 +574,11 @@ def check_rust(file_name, lines): # No benefit over using &str (r": &String", "use &str instead of &String", no_filter), # There should be any use of banned types: - # Cell, Cell>, DOMRefCell>, DOMRefCell> + # Cell, Cell>, DomRefCell>, DomRefCell> (r"(\s|:)+Cell", "Banned type Cell detected. Use MutDom instead", no_filter), (r"(\s|:)+Cell>", "Banned type Cell> detected. Use MutDom instead", no_filter), - (r"DOMRefCell>", "Banned type DOMRefCell> detected. Use MutDom instead", no_filter), - (r"DOMRefCell>", "Banned type DOMRefCell> detected. Use MutDom instead", no_filter), + (r"DomRefCell>", "Banned type DomRefCell> detected. Use MutDom instead", no_filter), + (r"DomRefCell>", "Banned type DomRefCell> detected. Use MutDom instead", no_filter), # No benefit to using &Root (r": &Root<", "use &T instead of &Root", no_filter), (r"^&&", "operators should go at the end of the first line", no_filter), diff --git a/python/tidy/servo_tidy_tests/ban-domrefcell.rs b/python/tidy/servo_tidy_tests/ban-domrefcell.rs index 6d4e2b2fbc3b..74b79e813cfa 100644 --- a/python/tidy/servo_tidy_tests/ban-domrefcell.rs +++ b/python/tidy/servo_tidy_tests/ban-domrefcell.rs @@ -8,12 +8,12 @@ extern crate script; use script::test::Dom; -use script::test::DOMRefCell; +use script::test::DomRefCell; use script::test::Node; struct Foo { - bar: DOMRefCell> - //~^ ERROR Banned type DOMRefCell> detected. Use MutDom instead + bar: DomRefCell> + //~^ ERROR Banned type DomRefCell> detected. Use MutDom instead } fn main() {} diff --git a/python/tidy/servo_tidy_tests/test_tidy.py b/python/tidy/servo_tidy_tests/test_tidy.py index 3761975c62bc..3826e4537b5c 100644 --- a/python/tidy/servo_tidy_tests/test_tidy.py +++ b/python/tidy/servo_tidy_tests/test_tidy.py @@ -151,7 +151,7 @@ def test_rust(self): self.assertNoMoreErrors(ban_errors) ban_errors = tidy.collect_errors_for_files(iterFile('ban-domrefcell.rs'), [], [tidy.check_rust], print_text=False) - self.assertEqual('Banned type DOMRefCell> detected. Use MutDom instead', ban_errors.next()[2]) + self.assertEqual('Banned type DomRefCell> detected. Use MutDom instead', ban_errors.next()[2]) self.assertNoMoreErrors(ban_errors) def test_spec_link(self): From f87c2a8d7616112ca924e30292db2d244cf87eec Mon Sep 17 00:00:00 2001 From: Anthony Ramine Date: Tue, 26 Sep 2017 01:53:40 +0200 Subject: [PATCH 9/9] Rename Root to DomRoot In a later PR, DomRoot will become a type alias of Root>, where Root will be able to handle all the things that need to be rooted that have a stable traceable address that doesn't move for the whole lifetime of the root. Stay tuned. --- components/script/body.rs | 6 +- components/script/devtools.rs | 4 +- components/script/docs/JS-Servos-only-GC.md | 20 +- components/script/dom/attr.rs | 8 +- components/script/dom/beforeunloadevent.rs | 6 +- components/script/dom/bindings/callback.rs | 4 +- .../dom/bindings/codegen/CodegenRust.py | 26 +- .../dom/bindings/codegen/Configuration.py | 2 +- components/script/dom/bindings/conversions.rs | 24 +- components/script/dom/bindings/interface.rs | 10 +- components/script/dom/bindings/iterable.rs | 4 +- components/script/dom/bindings/refcounted.rs | 6 +- components/script/dom/bindings/reflector.rs | 8 +- components/script/dom/bindings/root.rs | 58 ++-- .../script/dom/bindings/settings_stack.rs | 14 +- .../script/dom/bindings/structuredclone.rs | 4 +- components/script/dom/bindings/trace.rs | 14 +- components/script/dom/bindings/weakref.rs | 12 +- components/script/dom/blob.rs | 10 +- components/script/dom/bluetooth.rs | 4 +- .../script/dom/bluetoothadvertisingevent.rs | 10 +- .../dom/bluetoothcharacteristicproperties.rs | 4 +- components/script/dom/bluetoothdevice.rs | 24 +- .../script/dom/bluetoothpermissionresult.rs | 12 +- .../dom/bluetoothremotegattcharacteristic.rs | 12 +- .../dom/bluetoothremotegattdescriptor.rs | 8 +- .../script/dom/bluetoothremotegattserver.rs | 8 +- .../script/dom/bluetoothremotegattservice.rs | 8 +- components/script/dom/canvasgradient.rs | 4 +- components/script/dom/canvaspattern.rs | 4 +- .../script/dom/canvasrenderingcontext2d.rs | 28 +- components/script/dom/characterdata.rs | 18 +- components/script/dom/client.rs | 6 +- components/script/dom/closeevent.rs | 8 +- components/script/dom/comment.rs | 6 +- components/script/dom/compositionevent.rs | 6 +- components/script/dom/create.rs | 22 +- components/script/dom/crypto.rs | 4 +- components/script/dom/cssfontfacerule.rs | 4 +- components/script/dom/cssgroupingrule.rs | 6 +- components/script/dom/cssimportrule.rs | 4 +- components/script/dom/csskeyframerule.rs | 6 +- components/script/dom/csskeyframesrule.rs | 12 +- components/script/dom/cssmediarule.rs | 8 +- components/script/dom/cssnamespacerule.rs | 4 +- components/script/dom/cssrule.rs | 24 +- components/script/dom/cssrulelist.rs | 14 +- components/script/dom/cssstyledeclaration.rs | 8 +- components/script/dom/cssstylerule.rs | 6 +- components/script/dom/cssstylesheet.rs | 8 +- components/script/dom/cssstylevalue.rs | 4 +- components/script/dom/csssupportsrule.rs | 4 +- components/script/dom/cssviewportrule.rs | 4 +- .../script/dom/customelementregistry.rs | 20 +- components/script/dom/customevent.rs | 8 +- .../script/dom/dedicatedworkerglobalscope.rs | 6 +- .../script/dom/dissimilaroriginlocation.rs | 4 +- .../script/dom/dissimilaroriginwindow.rs | 28 +- components/script/dom/document.rs | 252 +++++++++--------- components/script/dom/documentfragment.rs | 22 +- components/script/dom/documenttype.rs | 4 +- components/script/dom/domexception.rs | 4 +- components/script/dom/domimplementation.rs | 16 +- components/script/dom/dommatrix.rs | 56 ++-- components/script/dom/dommatrixreadonly.rs | 36 +-- components/script/dom/domparser.rs | 8 +- components/script/dom/dompoint.rs | 8 +- components/script/dom/dompointreadonly.rs | 6 +- components/script/dom/domquad.rs | 28 +- components/script/dom/domrect.rs | 6 +- components/script/dom/domrectreadonly.rs | 6 +- components/script/dom/domstringmap.rs | 4 +- components/script/dom/domtokenlist.rs | 6 +- components/script/dom/element.rs | 132 ++++----- components/script/dom/errorevent.rs | 8 +- components/script/dom/event.rs | 18 +- components/script/dom/eventsource.rs | 6 +- components/script/dom/eventtarget.rs | 14 +- components/script/dom/extendableevent.rs | 6 +- .../script/dom/extendablemessageevent.rs | 6 +- components/script/dom/file.rs | 8 +- components/script/dom/filelist.rs | 10 +- components/script/dom/filereader.rs | 8 +- components/script/dom/filereadersync.rs | 6 +- components/script/dom/focusevent.rs | 10 +- components/script/dom/forcetouchevent.rs | 4 +- components/script/dom/formdata.rs | 18 +- components/script/dom/gamepad.rs | 12 +- components/script/dom/gamepadbutton.rs | 4 +- components/script/dom/gamepadbuttonlist.rs | 10 +- components/script/dom/gamepadevent.rs | 12 +- components/script/dom/gamepadlist.rs | 12 +- components/script/dom/globalscope.rs | 24 +- components/script/dom/hashchangeevent.rs | 8 +- components/script/dom/headers.rs | 10 +- components/script/dom/history.rs | 4 +- components/script/dom/htmlanchorelement.rs | 6 +- components/script/dom/htmlappletelement.rs | 4 +- components/script/dom/htmlareaelement.rs | 6 +- components/script/dom/htmlaudioelement.rs | 4 +- components/script/dom/htmlbaseelement.rs | 4 +- components/script/dom/htmlbodyelement.rs | 4 +- components/script/dom/htmlbrelement.rs | 4 +- components/script/dom/htmlbuttonelement.rs | 14 +- components/script/dom/htmlcanvaselement.rs | 12 +- components/script/dom/htmlcollection.rs | 46 ++-- components/script/dom/htmldataelement.rs | 4 +- components/script/dom/htmldatalistelement.rs | 6 +- components/script/dom/htmldetailselement.rs | 4 +- components/script/dom/htmldialogelement.rs | 4 +- components/script/dom/htmldirectoryelement.rs | 4 +- components/script/dom/htmldivelement.rs | 4 +- components/script/dom/htmldlistelement.rs | 4 +- components/script/dom/htmlelement.rs | 22 +- components/script/dom/htmlembedelement.rs | 4 +- components/script/dom/htmlfieldsetelement.rs | 12 +- components/script/dom/htmlfontelement.rs | 4 +- .../script/dom/htmlformcontrolscollection.rs | 10 +- components/script/dom/htmlformelement.rs | 44 +-- components/script/dom/htmlframeelement.rs | 4 +- components/script/dom/htmlframesetelement.rs | 4 +- components/script/dom/htmlheadelement.rs | 6 +- components/script/dom/htmlheadingelement.rs | 4 +- components/script/dom/htmlhrelement.rs | 4 +- components/script/dom/htmlhtmlelement.rs | 4 +- components/script/dom/htmliframeelement.rs | 12 +- components/script/dom/htmlimageelement.rs | 16 +- components/script/dom/htmlinputelement.rs | 24 +- components/script/dom/htmllabelelement.rs | 18 +- components/script/dom/htmllegendelement.rs | 8 +- components/script/dom/htmllielement.rs | 4 +- components/script/dom/htmllinkelement.rs | 12 +- components/script/dom/htmlmapelement.rs | 8 +- components/script/dom/htmlmediaelement.rs | 16 +- components/script/dom/htmlmetaelement.rs | 6 +- components/script/dom/htmlmeterelement.rs | 6 +- components/script/dom/htmlmodelement.rs | 4 +- components/script/dom/htmlobjectelement.rs | 10 +- components/script/dom/htmlolistelement.rs | 4 +- components/script/dom/htmloptgroupelement.rs | 6 +- components/script/dom/htmloptionelement.rs | 10 +- .../script/dom/htmloptionscollection.rs | 12 +- components/script/dom/htmloutputelement.rs | 12 +- components/script/dom/htmlparagraphelement.rs | 4 +- components/script/dom/htmlparamelement.rs | 4 +- components/script/dom/htmlpreelement.rs | 4 +- components/script/dom/htmlprogresselement.rs | 6 +- components/script/dom/htmlquoteelement.rs | 4 +- components/script/dom/htmlscriptelement.rs | 4 +- components/script/dom/htmlselectelement.rs | 36 +-- components/script/dom/htmlsourceelement.rs | 4 +- components/script/dom/htmlspanelement.rs | 4 +- components/script/dom/htmlstyleelement.rs | 10 +- .../script/dom/htmltablecaptionelement.rs | 4 +- components/script/dom/htmltablecolelement.rs | 4 +- .../script/dom/htmltabledatacellelement.rs | 4 +- components/script/dom/htmltableelement.rs | 40 +-- .../script/dom/htmltableheadercellelement.rs | 4 +- components/script/dom/htmltablerowelement.rs | 10 +- .../script/dom/htmltablesectionelement.rs | 8 +- components/script/dom/htmltemplateelement.rs | 8 +- components/script/dom/htmltextareaelement.rs | 10 +- components/script/dom/htmltimeelement.rs | 4 +- components/script/dom/htmltitleelement.rs | 4 +- components/script/dom/htmltrackelement.rs | 4 +- components/script/dom/htmlulistelement.rs | 4 +- components/script/dom/htmlunknownelement.rs | 4 +- components/script/dom/htmlvideoelement.rs | 4 +- components/script/dom/imagedata.rs | 10 +- components/script/dom/inputevent.rs | 6 +- components/script/dom/keyboardevent.rs | 8 +- components/script/dom/location.rs | 4 +- components/script/dom/macros.rs | 4 +- components/script/dom/mediaerror.rs | 4 +- components/script/dom/medialist.rs | 4 +- components/script/dom/mediaquerylist.rs | 4 +- components/script/dom/mediaquerylistevent.rs | 8 +- components/script/dom/messageevent.rs | 10 +- components/script/dom/mimetype.rs | 4 +- components/script/dom/mimetypearray.rs | 12 +- components/script/dom/mod.rs | 2 +- components/script/dom/mouseevent.rs | 10 +- components/script/dom/mutationobserver.rs | 20 +- components/script/dom/mutationrecord.rs | 22 +- components/script/dom/namednodemap.rs | 24 +- components/script/dom/navigator.rs | 18 +- components/script/dom/node.rs | 204 +++++++------- components/script/dom/nodeiterator.rs | 16 +- components/script/dom/nodelist.rs | 24 +- components/script/dom/pagetransitionevent.rs | 8 +- .../script/dom/paintrenderingcontext2d.rs | 10 +- components/script/dom/paintsize.rs | 4 +- .../script/dom/paintworkletglobalscope.rs | 6 +- components/script/dom/performance.rs | 30 +-- components/script/dom/performanceentry.rs | 4 +- components/script/dom/performanceobserver.rs | 8 +- .../dom/performanceobserverentrylist.rs | 10 +- .../script/dom/performancepainttiming.rs | 4 +- components/script/dom/performancetiming.rs | 4 +- components/script/dom/permissions.rs | 6 +- components/script/dom/permissionstatus.rs | 4 +- components/script/dom/plugin.rs | 10 +- components/script/dom/pluginarray.rs | 12 +- components/script/dom/popstateevent.rs | 8 +- .../script/dom/processinginstruction.rs | 4 +- components/script/dom/progressevent.rs | 8 +- components/script/dom/promisenativehandler.rs | 4 +- components/script/dom/radionodelist.rs | 10 +- components/script/dom/range.rs | 50 ++-- components/script/dom/request.rs | 18 +- components/script/dom/response.rs | 14 +- components/script/dom/screen.rs | 4 +- components/script/dom/serviceworker.rs | 4 +- .../script/dom/serviceworkercontainer.rs | 6 +- .../script/dom/serviceworkerglobalscope.rs | 6 +- .../script/dom/serviceworkerregistration.rs | 24 +- .../script/dom/servoparser/async_html.rs | 12 +- components/script/dom/servoparser/html.rs | 18 +- components/script/dom/servoparser/mod.rs | 28 +- components/script/dom/servoparser/xml.rs | 4 +- components/script/dom/storage.rs | 4 +- components/script/dom/storageevent.rs | 10 +- .../script/dom/stylepropertymapreadonly.rs | 8 +- components/script/dom/stylesheet.rs | 4 +- components/script/dom/stylesheetlist.rs | 10 +- components/script/dom/svgsvgelement.rs | 4 +- components/script/dom/testbinding.rs | 40 +-- components/script/dom/testbindingiterable.rs | 6 +- .../script/dom/testbindingpairiterable.rs | 6 +- components/script/dom/testrunner.rs | 4 +- components/script/dom/testworklet.rs | 6 +- .../script/dom/testworkletglobalscope.rs | 4 +- components/script/dom/text.rs | 8 +- components/script/dom/textdecoder.rs | 8 +- components/script/dom/textencoder.rs | 6 +- components/script/dom/touch.rs | 6 +- components/script/dom/touchevent.rs | 12 +- components/script/dom/touchlist.rs | 10 +- components/script/dom/transitionevent.rs | 6 +- components/script/dom/treewalker.rs | 48 ++-- components/script/dom/uievent.rs | 10 +- components/script/dom/url.rs | 8 +- components/script/dom/urlsearchparams.rs | 6 +- components/script/dom/validitystate.rs | 4 +- components/script/dom/vr.rs | 24 +- components/script/dom/vrdisplay.rs | 24 +- .../script/dom/vrdisplaycapabilities.rs | 4 +- components/script/dom/vrdisplayevent.rs | 12 +- components/script/dom/vreyeparameters.rs | 8 +- components/script/dom/vrfieldofview.rs | 4 +- components/script/dom/vrframedata.rs | 10 +- components/script/dom/vrpose.rs | 4 +- components/script/dom/vrstageparameters.rs | 4 +- .../ext/oesstandardderivatives.rs | 4 +- .../webgl_extensions/ext/oestexturefloat.rs | 4 +- .../ext/oestexturefloatlinear.rs | 4 +- .../ext/oestexturehalffloat.rs | 4 +- .../ext/oestexturehalffloatlinear.rs | 4 +- .../ext/oesvertexarrayobject.rs | 6 +- .../ext/webglvertexarrayobjectoes.rs | 10 +- .../script/dom/webgl_extensions/extension.rs | 4 +- .../script/dom/webgl_extensions/extensions.rs | 4 +- .../script/dom/webgl_extensions/wrapper.rs | 4 +- .../dom/webgl_validations/tex_image_2d.rs | 6 +- components/script/dom/webglactiveinfo.rs | 4 +- components/script/dom/webglbuffer.rs | 6 +- components/script/dom/webglcontextevent.rs | 8 +- components/script/dom/webglframebuffer.rs | 6 +- components/script/dom/webglprogram.rs | 10 +- components/script/dom/webglrenderbuffer.rs | 6 +- .../script/dom/webglrenderingcontext.rs | 34 +-- components/script/dom/webglshader.rs | 6 +- .../script/dom/webglshaderprecisionformat.rs | 4 +- components/script/dom/webgltexture.rs | 6 +- components/script/dom/webgluniformlocation.rs | 4 +- components/script/dom/websocket.rs | 6 +- components/script/dom/window.rs | 62 ++--- components/script/dom/windowproxy.rs | 12 +- components/script/dom/worker.rs | 6 +- components/script/dom/workerglobalscope.rs | 14 +- components/script/dom/workerlocation.rs | 4 +- components/script/dom/workernavigator.rs | 6 +- components/script/dom/worklet.rs | 8 +- components/script/dom/workletglobalscope.rs | 8 +- components/script/dom/xmldocument.rs | 6 +- components/script/dom/xmlhttprequest.rs | 28 +- components/script/dom/xmlhttprequestupload.rs | 4 +- components/script/fetch.rs | 4 +- components/script/microtask.rs | 4 +- components/script/script_thread.rs | 58 ++-- components/script/webdriver_handlers.rs | 4 +- 291 files changed, 1774 insertions(+), 1770 deletions(-) diff --git a/components/script/body.rs b/components/script/body.rs index b574b1125352..bdeff81e1639 100644 --- a/components/script/body.rs +++ b/components/script/body.rs @@ -5,7 +5,7 @@ use dom::bindings::codegen::Bindings::FormDataBinding::FormDataMethods; use dom::bindings::error::{Error, Fallible}; use dom::bindings::reflector::DomObject; -use dom::bindings::root::Root; +use dom::bindings::root::DomRoot; use dom::bindings::str::USVString; use dom::blob::{Blob, BlobImpl}; use dom::formdata::FormData; @@ -33,8 +33,8 @@ pub enum BodyType { pub enum FetchedData { Text(String), Json(JSValue), - BlobData(Root), - FormData(Root), + BlobData(DomRoot), + FormData(DomRoot), } // https://fetch.spec.whatwg.org/#concept-body-consume-body diff --git a/components/script/devtools.rs b/components/script/devtools.rs index 81c257c902f2..9bcd2376167e 100644 --- a/components/script/devtools.rs +++ b/components/script/devtools.rs @@ -14,7 +14,7 @@ use dom::bindings::codegen::Bindings::WindowBinding::WindowMethods; use dom::bindings::conversions::{ConversionResult, FromJSValConvertible, jsstring_to_str}; use dom::bindings::inheritance::Castable; use dom::bindings::reflector::DomObject; -use dom::bindings::root::Root; +use dom::bindings::root::DomRoot; use dom::bindings::str::DOMString; use dom::document::AnimationFrameCallback; use dom::element::Element; @@ -90,7 +90,7 @@ pub fn handle_get_document_element(documents: &Documents, fn find_node_by_unique_id(documents: &Documents, pipeline: PipelineId, node_id: &str) - -> Option> { + -> Option> { documents.find_document(pipeline).and_then(|document| document.upcast::().traverse_preorder().find(|candidate| candidate.unique_id() == node_id) ) diff --git a/components/script/docs/JS-Servos-only-GC.md b/components/script/docs/JS-Servos-only-GC.md index 0f38e4fadfde..f2502691afdc 100644 --- a/components/script/docs/JS-Servos-only-GC.md +++ b/components/script/docs/JS-Servos-only-GC.md @@ -222,22 +222,22 @@ objects. [gc-root]: https://en.wikipedia.org/wiki/Tracing_garbage_collection#Reachability_of_an_object Another common situation is creating a stack-local root manually. For this -purpose, we have a [`Root`][root] struct. When the `Root` is destroyed, +purpose, we have a [`DomRoot`][root] struct. When the `DomRoot` is destroyed, typically at the end of the function (or block) where it was created, its destructor will un-root the DOM object. This is an example of the [RAII idiom][raii], which Rust inherits from C++. -`Root` structs are primarily returned from [`T::new` functions][new] when +`DomRoot` structs are primarily returned from [`T::new` functions][new] when creating a new DOM object. In some cases, we need to use a DOM object longer than the reference we -received allows us to; the [`Root::from_ref` associated function][from-ref] -allows creating a new `Root` struct in that case. +received allows us to; the [`DomRoot::from_ref` associated function][from-ref] +allows creating a new `DomRoot` struct in that case. -[root]: http://doc.servo.org/script/dom/bindings/root/struct.Root.html +[root]: http://doc.servo.org/script/dom/bindings/root/struct.DomRoot.html [raii]: https://en.wikipedia.org/wiki/Resource_Acquisition_Is_Initialization [new]: http://doc.servo.org/script/dom/index.html#construction -[from-ref]: http://doc.servo.org/script/dom/bindings/root/struct.Root.html#method.from_ref +[from-ref]: http://doc.servo.org/script/dom/bindings/root/struct.DomRoot.html#method.from_ref -We can then obtain a reference from the `Root` through Rust's built-in +We can then obtain a reference from the `DomRoot` through Rust's built-in [`Deref` trait][deref], which exposes a method `deref` with the following signature: @@ -249,11 +249,11 @@ pub fn deref<'a>(&'a self) -> &'a T { What this syntax means is: - **`<'a>`**: 'for any lifetime `'a`', -- **`(&'a self)`**: 'take a reference to a `Root` which is valid over lifetime `'a`', +- **`(&'a self)`**: 'take a reference to a `DomRoot` which is valid over lifetime `'a`', - **`-> &'a T`**: 'return a reference whose lifetime is limited to `'a`'. This allows us to call methods and access fields of the underlying type `T` -through a `Root`. +through a `DomRoot`. [deref]: https://doc.rust-lang.org/std/ops/trait.Deref.html @@ -294,7 +294,7 @@ To recapitulate, the safety of our system depends on two major parts: - The auto-generated `trace` methods ensure that SpiderMonkey's garbage collector can see all of the references between DOM objects. -- The implementation of `Root` guarantees that we can't use a DOM object +- The implementation of `DomRoot` guarantees that we can't use a DOM object from Rust without telling SpiderMonkey about our temporary reference. But there's a hole in this scheme. We could copy an unrooted pointer — a diff --git a/components/script/dom/attr.rs b/components/script/dom/attr.rs index 36b0c4c8c269..10e0ee6bb5c7 100644 --- a/components/script/dom/attr.rs +++ b/components/script/dom/attr.rs @@ -7,7 +7,7 @@ use dom::bindings::cell::DomRefCell; use dom::bindings::codegen::Bindings::AttrBinding::{self, AttrMethods}; use dom::bindings::inheritance::Castable; use dom::bindings::reflector::{Reflector, reflect_dom_object}; -use dom::bindings::root::{LayoutDom, MutNullableDom, Root, RootedReference}; +use dom::bindings::root::{DomRoot, LayoutDom, MutNullableDom, RootedReference}; use dom::bindings::str::DOMString; use dom::customelementregistry::CallbackReaction; use dom::element::{AttributeMutation, Element}; @@ -63,7 +63,7 @@ impl Attr { namespace: Namespace, prefix: Option, owner: Option<&Element>) - -> Root { + -> DomRoot { reflect_dom_object(box Attr::new_inherited(local_name, value, name, @@ -161,7 +161,7 @@ impl AttrMethods for Attr { } // https://dom.spec.whatwg.org/#dom-attr-ownerelement - fn GetOwnerElement(&self) -> Option> { + fn GetOwnerElement(&self) -> Option> { self.owner() } @@ -232,7 +232,7 @@ impl Attr { self.owner.set(owner); } - pub fn owner(&self) -> Option> { + pub fn owner(&self) -> Option> { self.owner.get() } diff --git a/components/script/dom/beforeunloadevent.rs b/components/script/dom/beforeunloadevent.rs index 0f5f476ab598..ad1f3ee2a21a 100644 --- a/components/script/dom/beforeunloadevent.rs +++ b/components/script/dom/beforeunloadevent.rs @@ -10,7 +10,7 @@ use dom::bindings::codegen::Bindings::BeforeUnloadEventBinding::BeforeUnloadEven use dom::bindings::codegen::Bindings::EventBinding::EventMethods; use dom::bindings::inheritance::Castable; use dom::bindings::reflector::reflect_dom_object; -use dom::bindings::root::Root; +use dom::bindings::root::DomRoot; use dom::bindings::str::DOMString; use dom::event::{Event, EventBubbles, EventCancelable}; use dom::window::Window; @@ -32,7 +32,7 @@ impl BeforeUnloadEvent { } } - pub fn new_uninitialized(window: &Window) -> Root { + pub fn new_uninitialized(window: &Window) -> DomRoot { reflect_dom_object(box BeforeUnloadEvent::new_inherited(), window, BeforeUnloadEventBinding::Wrap) @@ -41,7 +41,7 @@ impl BeforeUnloadEvent { pub fn new(window: &Window, type_: Atom, bubbles: EventBubbles, - cancelable: EventCancelable) -> Root { + cancelable: EventCancelable) -> DomRoot { let ev = BeforeUnloadEvent::new_uninitialized(window); { let event = ev.upcast::(); diff --git a/components/script/dom/bindings/callback.rs b/components/script/dom/bindings/callback.rs index 15458499782b..7a73ce602154 100644 --- a/components/script/dom/bindings/callback.rs +++ b/components/script/dom/bindings/callback.rs @@ -6,7 +6,7 @@ use dom::bindings::error::{Error, Fallible, report_pending_exception}; use dom::bindings::reflector::DomObject; -use dom::bindings::root::{Dom, Root}; +use dom::bindings::root::{Dom, DomRoot}; use dom::bindings::settings_stack::{AutoEntryScript, AutoIncumbentScript}; use dom::bindings::utils::AsCCharPtrPtr; use dom::globalscope::GlobalScope; @@ -223,7 +223,7 @@ pub fn wrap_call_this_object(cx: *mut JSContext, pub struct CallSetup { /// The global for reporting exceptions. This is the global object of the /// (possibly wrapped) callback object. - exception_global: Root, + exception_global: DomRoot, /// The `JSContext` used for the call. cx: *mut JSContext, /// The compartment we were in before the call. diff --git a/components/script/dom/bindings/codegen/CodegenRust.py b/components/script/dom/bindings/codegen/CodegenRust.py index 888a17a3a8cc..8880707f7d5f 100644 --- a/components/script/dom/bindings/codegen/CodegenRust.py +++ b/components/script/dom/bindings/codegen/CodegenRust.py @@ -2254,7 +2254,7 @@ def UnionTypes(descriptors, dictionaries, callbacks, typedefs, config): 'dom::bindings::conversions::root_from_handlevalue', 'dom::bindings::error::throw_not_in_union', 'dom::bindings::mozmap::MozMap', - 'dom::bindings::root::Root', + 'dom::bindings::root::DomRoot', 'dom::bindings::str::ByteString', 'dom::bindings::str::DOMString', 'dom::bindings::str::USVString', @@ -2558,7 +2558,7 @@ def __init__(self, descriptor): args = [Argument('*mut JSContext', 'cx'), Argument('&GlobalScope', 'scope'), Argument("Box<%s>" % descriptor.concreteType, 'object')] - retval = 'Root<%s>' % descriptor.concreteType + retval = 'DomRoot<%s>' % descriptor.concreteType CGAbstractMethod.__init__(self, descriptor, 'Wrap', retval, args, pub=True, unsafe=True) @@ -2580,7 +2580,7 @@ def definition_body(self): %(copyUnforgeable)s (*raw).init_reflector(obj.get()); -Root::from_ref(&*raw)""" % {'copyUnforgeable': unforgeable, 'createObject': create}) +DomRoot::from_ref(&*raw)""" % {'copyUnforgeable': unforgeable, 'createObject': create}) class CGWrapGlobalMethod(CGAbstractMethod): @@ -2592,7 +2592,7 @@ def __init__(self, descriptor, properties): assert descriptor.isGlobal() args = [Argument('*mut JSContext', 'cx'), Argument("Box<%s>" % descriptor.concreteType, 'object')] - retval = 'Root<%s>' % descriptor.concreteType + retval = 'DomRoot<%s>' % descriptor.concreteType CGAbstractMethod.__init__(self, descriptor, 'Wrap', retval, args, pub=True, unsafe=True) self.properties = properties @@ -2638,7 +2638,7 @@ def definition_body(self): %(unforgeable)s -Root::from_ref(&*raw)\ +DomRoot::from_ref(&*raw)\ """ % values) @@ -3421,7 +3421,9 @@ def __init__(self, descriptor, name): def definition_body(self): preamble = "let global = GlobalScope::from_object(JS_CALLEE(cx, vp).to_object());\n" if len(self.exposureSet) == 1: - preamble += "let global = Root::downcast::(global).unwrap();\n" % list(self.exposureSet)[0] + preamble += """ +let global = DomRoot::downcast::(global).unwrap(); +""" % list(self.exposureSet)[0] return CGList([CGGeneric(preamble), self.generate_code()]) def generate_code(self): @@ -5352,7 +5354,9 @@ def __init__(self, descriptor, constructor=None): def definition_body(self): preamble = """let global = GlobalScope::from_object(JS_CALLEE(cx, vp).to_object());\n""" if len(self.exposureSet) == 1: - preamble += "let global = Root::downcast::(global).unwrap();\n" % list(self.exposureSet)[0] + preamble += """\ +let global = DomRoot::downcast::(global).unwrap(); +""" % list(self.exposureSet)[0] preamble += """let args = CallArgs::from_vp(vp, argc);\n""" preamble = CGGeneric(preamble) if self.constructor.isHTMLConstructor(): @@ -5408,7 +5412,7 @@ def definition_body(self): return false; } -let result: Result, Error> = html_constructor(&global, &args); +let result: Result, Error> = html_constructor(&global, &args); let result = match result { Ok(result) => result, Err(e) => { @@ -5713,8 +5717,8 @@ def generate_imports(config, cgthings, descriptors, callbacks=None, dictionaries 'dom::bindings::reflector::MutDomObject', 'dom::bindings::reflector::DomObject', 'dom::bindings::root::Dom', + 'dom::bindings::root::DomRoot', 'dom::bindings::root::OptionalHeapSetter', - 'dom::bindings::root::Root', 'dom::bindings::root::RootedReference', 'dom::bindings::utils::AsVoidPtr', 'dom::bindings::utils::DOMClass', @@ -6281,7 +6285,7 @@ def define(self): class CGBindingRoot(CGThing): """ - Root codegen class for binding generation. Instantiate the class, and call + DomRoot codegen class for binding generation. Instantiate the class, and call declare or define to generate header or cpp code (respectively). """ def __init__(self, config, prefix, webIDLFile): @@ -7195,7 +7199,7 @@ def InheritTypes(config): imports = [CGGeneric("use dom::types::*;\n"), CGGeneric("use dom::bindings::conversions::{DerivedFrom, get_dom_class};\n"), CGGeneric("use dom::bindings::inheritance::Castable;\n"), - CGGeneric("use dom::bindings::root::{Dom, LayoutDom, Root};\n"), + CGGeneric("use dom::bindings::root::{Dom, DomRoot, LayoutDom};\n"), CGGeneric("use dom::bindings::trace::JSTraceable;\n"), CGGeneric("use dom::bindings::reflector::DomObject;\n"), CGGeneric("use js::jsapi::JSTracer;\n\n"), diff --git a/components/script/dom/bindings/codegen/Configuration.py b/components/script/dom/bindings/codegen/Configuration.py index df6c0a36c76a..56141e52b09c 100644 --- a/components/script/dom/bindings/codegen/Configuration.py +++ b/components/script/dom/bindings/codegen/Configuration.py @@ -212,7 +212,7 @@ def __init__(self, config, interface, desc): self.argumentType = "???" self.nativeType = ty else: - self.returnType = "Root<%s>" % typeName + self.returnType = "DomRoot<%s>" % typeName self.argumentType = "&%s" % typeName self.nativeType = "*const %s" % typeName if self.interface.isIteratorInterface(): diff --git a/components/script/dom/bindings/conversions.rs b/components/script/dom/bindings/conversions.rs index 7528830ea7c6..075f681308e2 100644 --- a/components/script/dom/bindings/conversions.rs +++ b/components/script/dom/bindings/conversions.rs @@ -24,7 +24,7 @@ //! | USVString | `USVString` | //! | ByteString | `ByteString` | //! | object | `*mut JSObject` | -//! | interface types | `&T` | `Root` | +//! | interface types | `&T` | `DomRoot` | //! | dictionary types | `&T` | *unsupported* | //! | enumeration types | `T` | //! | callback function types | `Rc` | @@ -36,7 +36,7 @@ use dom::bindings::error::{Error, Fallible}; use dom::bindings::inheritance::Castable; use dom::bindings::num::Finite; use dom::bindings::reflector::{DomObject, Reflector}; -use dom::bindings::root::Root; +use dom::bindings::root::DomRoot; use dom::bindings::str::{ByteString, DOMString, USVString}; use dom::bindings::trace::{JSTraceable, RootedTraceableBox}; use dom::bindings::utils::DOMClass; @@ -102,13 +102,13 @@ impl> FromJSValConvertible for Finite } } -impl FromJSValConvertible for Root { +impl FromJSValConvertible for DomRoot { type Config = (); unsafe fn from_jsval(_cx: *mut JSContext, value: HandleValue, _config: Self::Config) - -> Result>, ()> { + -> Result>, ()> { Ok(match root_from_handlevalue(value) { Ok(result) => ConversionResult::Success(result), Err(()) => ConversionResult::Failure("value is not an object".into()), @@ -405,16 +405,16 @@ pub fn native_from_object(obj: *mut JSObject) -> Result<*const T, ()> } } -/// Get a `Root` for the given DOM object, unwrapping any wrapper +/// Get a `DomRoot` for the given DOM object, unwrapping any wrapper /// around it first, and checking if the object is of the correct type. /// /// Returns Err(()) if `obj` is an opaque security wrapper or if the object is /// not a reflector for a DOM object of the given type (as defined by the /// proto_id and proto_depth). -pub fn root_from_object(obj: *mut JSObject) -> Result, ()> +pub fn root_from_object(obj: *mut JSObject) -> Result, ()> where T: DomObject + IDLInterface { - native_from_object(obj).map(|ptr| unsafe { Root::from_ref(&*ptr) }) + native_from_object(obj).map(|ptr| unsafe { DomRoot::from_ref(&*ptr) }) } /// Get a `*const T` for a DOM object accessible from a `HandleValue`. @@ -428,9 +428,9 @@ pub fn native_from_handlevalue(v: HandleValue) -> Result<*const T, ()> native_from_object(v.get().to_object()) } -/// Get a `Root` for a DOM object accessible from a `HandleValue`. +/// Get a `DomRoot` for a DOM object accessible from a `HandleValue`. /// Caller is responsible for throwing a JS exception if needed in case of error. -pub fn root_from_handlevalue(v: HandleValue) -> Result, ()> +pub fn root_from_handlevalue(v: HandleValue) -> Result, ()> where T: DomObject + IDLInterface { if !v.get().is_object() { @@ -439,14 +439,14 @@ pub fn root_from_handlevalue(v: HandleValue) -> Result, ()> root_from_object(v.get().to_object()) } -/// Get a `Root` for a DOM object accessible from a `HandleObject`. -pub fn root_from_handleobject(obj: HandleObject) -> Result, ()> +/// Get a `DomRoot` for a DOM object accessible from a `HandleObject`. +pub fn root_from_handleobject(obj: HandleObject) -> Result, ()> where T: DomObject + IDLInterface { root_from_object(obj.get()) } -impl ToJSValConvertible for Root { +impl ToJSValConvertible for DomRoot { unsafe fn to_jsval(&self, cx: *mut JSContext, rval: MutableHandleValue) { self.reflector().to_jsval(cx, rval); } diff --git a/components/script/dom/bindings/interface.rs b/components/script/dom/bindings/interface.rs index 5e04e80ad731..5604d33aa290 100644 --- a/components/script/dom/bindings/interface.rs +++ b/components/script/dom/bindings/interface.rs @@ -77,7 +77,7 @@ use dom::bindings::constant::{ConstantSpec, define_constants}; use dom::bindings::conversions::{DOM_OBJECT_SLOT, DerivedFrom, get_dom_class}; use dom::bindings::error::{Error, Fallible}; use dom::bindings::guard::Guard; -use dom::bindings::root::Root; +use dom::bindings::root::DomRoot; use dom::bindings::utils::{DOM_PROTOTYPE_SLOT, ProtoOrIfaceArray, get_proto_or_iface_array}; use dom::create::create_native_html_element; use dom::customelementregistry::ConstructionStackEntry; @@ -236,7 +236,7 @@ pub unsafe fn create_global_object( } // https://html.spec.whatwg.org/multipage/#htmlconstructor -pub unsafe fn html_constructor(window: &Window, call_args: &CallArgs) -> Fallible> +pub unsafe fn html_constructor(window: &Window, call_args: &CallArgs) -> Fallible> where T: DerivedFrom { let document = window.Document(); @@ -289,7 +289,7 @@ pub unsafe fn html_constructor(window: &Window, call_args: &CallArgs) -> Fall // Step 8.1 let name = QualName::new(None, ns!(html), definition.local_name.clone()); let element = if definition.is_autonomous() { - Root::upcast(HTMLElement::new(name.local, None, &*document)) + DomRoot::upcast(HTMLElement::new(name.local, None, &*document)) } else { create_native_html_element(name, None, &*document, ElementCreator::ScriptCreated) }; @@ -303,7 +303,7 @@ pub unsafe fn html_constructor(window: &Window, call_args: &CallArgs) -> Fall element.set_custom_element_definition(definition.clone()); // Step 8.5 - Root::downcast(element).ok_or(Error::InvalidState) + DomRoot::downcast(element).ok_or(Error::InvalidState) }, // Step 9 Some(ConstructionStackEntry::Element(element)) => { @@ -315,7 +315,7 @@ pub unsafe fn html_constructor(window: &Window, call_args: &CallArgs) -> Fall construction_stack.push(ConstructionStackEntry::AlreadyConstructedMarker); // Step 13 - Root::downcast(element).ok_or(Error::InvalidState) + DomRoot::downcast(element).ok_or(Error::InvalidState) }, // Step 10 Some(ConstructionStackEntry::AlreadyConstructedMarker) => Err(Error::InvalidState), diff --git a/components/script/dom/bindings/iterable.rs b/components/script/dom/bindings/iterable.rs index a7bf937b5b75..fbb9894210ea 100644 --- a/components/script/dom/bindings/iterable.rs +++ b/components/script/dom/bindings/iterable.rs @@ -11,7 +11,7 @@ use dom::bindings::codegen::Bindings::IterableIteratorBinding::IterableKeyAndVal use dom::bindings::codegen::Bindings::IterableIteratorBinding::IterableKeyOrValueResult; use dom::bindings::error::Fallible; use dom::bindings::reflector::{DomObject, Reflector, reflect_dom_object}; -use dom::bindings::root::{Dom, Root}; +use dom::bindings::root::{Dom, DomRoot}; use dom::bindings::trace::JSTraceable; use dom::globalscope::GlobalScope; use dom_struct::dom_struct; @@ -61,7 +61,7 @@ impl IterableIterator { pub fn new(iterable: &T, type_: IteratorType, wrap: unsafe fn(*mut JSContext, &GlobalScope, Box>) - -> Root) -> Root { + -> DomRoot) -> DomRoot { let iterator = box IterableIterator { reflector: Reflector::new(), type_: type_, diff --git a/components/script/dom/bindings/refcounted.rs b/components/script/dom/bindings/refcounted.rs index d2c1a484887d..02f6784fb2f8 100644 --- a/components/script/dom/bindings/refcounted.rs +++ b/components/script/dom/bindings/refcounted.rs @@ -26,7 +26,7 @@ use core::nonzero::NonZero; use dom::bindings::conversions::ToJSValConvertible; use dom::bindings::error::Error; use dom::bindings::reflector::{DomObject, Reflector}; -use dom::bindings::root::Root; +use dom::bindings::root::DomRoot; use dom::bindings::trace::trace_reflector; use dom::promise::Promise; use js::jsapi::JSTracer; @@ -178,14 +178,14 @@ impl Trusted { /// Obtain a usable DOM pointer from a pinned `Trusted` value. Fails if used on /// a different thread than the original value from which this `Trusted` was /// obtained. - pub fn root(&self) -> Root { + pub fn root(&self) -> DomRoot { assert!(LIVE_REFERENCES.with(|ref r| { let r = r.borrow(); let live_references = r.as_ref().unwrap(); self.owner_thread == (&*live_references) as *const _ as *const libc::c_void })); unsafe { - Root::new(NonZero::new_unchecked(self.refcount.0 as *const T)) + DomRoot::new(NonZero::new_unchecked(self.refcount.0 as *const T)) } } } diff --git a/components/script/dom/bindings/reflector.rs b/components/script/dom/bindings/reflector.rs index 356086ac1462..de6c8ab7c815 100644 --- a/components/script/dom/bindings/reflector.rs +++ b/components/script/dom/bindings/reflector.rs @@ -5,7 +5,7 @@ //! The `Reflector` struct. use dom::bindings::conversions::DerivedFrom; -use dom::bindings::root::Root; +use dom::bindings::root::DomRoot; use dom::globalscope::GlobalScope; use js::jsapi::{HandleObject, JSContext, JSObject, Heap}; use std::default::Default; @@ -15,8 +15,8 @@ use std::default::Default; pub fn reflect_dom_object( obj: Box, global: &U, - wrap_fn: unsafe fn(*mut JSContext, &GlobalScope, Box) -> Root) - -> Root + wrap_fn: unsafe fn(*mut JSContext, &GlobalScope, Box) -> DomRoot) + -> DomRoot where T: DomObject, U: DerivedFrom { let global_scope = global.upcast(); @@ -77,7 +77,7 @@ pub trait DomObject { fn reflector(&self) -> &Reflector; /// Returns the global scope of the realm that the DomObject was created in. - fn global(&self) -> Root where Self: Sized { + fn global(&self) -> DomRoot where Self: Sized { GlobalScope::from_reflector(self) } } diff --git a/components/script/dom/bindings/root.rs b/components/script/dom/bindings/root.rs index 417d4b9de52b..1a81965fef97 100644 --- a/components/script/dom/bindings/root.rs +++ b/components/script/dom/bindings/root.rs @@ -11,16 +11,16 @@ //! //! Here is a brief overview of the important types: //! -//! - `Root`: a stack-based reference to a rooted DOM object. +//! - `DomRoot`: a stack-based reference to a rooted DOM object. //! - `Dom`: a reference to a DOM object that can automatically be traced by //! the GC when encountered as a field of a Rust structure. //! //! `Dom` does not allow access to their inner value without explicitly -//! creating a stack-based root via the `root` method. This returns a `Root`, +//! creating a stack-based root via the `root` method. This returns a `DomRoot`, //! which causes the JS-owned value to be uncollectable for the duration of the //! `Root` object's lifetime. A reference to the object can then be obtained //! from the `Root` object. These references are not allowed to outlive their -//! originating `Root`. +//! originating `DomRoot`. //! use core::nonzero::NonZero; @@ -259,10 +259,10 @@ impl MutDom { } /// Get the value in this `MutDom`. - pub fn get(&self) -> Root { + pub fn get(&self) -> DomRoot { debug_assert!(thread_state::get().is_script()); unsafe { - Root::from_ref(&*ptr::read(self.val.get())) + DomRoot::from_ref(&*ptr::read(self.val.get())) } } } @@ -313,8 +313,8 @@ impl MutNullableDom { /// Retrieve a copy of the current inner value. If it is `None`, it is /// initialized with the result of `cb` first. - pub fn or_init(&self, cb: F) -> Root - where F: FnOnce() -> Root + pub fn or_init(&self, cb: F) -> DomRoot + where F: FnOnce() -> DomRoot { debug_assert!(thread_state::get().is_script()); match self.get() { @@ -337,10 +337,10 @@ impl MutNullableDom { /// Get a rooted value out of this object #[allow(unrooted_must_root)] - pub fn get(&self) -> Option> { + pub fn get(&self) -> Option> { debug_assert!(thread_state::get().is_script()); unsafe { - ptr::read(self.ptr.get()).map(|o| Root::from_ref(&*o)) + ptr::read(self.ptr.get()).map(|o| DomRoot::from_ref(&*o)) } } @@ -353,7 +353,7 @@ impl MutNullableDom { } /// Gets the current value out of this object and sets it to `None`. - pub fn take(&self) -> Option> { + pub fn take(&self) -> Option> { let value = self.get(); self.set(None); value @@ -409,7 +409,7 @@ impl DomOnceCell { /// initialized with the result of `cb` first. #[allow(unrooted_must_root)] pub fn init_once(&self, cb: F) -> &T - where F: FnOnce() -> Root + where F: FnOnce() -> DomRoot { debug_assert!(thread_state::get().is_script()); &self.ptr.init_once(|| Dom::from_ref(&cb())) @@ -559,16 +559,16 @@ pub unsafe fn trace_roots(tracer: *mut JSTracer) { /// for the same JS value. `Root`s cannot outlive the associated /// `RootCollection` object. #[allow_unrooted_interior] -pub struct Root { +pub struct DomRoot { /// Reference to rooted value that must not outlive this container ptr: NonZero<*const T>, /// List that ensures correct dynamic root ordering root_list: *const RootCollection, } -impl Root { +impl DomRoot { /// Cast a DOM object root upwards to one of the interfaces it derives from. - pub fn upcast(root: Root) -> Root + pub fn upcast(root: DomRoot) -> DomRoot where U: Castable, T: DerivedFrom { @@ -576,7 +576,7 @@ impl Root { } /// Cast a DOM object root downwards to one of the interfaces it might implement. - pub fn downcast(root: Root) -> Option> + pub fn downcast(root: DomRoot) -> Option> where U: DerivedFrom { if root.is::() { @@ -587,16 +587,16 @@ impl Root { } } -impl Root { +impl DomRoot { /// Create a new stack-bounded root for the provided JS-owned value. /// It cannot outlive its associated `RootCollection`, and it gives /// out references which cannot outlive this new `Root`. - pub fn new(unrooted: NonZero<*const T>) -> Root { + pub fn new(unrooted: NonZero<*const T>) -> DomRoot { debug_assert!(thread_state::get().is_script()); STACK_ROOTS.with(|ref collection| { let RootCollectionPtr(collection) = collection.get().unwrap(); unsafe { (*collection).root(&*(*unrooted.get()).reflector()) } - Root { + DomRoot { ptr: unrooted, root_list: collection, } @@ -604,19 +604,19 @@ impl Root { } /// Generate a new root from a reference - pub fn from_ref(unrooted: &T) -> Root { - Root::new(unsafe { NonZero::new_unchecked(unrooted) }) + pub fn from_ref(unrooted: &T) -> DomRoot { + DomRoot::new(unsafe { NonZero::new_unchecked(unrooted) }) } } -impl<'root, T: DomObject + 'root> RootedReference<'root> for Root { +impl<'root, T: DomObject + 'root> RootedReference<'root> for DomRoot { type Ref = &'root T; fn r(&'root self) -> &'root T { self } } -impl Deref for Root { +impl Deref for DomRoot { type Target = T; fn deref(&self) -> &T { debug_assert!(thread_state::get().is_script()); @@ -624,25 +624,25 @@ impl Deref for Root { } } -impl HeapSizeOf for Root { +impl HeapSizeOf for DomRoot { fn heap_size_of_children(&self) -> usize { (**self).heap_size_of_children() } } -impl PartialEq for Root { +impl PartialEq for DomRoot { fn eq(&self, other: &Self) -> bool { self.ptr == other.ptr } } -impl Clone for Root { - fn clone(&self) -> Root { - Root::from_ref(&*self) +impl Clone for DomRoot { + fn clone(&self) -> DomRoot { + DomRoot::from_ref(&*self) } } -impl Drop for Root { +impl Drop for DomRoot { fn drop(&mut self) { unsafe { (*self.root_list).unroot(self.reflector()); @@ -650,7 +650,7 @@ impl Drop for Root { } } -unsafe impl JSTraceable for Root { +unsafe impl JSTraceable for DomRoot { unsafe fn trace(&self, _: *mut JSTracer) { // Already traced. } diff --git a/components/script/dom/bindings/settings_stack.rs b/components/script/dom/bindings/settings_stack.rs index 0d747cca2051..fb708d1b2356 100644 --- a/components/script/dom/bindings/settings_stack.rs +++ b/components/script/dom/bindings/settings_stack.rs @@ -2,7 +2,7 @@ * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ -use dom::bindings::root::{Dom, Root}; +use dom::bindings::root::{Dom, DomRoot}; use dom::bindings::trace::JSTraceable; use dom::globalscope::GlobalScope; use js::jsapi::GetScriptedCallerGlobal; @@ -37,7 +37,7 @@ pub unsafe fn trace(tracer: *mut JSTracer) { /// RAII struct that pushes and pops entries from the script settings stack. pub struct AutoEntryScript { - global: Root, + global: DomRoot, } impl AutoEntryScript { @@ -51,7 +51,7 @@ impl AutoEntryScript { kind: StackEntryKind::Entry, }); AutoEntryScript { - global: Root::from_ref(global), + global: DomRoot::from_ref(global), } }) } @@ -80,13 +80,13 @@ impl Drop for AutoEntryScript { /// Returns the ["entry"] global object. /// /// ["entry"]: https://html.spec.whatwg.org/multipage/#entry -pub fn entry_global() -> Root { +pub fn entry_global() -> DomRoot { STACK.with(|stack| { stack.borrow() .iter() .rev() .find(|entry| entry.kind == StackEntryKind::Entry) - .map(|entry| Root::from_ref(&*entry.global)) + .map(|entry| DomRoot::from_ref(&*entry.global)) }).unwrap() } @@ -145,7 +145,7 @@ impl Drop for AutoIncumbentScript { /// Returns the ["incumbent"] global object. /// /// ["incumbent"]: https://html.spec.whatwg.org/multipage/#incumbent -pub fn incumbent_global() -> Option> { +pub fn incumbent_global() -> Option> { // https://html.spec.whatwg.org/multipage/#incumbent-settings-object // Step 1, 3: See what the JS engine has to say. If we've got a scripted @@ -165,6 +165,6 @@ pub fn incumbent_global() -> Option> { STACK.with(|stack| { stack.borrow() .last() - .map(|entry| Root::from_ref(&*entry.global)) + .map(|entry| DomRoot::from_ref(&*entry.global)) }) } diff --git a/components/script/dom/bindings/structuredclone.rs b/components/script/dom/bindings/structuredclone.rs index e23d478e5a82..bdc5348782f4 100644 --- a/components/script/dom/bindings/structuredclone.rs +++ b/components/script/dom/bindings/structuredclone.rs @@ -8,7 +8,7 @@ use dom::bindings::conversions::root_from_handleobject; use dom::bindings::error::{Error, Fallible}; use dom::bindings::reflector::DomObject; -use dom::bindings::root::Root; +use dom::bindings::root::DomRoot; use dom::blob::{Blob, BlobImpl}; use dom::globalscope::GlobalScope; use js::jsapi::{Handle, HandleObject, HandleValue, MutableHandleValue, JSAutoCompartment, JSContext}; @@ -110,7 +110,7 @@ unsafe fn read_blob(cx: *mut JSContext, return blob.reflector().get_jsobject().get() } -unsafe fn write_blob(blob: Root, +unsafe fn write_blob(blob: DomRoot, w: *mut JSStructuredCloneWriter) -> Result<(), ()> { let structured_writer = StructuredCloneWriter { w: w }; diff --git a/components/script/dom/bindings/trace.rs b/components/script/dom/bindings/trace.rs index 56b48b5750ca..c367df5ee560 100644 --- a/components/script/dom/bindings/trace.rs +++ b/components/script/dom/bindings/trace.rs @@ -42,7 +42,7 @@ use dom::bindings::cell::DomRefCell; use dom::bindings::error::Error; use dom::bindings::refcounted::{Trusted, TrustedPromise}; use dom::bindings::reflector::{DomObject, Reflector}; -use dom::bindings::root::{Dom, Root}; +use dom::bindings::root::{Dom, DomRoot}; use dom::bindings::str::{DOMString, USVString}; use dom::bindings::utils::WindowProxyHandler; use dom::document::PendingRestyle; @@ -710,7 +710,7 @@ impl RootedTraceableSet { /// Roots any JSTraceable thing /// -/// If you have a valid DomObject, use Root. +/// If you have a valid DomObject, use DomRoot. /// If you have GC things like *mut JSObject or JSVal, use rooted!. /// If you have an arbitrary number of DomObjects to root, use rooted_vec!. /// If you know what you're doing, use this. @@ -720,7 +720,7 @@ pub struct RootedTraceable<'a, T: 'static + JSTraceable> { } impl<'a, T: JSTraceable + 'static> RootedTraceable<'a, T> { - /// Root a JSTraceable thing for the life of this RootedTraceable + /// DomRoot a JSTraceable thing for the life of this RootedTraceable pub fn new(traceable: &'a T) -> RootedTraceable<'a, T> { unsafe { RootedTraceableSet::add(traceable); @@ -741,7 +741,7 @@ impl<'a, T: JSTraceable + 'static> Drop for RootedTraceable<'a, T> { /// Roots any JSTraceable thing /// -/// If you have a valid DomObject, use Root. +/// If you have a valid DomObject, use DomRoot. /// If you have GC things like *mut JSObject or JSVal, use rooted!. /// If you have an arbitrary number of DomObjects to root, use rooted_vec!. /// If you know what you're doing, use this. @@ -757,7 +757,7 @@ unsafe impl JSTraceable for RootedTraceableBox { } impl RootedTraceableBox { - /// Root a JSTraceable thing for the life of this RootedTraceable + /// DomRoot a JSTraceable thing for the life of this RootedTraceable pub fn new(traceable: T) -> RootedTraceableBox { let traceable = Box::into_raw(box traceable); unsafe { @@ -804,7 +804,7 @@ impl Drop for RootedTraceableBox { /// A vector of items to be rooted with `RootedVec`. /// Guaranteed to be empty when not rooted. /// Usage: `rooted_vec!(let mut v);` or if you have an -/// iterator of `Root`s, `rooted_vec!(let v <- iterator);`. +/// iterator of `DomRoot`s, `rooted_vec!(let v <- iterator);`. #[allow(unrooted_must_root)] #[derive(JSTraceable)] #[allow_unrooted_interior] @@ -844,7 +844,7 @@ impl<'a, T: 'static + JSTraceable + DomObject> RootedVec<'a, Dom> { /// Create a vector of items of type Dom that is rooted for /// the lifetime of this struct pub fn from_iter(root: &'a mut RootableVec>, iter: I) -> Self - where I: Iterator> + where I: Iterator> { unsafe { RootedTraceableSet::add(root); diff --git a/components/script/dom/bindings/weakref.rs b/components/script/dom/bindings/weakref.rs index 61a50a240b1e..6ece47cea3bf 100644 --- a/components/script/dom/bindings/weakref.rs +++ b/components/script/dom/bindings/weakref.rs @@ -13,7 +13,7 @@ use core::nonzero::NonZero; use dom::bindings::reflector::DomObject; -use dom::bindings::root::Root; +use dom::bindings::root::DomRoot; use dom::bindings::trace::JSTraceable; use heapsize::HeapSizeOf; use js::jsapi::{JSTracer, JS_GetReservedSlot, JS_SetReservedSlot}; @@ -84,9 +84,9 @@ impl WeakRef { value.downgrade() } - /// Root a weak reference. Returns `None` if the object was already collected. - pub fn root(&self) -> Option> { - unsafe { &*self.ptr.get() }.value.get().map(Root::new) + /// DomRoot a weak reference. Returns `None` if the object was already collected. + pub fn root(&self) -> Option> { + unsafe { &*self.ptr.get() }.value.get().map(DomRoot::new) } /// Return whether the weakly-referenced object is still alive. @@ -179,9 +179,9 @@ impl MutableWeakRef { } } - /// Root a mutable weak reference. Returns `None` if the object + /// DomRoot a mutable weak reference. Returns `None` if the object /// was already collected. - pub fn root(&self) -> Option> { + pub fn root(&self) -> Option> { unsafe { &*self.cell.get() }.as_ref().and_then(WeakRef::root) } } diff --git a/components/script/dom/blob.rs b/components/script/dom/blob.rs index 7317f9f8d56b..66dcc5b475cc 100644 --- a/components/script/dom/blob.rs +++ b/components/script/dom/blob.rs @@ -8,7 +8,7 @@ use dom::bindings::codegen::Bindings::BlobBinding::BlobMethods; use dom::bindings::codegen::UnionTypes::BlobOrString; use dom::bindings::error::{Error, Fallible}; use dom::bindings::reflector::{DomObject, Reflector, reflect_dom_object}; -use dom::bindings::root::{Dom, Root}; +use dom::bindings::root::{Dom, DomRoot}; use dom::bindings::str::DOMString; use dom::globalscope::GlobalScope; use dom_struct::dom_struct; @@ -79,7 +79,7 @@ impl Blob { #[allow(unrooted_must_root)] pub fn new( global: &GlobalScope, blob_impl: BlobImpl, typeString: String) - -> Root { + -> DomRoot { let boxed_blob = box Blob::new_inherited(blob_impl, typeString); reflect_dom_object(boxed_blob, global, BlobBinding::Wrap) } @@ -97,7 +97,7 @@ impl Blob { #[allow(unrooted_must_root)] fn new_sliced(parent: &Blob, rel_pos: RelativePos, - relative_content_type: DOMString) -> Root { + relative_content_type: DOMString) -> DomRoot { let blob_impl = match *parent.blob_impl.borrow() { BlobImpl::File(_) => { // Create new parent node @@ -120,7 +120,7 @@ impl Blob { pub fn Constructor(global: &GlobalScope, blobParts: Option>, blobPropertyBag: &BlobBinding::BlobPropertyBag) - -> Fallible> { + -> Fallible> { // TODO: accept other blobParts types - ArrayBuffer or ArrayBufferView let bytes: Vec = match blobParts { None => Vec::new(), @@ -369,7 +369,7 @@ impl BlobMethods for Blob { start: Option, end: Option, content_type: Option) - -> Root { + -> DomRoot { let rel_pos = RelativePos::from_opts(start, end); Blob::new_sliced(self, rel_pos, content_type.unwrap_or(DOMString::from(""))) } diff --git a/components/script/dom/bluetooth.rs b/components/script/dom/bluetooth.rs index 1815a1a07bc4..ac3b9b7ea53b 100644 --- a/components/script/dom/bluetooth.rs +++ b/components/script/dom/bluetooth.rs @@ -20,7 +20,7 @@ use dom::bindings::error::Error::{self, Network, Security, Type}; use dom::bindings::error::Fallible; use dom::bindings::refcounted::{Trusted, TrustedPromise}; use dom::bindings::reflector::{DomObject, reflect_dom_object}; -use dom::bindings::root::{Dom, Root}; +use dom::bindings::root::{Dom, DomRoot}; use dom::bindings::str::DOMString; use dom::bluetoothdevice::BluetoothDevice; use dom::bluetoothpermissionresult::BluetoothPermissionResult; @@ -131,7 +131,7 @@ impl Bluetooth { } } - pub fn new(global: &GlobalScope) -> Root { + pub fn new(global: &GlobalScope) -> DomRoot { reflect_dom_object(box Bluetooth::new_inherited(), global, BluetoothBinding::Wrap) diff --git a/components/script/dom/bluetoothadvertisingevent.rs b/components/script/dom/bluetoothadvertisingevent.rs index e266cc01d157..9477c998587c 100644 --- a/components/script/dom/bluetoothadvertisingevent.rs +++ b/components/script/dom/bluetoothadvertisingevent.rs @@ -8,7 +8,7 @@ use dom::bindings::codegen::Bindings::EventBinding::EventBinding::EventMethods; use dom::bindings::error::Fallible; use dom::bindings::inheritance::Castable; use dom::bindings::reflector::reflect_dom_object; -use dom::bindings::root::{Dom, Root, RootedReference}; +use dom::bindings::root::{Dom, DomRoot, RootedReference}; use dom::bindings::str::DOMString; use dom::bluetoothdevice::BluetoothDevice; use dom::event::{Event, EventBubbles, EventCancelable}; @@ -54,7 +54,7 @@ impl BluetoothAdvertisingEvent { appearance: Option, txPower: Option, rssi: Option) - -> Root { + -> DomRoot { let ev = reflect_dom_object(box BluetoothAdvertisingEvent::new_inherited(device, name, appearance, @@ -73,7 +73,7 @@ impl BluetoothAdvertisingEvent { pub fn Constructor(window: &Window, type_: DOMString, init: &BluetoothAdvertisingEventInit) - -> Fallible> { + -> Fallible> { let global = window.upcast::(); let device = init.device.r(); let name = init.name.clone(); @@ -96,8 +96,8 @@ impl BluetoothAdvertisingEvent { impl BluetoothAdvertisingEventMethods for BluetoothAdvertisingEvent { // https://webbluetoothcg.github.io/web-bluetooth/#dom-bluetoothadvertisingevent-device - fn Device(&self) -> Root { - Root::from_ref(&*self.device) + fn Device(&self) -> DomRoot { + DomRoot::from_ref(&*self.device) } // https://webbluetoothcg.github.io/web-bluetooth/#dom-bluetoothadvertisingevent-name diff --git a/components/script/dom/bluetoothcharacteristicproperties.rs b/components/script/dom/bluetoothcharacteristicproperties.rs index 3afdf3d4e4cb..048e52765c8f 100644 --- a/components/script/dom/bluetoothcharacteristicproperties.rs +++ b/components/script/dom/bluetoothcharacteristicproperties.rs @@ -6,7 +6,7 @@ use dom::bindings::codegen::Bindings::BluetoothCharacteristicPropertiesBinding; use dom::bindings::codegen::Bindings::BluetoothCharacteristicPropertiesBinding:: BluetoothCharacteristicPropertiesMethods; use dom::bindings::reflector::{Reflector, reflect_dom_object}; -use dom::bindings::root::Root; +use dom::bindings::root::DomRoot; use dom::globalscope::GlobalScope; use dom_struct::dom_struct; @@ -60,7 +60,7 @@ impl BluetoothCharacteristicProperties { authenticatedSignedWrites: bool, reliableWrite: bool, writableAuxiliaries: bool) - -> Root { + -> DomRoot { reflect_dom_object(box BluetoothCharacteristicProperties::new_inherited(broadcast, read, writeWithoutResponse, diff --git a/components/script/dom/bluetoothdevice.rs b/components/script/dom/bluetoothdevice.rs index ce2f2845b2af..6c6dc5c9d6e1 100644 --- a/components/script/dom/bluetoothdevice.rs +++ b/components/script/dom/bluetoothdevice.rs @@ -12,7 +12,7 @@ use dom::bindings::error::Error; use dom::bindings::error::ErrorResult; use dom::bindings::inheritance::Castable; use dom::bindings::reflector::{DomObject, reflect_dom_object}; -use dom::bindings::root::{Dom, MutNullableDom, Root}; +use dom::bindings::root::{Dom, DomRoot, MutNullableDom}; use dom::bindings::str::DOMString; use dom::bluetooth::{AsyncBluetoothListener, Bluetooth, response_async}; use dom::bluetoothcharacteristicproperties::BluetoothCharacteristicProperties; @@ -65,7 +65,7 @@ impl BluetoothDevice { id: DOMString, name: Option, context: &Bluetooth) - -> Root { + -> DomRoot { reflect_dom_object(box BluetoothDevice::new_inherited(id, name, context), @@ -73,24 +73,24 @@ impl BluetoothDevice { BluetoothDeviceBinding::Wrap) } - pub fn get_gatt(&self) -> Root { + pub fn get_gatt(&self) -> DomRoot { self.gatt.or_init(|| { BluetoothRemoteGATTServer::new(&self.global(), self) }) } - fn get_context(&self) -> Root { - Root::from_ref(&self.context) + fn get_context(&self) -> DomRoot { + DomRoot::from_ref(&self.context) } pub fn get_or_create_service(&self, service: &BluetoothServiceMsg, server: &BluetoothRemoteGATTServer) - -> Root { + -> DomRoot { let (ref service_map_ref, _, _) = self.attribute_instance_map; let mut service_map = service_map_ref.borrow_mut(); if let Some(existing_service) = service_map.get(&service.instance_id) { - return Root::from_ref(&existing_service); + return DomRoot::from_ref(&existing_service); } let bt_service = BluetoothRemoteGATTService::new(&server.global(), &server.Device(), @@ -104,11 +104,11 @@ impl BluetoothDevice { pub fn get_or_create_characteristic(&self, characteristic: &BluetoothCharacteristicMsg, service: &BluetoothRemoteGATTService) - -> Root { + -> DomRoot { let (_, ref characteristic_map_ref, _) = self.attribute_instance_map; let mut characteristic_map = characteristic_map_ref.borrow_mut(); if let Some(existing_characteristic) = characteristic_map.get(&characteristic.instance_id) { - return Root::from_ref(&existing_characteristic); + return DomRoot::from_ref(&existing_characteristic); } let properties = BluetoothCharacteristicProperties::new(&service.global(), @@ -140,11 +140,11 @@ impl BluetoothDevice { pub fn get_or_create_descriptor(&self, descriptor: &BluetoothDescriptorMsg, characteristic: &BluetoothRemoteGATTCharacteristic) - -> Root { + -> DomRoot { let (_, _, ref descriptor_map_ref) = self.attribute_instance_map; let mut descriptor_map = descriptor_map_ref.borrow_mut(); if let Some(existing_descriptor) = descriptor_map.get(&descriptor.instance_id) { - return Root::from_ref(&existing_descriptor); + return DomRoot::from_ref(&existing_descriptor); } let bt_descriptor = BluetoothRemoteGATTDescriptor::new(&characteristic.global(), characteristic, @@ -225,7 +225,7 @@ impl BluetoothDeviceMethods for BluetoothDevice { } // https://webbluetoothcg.github.io/web-bluetooth/#dom-bluetoothdevice-gatt - fn GetGatt(&self) -> Option> { + fn GetGatt(&self) -> Option> { // Step 1. if self.global().as_window().bluetooth_extra_permission_data() .allowed_devices_contains_id(self.id.clone()) && !self.is_represented_device_null() { diff --git a/components/script/dom/bluetoothpermissionresult.rs b/components/script/dom/bluetoothpermissionresult.rs index 57e22968726b..ea1097c1f293 100644 --- a/components/script/dom/bluetoothpermissionresult.rs +++ b/components/script/dom/bluetoothpermissionresult.rs @@ -11,7 +11,7 @@ use dom::bindings::codegen::Bindings::PermissionStatusBinding::PermissionStatusB use dom::bindings::codegen::Bindings::WindowBinding::WindowBinding::WindowMethods; use dom::bindings::error::Error; use dom::bindings::reflector::{DomObject, reflect_dom_object}; -use dom::bindings::root::{Dom, Root}; +use dom::bindings::root::{Dom, DomRoot}; use dom::bindings::str::DOMString; use dom::bluetooth::{AsyncBluetoothListener, Bluetooth, AllowedBluetoothDevice}; use dom::bluetoothdevice::BluetoothDevice; @@ -40,13 +40,13 @@ impl BluetoothPermissionResult { result } - pub fn new(global: &GlobalScope, status: &PermissionStatus) -> Root { + pub fn new(global: &GlobalScope, status: &PermissionStatus) -> DomRoot { reflect_dom_object(box BluetoothPermissionResult::new_inherited(status), global, BluetoothPermissionResultBinding::Wrap) } - pub fn get_bluetooth(&self) -> Root { + pub fn get_bluetooth(&self) -> DomRoot { self.global().as_window().Navigator().Bluetooth() } @@ -74,9 +74,9 @@ impl BluetoothPermissionResult { impl BluetoothPermissionResultMethods for BluetoothPermissionResult { // https://webbluetoothcg.github.io/web-bluetooth/#dom-bluetoothpermissionresult-devices - fn Devices(&self) -> Vec> { - let device_vec: Vec> = - self.devices.borrow().iter().map(|d| Root::from_ref(&**d)).collect(); + fn Devices(&self) -> Vec> { + let device_vec: Vec> = + self.devices.borrow().iter().map(|d| DomRoot::from_ref(&**d)).collect(); device_vec } } diff --git a/components/script/dom/bluetoothremotegattcharacteristic.rs b/components/script/dom/bluetoothremotegattcharacteristic.rs index daefa2dea2f7..d322d0494b4f 100644 --- a/components/script/dom/bluetoothremotegattcharacteristic.rs +++ b/components/script/dom/bluetoothremotegattcharacteristic.rs @@ -15,7 +15,7 @@ use dom::bindings::codegen::Bindings::BluetoothRemoteGATTServiceBinding::Bluetoo use dom::bindings::error::Error::{self, InvalidModification, Network, NotSupported, Security}; use dom::bindings::inheritance::Castable; use dom::bindings::reflector::{DomObject, reflect_dom_object}; -use dom::bindings::root::{Dom, Root}; +use dom::bindings::root::{Dom, DomRoot}; use dom::bindings::str::{ByteString, DOMString}; use dom::bluetooth::{AsyncBluetoothListener, get_gatt_children, response_async}; use dom::bluetoothcharacteristicproperties::BluetoothCharacteristicProperties; @@ -64,7 +64,7 @@ impl BluetoothRemoteGATTCharacteristic { uuid: DOMString, properties: &BluetoothCharacteristicProperties, instanceID: String) - -> Root { + -> DomRoot { reflect_dom_object(box BluetoothRemoteGATTCharacteristic::new_inherited(service, uuid, properties, @@ -84,13 +84,13 @@ impl BluetoothRemoteGATTCharacteristic { impl BluetoothRemoteGATTCharacteristicMethods for BluetoothRemoteGATTCharacteristic { // https://webbluetoothcg.github.io/web-bluetooth/#dom-bluetoothremotegattcharacteristic-properties - fn Properties(&self) -> Root { - Root::from_ref(&self.properties) + fn Properties(&self) -> DomRoot { + DomRoot::from_ref(&self.properties) } // https://webbluetoothcg.github.io/web-bluetooth/#dom-bluetoothremotegattcharacteristic-service - fn Service(&self) -> Root { - Root::from_ref(&self.service) + fn Service(&self) -> DomRoot { + DomRoot::from_ref(&self.service) } // https://webbluetoothcg.github.io/web-bluetooth/#dom-bluetoothremotegattcharacteristic-uuid diff --git a/components/script/dom/bluetoothremotegattdescriptor.rs b/components/script/dom/bluetoothremotegattdescriptor.rs index 66a07e3b4f0e..03ae0aa5651e 100644 --- a/components/script/dom/bluetoothremotegattdescriptor.rs +++ b/components/script/dom/bluetoothremotegattdescriptor.rs @@ -13,7 +13,7 @@ use dom::bindings::codegen::Bindings::BluetoothRemoteGATTServerBinding::Bluetoot use dom::bindings::codegen::Bindings::BluetoothRemoteGATTServiceBinding::BluetoothRemoteGATTServiceMethods; use dom::bindings::error::Error::{self, InvalidModification, Network, Security}; use dom::bindings::reflector::{DomObject, Reflector, reflect_dom_object}; -use dom::bindings::root::{Dom, Root}; +use dom::bindings::root::{Dom, DomRoot}; use dom::bindings::str::{ByteString, DOMString}; use dom::bluetooth::{AsyncBluetoothListener, response_async}; use dom::bluetoothremotegattcharacteristic::{BluetoothRemoteGATTCharacteristic, MAXIMUM_ATTRIBUTE_LENGTH}; @@ -51,7 +51,7 @@ impl BluetoothRemoteGATTDescriptor { characteristic: &BluetoothRemoteGATTCharacteristic, uuid: DOMString, instanceID: String) - -> Root{ + -> DomRoot{ reflect_dom_object(box BluetoothRemoteGATTDescriptor::new_inherited(characteristic, uuid, instanceID), @@ -70,8 +70,8 @@ impl BluetoothRemoteGATTDescriptor { impl BluetoothRemoteGATTDescriptorMethods for BluetoothRemoteGATTDescriptor { // https://webbluetoothcg.github.io/web-bluetooth/#dom-bluetoothremotegattdescriptor-characteristic - fn Characteristic(&self) -> Root { - Root::from_ref(&self.characteristic) + fn Characteristic(&self) -> DomRoot { + DomRoot::from_ref(&self.characteristic) } // https://webbluetoothcg.github.io/web-bluetooth/#dom-bluetoothremotegattdescriptor-uuid diff --git a/components/script/dom/bluetoothremotegattserver.rs b/components/script/dom/bluetoothremotegattserver.rs index 99777f87b850..dbc477456c6b 100644 --- a/components/script/dom/bluetoothremotegattserver.rs +++ b/components/script/dom/bluetoothremotegattserver.rs @@ -9,7 +9,7 @@ use dom::bindings::codegen::Bindings::BluetoothRemoteGATTServerBinding::Bluetoot use dom::bindings::error::Error; use dom::bindings::error::ErrorResult; use dom::bindings::reflector::{DomObject, Reflector, reflect_dom_object}; -use dom::bindings::root::{Dom, Root}; +use dom::bindings::root::{Dom, DomRoot}; use dom::bluetooth::{AsyncBluetoothListener, get_gatt_children, response_async}; use dom::bluetoothdevice::BluetoothDevice; use dom::bluetoothuuid::{BluetoothServiceUUID, BluetoothUUID}; @@ -37,7 +37,7 @@ impl BluetoothRemoteGATTServer { } } - pub fn new(global: &GlobalScope, device: &BluetoothDevice) -> Root { + pub fn new(global: &GlobalScope, device: &BluetoothDevice) -> DomRoot { reflect_dom_object(box BluetoothRemoteGATTServer::new_inherited(device), global, BluetoothRemoteGATTServerBinding::Wrap) @@ -54,8 +54,8 @@ impl BluetoothRemoteGATTServer { impl BluetoothRemoteGATTServerMethods for BluetoothRemoteGATTServer { // https://webbluetoothcg.github.io/web-bluetooth/#dom-bluetoothremotegattserver-device - fn Device(&self) -> Root { - Root::from_ref(&self.device) + fn Device(&self) -> DomRoot { + DomRoot::from_ref(&self.device) } // https://webbluetoothcg.github.io/web-bluetooth/#dom-bluetoothremotegattserver-connected diff --git a/components/script/dom/bluetoothremotegattservice.rs b/components/script/dom/bluetoothremotegattservice.rs index ca9f8b3286c5..acb81f1f9a1d 100644 --- a/components/script/dom/bluetoothremotegattservice.rs +++ b/components/script/dom/bluetoothremotegattservice.rs @@ -8,7 +8,7 @@ use dom::bindings::codegen::Bindings::BluetoothRemoteGATTServiceBinding; use dom::bindings::codegen::Bindings::BluetoothRemoteGATTServiceBinding::BluetoothRemoteGATTServiceMethods; use dom::bindings::error::Error; use dom::bindings::reflector::reflect_dom_object; -use dom::bindings::root::{Dom, Root}; +use dom::bindings::root::{Dom, DomRoot}; use dom::bindings::str::DOMString; use dom::bluetooth::{AsyncBluetoothListener, get_gatt_children}; use dom::bluetoothdevice::BluetoothDevice; @@ -49,7 +49,7 @@ impl BluetoothRemoteGATTService { uuid: DOMString, isPrimary: bool, instanceID: String) - -> Root { + -> DomRoot { reflect_dom_object(box BluetoothRemoteGATTService::new_inherited(device, uuid, isPrimary, @@ -65,8 +65,8 @@ impl BluetoothRemoteGATTService { impl BluetoothRemoteGATTServiceMethods for BluetoothRemoteGATTService { // https://webbluetoothcg.github.io/web-bluetooth/#dom-bluetoothremotegattservice-device - fn Device(&self) -> Root { - Root::from_ref(&self.device) + fn Device(&self) -> DomRoot { + DomRoot::from_ref(&self.device) } // https://webbluetoothcg.github.io/web-bluetooth/#dom-bluetoothremotegattservice-isprimary diff --git a/components/script/dom/canvasgradient.rs b/components/script/dom/canvasgradient.rs index b6568119cfb6..21bd0c3a0d1c 100644 --- a/components/script/dom/canvasgradient.rs +++ b/components/script/dom/canvasgradient.rs @@ -11,7 +11,7 @@ use dom::bindings::codegen::Bindings::CanvasGradientBinding::CanvasGradientMetho use dom::bindings::error::{Error, ErrorResult}; use dom::bindings::num::Finite; use dom::bindings::reflector::{Reflector, reflect_dom_object}; -use dom::bindings::root::Root; +use dom::bindings::root::DomRoot; use dom::bindings::str::DOMString; use dom::globalscope::GlobalScope; use dom_struct::dom_struct; @@ -39,7 +39,7 @@ impl CanvasGradient { } } - pub fn new(global: &GlobalScope, style: CanvasGradientStyle) -> Root { + pub fn new(global: &GlobalScope, style: CanvasGradientStyle) -> DomRoot { reflect_dom_object(box CanvasGradient::new_inherited(style), global, CanvasGradientBinding::Wrap) diff --git a/components/script/dom/canvaspattern.rs b/components/script/dom/canvaspattern.rs index 7adb6d21fbc7..5c1a7edaf75e 100644 --- a/components/script/dom/canvaspattern.rs +++ b/components/script/dom/canvaspattern.rs @@ -5,7 +5,7 @@ use canvas_traits::canvas::{FillOrStrokeStyle, RepetitionStyle, SurfaceStyle}; use dom::bindings::codegen::Bindings::CanvasPatternBinding; use dom::bindings::reflector::{Reflector, reflect_dom_object}; -use dom::bindings::root::Root; +use dom::bindings::root::DomRoot; use dom::canvasgradient::ToFillOrStrokeStyle; use dom::globalscope::GlobalScope; use dom_struct::dom_struct; @@ -49,7 +49,7 @@ impl CanvasPattern { surface_size: Size2D, repeat: RepetitionStyle, origin_clean: bool) - -> Root { + -> DomRoot { reflect_dom_object(box CanvasPattern::new_inherited(surface_data, surface_size, repeat, origin_clean), global, diff --git a/components/script/dom/canvasrenderingcontext2d.rs b/components/script/dom/canvasrenderingcontext2d.rs index b9e7def9a1ca..de56cb28debb 100644 --- a/components/script/dom/canvasrenderingcontext2d.rs +++ b/components/script/dom/canvasrenderingcontext2d.rs @@ -23,7 +23,7 @@ use dom::bindings::error::{Error, ErrorResult, Fallible}; use dom::bindings::inheritance::Castable; use dom::bindings::num::Finite; use dom::bindings::reflector::{DomObject, Reflector, reflect_dom_object}; -use dom::bindings::root::{Dom, LayoutDom, Root}; +use dom::bindings::root::{Dom, DomRoot, LayoutDom}; use dom::bindings::str::DOMString; use dom::canvasgradient::{CanvasGradient, CanvasGradientStyle, ToFillOrStrokeStyle}; use dom::canvaspattern::CanvasPattern; @@ -151,7 +151,7 @@ impl CanvasRenderingContext2D { pub fn new(global: &GlobalScope, canvas: &HTMLCanvasElement, size: Size2D) - -> Root { + -> DomRoot { let window = window_from_node(canvas); let image_cache = window.image_cache(); let base_url = window.get_url(); @@ -603,10 +603,10 @@ impl LayoutCanvasRenderingContext2DHelpers for LayoutDom Root { + fn Canvas(&self) -> DomRoot { // This method is not called from a paint worklet rendering context, // so it's OK to panic if self.canvas is None. - Root::from_ref(self.canvas.as_ref().expect("No canvas.")) + DomRoot::from_ref(self.canvas.as_ref().expect("No canvas.")) } // https://html.spec.whatwg.org/multipage/#dom-context-2d-save @@ -997,10 +997,10 @@ impl CanvasRenderingContext2DMethods for CanvasRenderingContext2D { StringOrCanvasGradientOrCanvasPattern::String(DOMString::from(result)) }, CanvasFillOrStrokeStyle::Gradient(ref gradient) => { - StringOrCanvasGradientOrCanvasPattern::CanvasGradient(Root::from_ref(&*gradient)) + StringOrCanvasGradientOrCanvasPattern::CanvasGradient(DomRoot::from_ref(&*gradient)) }, CanvasFillOrStrokeStyle::Pattern(ref pattern) => { - StringOrCanvasGradientOrCanvasPattern::CanvasPattern(Root::from_ref(&*pattern)) + StringOrCanvasGradientOrCanvasPattern::CanvasPattern(DomRoot::from_ref(&*pattern)) } } } @@ -1046,10 +1046,10 @@ impl CanvasRenderingContext2DMethods for CanvasRenderingContext2D { StringOrCanvasGradientOrCanvasPattern::String(DOMString::from(result)) }, CanvasFillOrStrokeStyle::Gradient(ref gradient) => { - StringOrCanvasGradientOrCanvasPattern::CanvasGradient(Root::from_ref(&*gradient)) + StringOrCanvasGradientOrCanvasPattern::CanvasGradient(DomRoot::from_ref(&*gradient)) }, CanvasFillOrStrokeStyle::Pattern(ref pattern) => { - StringOrCanvasGradientOrCanvasPattern::CanvasPattern(Root::from_ref(&*pattern)) + StringOrCanvasGradientOrCanvasPattern::CanvasPattern(DomRoot::from_ref(&*pattern)) } } } @@ -1087,7 +1087,7 @@ impl CanvasRenderingContext2DMethods for CanvasRenderingContext2D { } // https://html.spec.whatwg.org/multipage/#dom-context-2d-createimagedata - fn CreateImageData(&self, sw: Finite, sh: Finite) -> Fallible> { + fn CreateImageData(&self, sw: Finite, sh: Finite) -> Fallible> { if *sw == 0.0 || *sh == 0.0 { return Err(Error::IndexSize); } @@ -1098,7 +1098,7 @@ impl CanvasRenderingContext2DMethods for CanvasRenderingContext2D { } // https://html.spec.whatwg.org/multipage/#dom-context-2d-createimagedata - fn CreateImageData_(&self, imagedata: &ImageData) -> Fallible> { + fn CreateImageData_(&self, imagedata: &ImageData) -> Fallible> { ImageData::new(&self.global(), imagedata.Width(), imagedata.Height(), @@ -1111,7 +1111,7 @@ impl CanvasRenderingContext2DMethods for CanvasRenderingContext2D { sy: Finite, sw: Finite, sh: Finite) - -> Fallible> { + -> Fallible> { if !self.origin_is_clean() { return Err(Error::Security) } @@ -1198,7 +1198,7 @@ impl CanvasRenderingContext2DMethods for CanvasRenderingContext2D { y0: Finite, x1: Finite, y1: Finite) - -> Root { + -> DomRoot { CanvasGradient::new(&self.global(), CanvasGradientStyle::Linear(LinearGradientStyle::new(*x0, *y0, @@ -1215,7 +1215,7 @@ impl CanvasRenderingContext2DMethods for CanvasRenderingContext2D { x1: Finite, y1: Finite, r1: Finite) - -> Fallible> { + -> Fallible> { if *r0 < 0. || *r1 < 0. { return Err(Error::IndexSize); } @@ -1234,7 +1234,7 @@ impl CanvasRenderingContext2DMethods for CanvasRenderingContext2D { fn CreatePattern(&self, image: CanvasImageSource, mut repetition: DOMString) - -> Fallible> { + -> Fallible> { let (image_data, image_size) = match image { CanvasImageSource::HTMLImageElement(ref image) => { // https://html.spec.whatwg.org/multipage/#img-error diff --git a/components/script/dom/characterdata.rs b/components/script/dom/characterdata.rs index 4d6c3a8f0112..65c84f1e2c0b 100644 --- a/components/script/dom/characterdata.rs +++ b/components/script/dom/characterdata.rs @@ -12,7 +12,7 @@ use dom::bindings::codegen::InheritTypes::{CharacterDataTypeId, NodeTypeId}; use dom::bindings::codegen::UnionTypes::NodeOrString; use dom::bindings::error::{Error, ErrorResult, Fallible}; use dom::bindings::inheritance::Castable; -use dom::bindings::root::{LayoutDom, Root}; +use dom::bindings::root::{DomRoot, LayoutDom}; use dom::bindings::str::DOMString; use dom::comment::Comment; use dom::document::Document; @@ -40,17 +40,17 @@ impl CharacterData { } } - pub fn clone_with_data(&self, data: DOMString, document: &Document) -> Root { + pub fn clone_with_data(&self, data: DOMString, document: &Document) -> DomRoot { match self.upcast::().type_id() { NodeTypeId::CharacterData(CharacterDataTypeId::Comment) => { - Root::upcast(Comment::new(data, &document)) + DomRoot::upcast(Comment::new(data, &document)) } NodeTypeId::CharacterData(CharacterDataTypeId::ProcessingInstruction) => { let pi = self.downcast::().unwrap(); - Root::upcast(ProcessingInstruction::new(pi.Target(), data, &document)) + DomRoot::upcast(ProcessingInstruction::new(pi.Target(), data, &document)) }, NodeTypeId::CharacterData(CharacterDataTypeId::Text) => { - Root::upcast(Text::new(data, &document)) + DomRoot::upcast(Text::new(data, &document)) }, _ => unreachable!(), } @@ -237,13 +237,13 @@ impl CharacterDataMethods for CharacterData { } // https://dom.spec.whatwg.org/#dom-nondocumenttypechildnode-previouselementsibling - fn GetPreviousElementSibling(&self) -> Option> { - self.upcast::().preceding_siblings().filter_map(Root::downcast).next() + fn GetPreviousElementSibling(&self) -> Option> { + self.upcast::().preceding_siblings().filter_map(DomRoot::downcast).next() } // https://dom.spec.whatwg.org/#dom-nondocumenttypechildnode-nextelementsibling - fn GetNextElementSibling(&self) -> Option> { - self.upcast::().following_siblings().filter_map(Root::downcast).next() + fn GetNextElementSibling(&self) -> Option> { + self.upcast::().following_siblings().filter_map(DomRoot::downcast).next() } } diff --git a/components/script/dom/client.rs b/components/script/dom/client.rs index 6ec88bd0cbd5..e4bb8f137a1d 100644 --- a/components/script/dom/client.rs +++ b/components/script/dom/client.rs @@ -5,7 +5,7 @@ use dom::bindings::codegen::Bindings::ClientBinding::{ClientMethods, Wrap}; use dom::bindings::codegen::Bindings::ClientBinding::FrameType; use dom::bindings::reflector::{Reflector, reflect_dom_object}; -use dom::bindings::root::{Root, MutNullableDom}; +use dom::bindings::root::{DomRoot, MutNullableDom}; use dom::bindings::str::{DOMString, USVString}; use dom::serviceworker::ServiceWorker; use dom::window::Window; @@ -35,7 +35,7 @@ impl Client { } } - pub fn new(window: &Window) -> Root { + pub fn new(window: &Window) -> DomRoot { reflect_dom_object(box Client::new_inherited(window.get_url()), window, Wrap) @@ -45,7 +45,7 @@ impl Client { self.url.clone() } - pub fn get_controller(&self) -> Option> { + pub fn get_controller(&self) -> Option> { self.active_worker.get() } diff --git a/components/script/dom/closeevent.rs b/components/script/dom/closeevent.rs index 8af7d5414c8a..ef25e97c945f 100644 --- a/components/script/dom/closeevent.rs +++ b/components/script/dom/closeevent.rs @@ -8,7 +8,7 @@ use dom::bindings::codegen::Bindings::EventBinding::EventMethods; use dom::bindings::error::Fallible; use dom::bindings::inheritance::Castable; use dom::bindings::reflector::reflect_dom_object; -use dom::bindings::root::Root; +use dom::bindings::root::DomRoot; use dom::bindings::str::DOMString; use dom::event::{Event, EventBubbles, EventCancelable}; use dom::globalscope::GlobalScope; @@ -33,7 +33,7 @@ impl CloseEvent { } } - pub fn new_uninitialized(global: &GlobalScope) -> Root { + pub fn new_uninitialized(global: &GlobalScope) -> DomRoot { reflect_dom_object(box CloseEvent::new_inherited(false, 0, DOMString::new()), global, CloseEventBinding::Wrap) @@ -46,7 +46,7 @@ impl CloseEvent { wasClean: bool, code: u16, reason: DOMString) - -> Root { + -> DomRoot { let event = box CloseEvent::new_inherited(wasClean, code, reason); let ev = reflect_dom_object(event, global, CloseEventBinding::Wrap); { @@ -61,7 +61,7 @@ impl CloseEvent { pub fn Constructor(global: &GlobalScope, type_: DOMString, init: &CloseEventBinding::CloseEventInit) - -> Fallible> { + -> Fallible> { let bubbles = EventBubbles::from(init.parent.bubbles); let cancelable = EventCancelable::from(init.parent.cancelable); Ok(CloseEvent::new(global, diff --git a/components/script/dom/comment.rs b/components/script/dom/comment.rs index e6a5f42b3db4..a42ba542eb5f 100644 --- a/components/script/dom/comment.rs +++ b/components/script/dom/comment.rs @@ -5,7 +5,7 @@ use dom::bindings::codegen::Bindings::CommentBinding; use dom::bindings::codegen::Bindings::WindowBinding::WindowMethods; use dom::bindings::error::Fallible; -use dom::bindings::root::Root; +use dom::bindings::root::DomRoot; use dom::bindings::str::DOMString; use dom::characterdata::CharacterData; use dom::document::Document; @@ -26,13 +26,13 @@ impl Comment { } } - pub fn new(text: DOMString, document: &Document) -> Root { + pub fn new(text: DOMString, document: &Document) -> DomRoot { Node::reflect_node(box Comment::new_inherited(text, document), document, CommentBinding::Wrap) } - pub fn Constructor(window: &Window, data: DOMString) -> Fallible> { + pub fn Constructor(window: &Window, data: DOMString) -> Fallible> { let document = window.Document(); Ok(Comment::new(data, &document)) } diff --git a/components/script/dom/compositionevent.rs b/components/script/dom/compositionevent.rs index 3c29e5d1b26f..f28f9229742c 100644 --- a/components/script/dom/compositionevent.rs +++ b/components/script/dom/compositionevent.rs @@ -6,7 +6,7 @@ use dom::bindings::codegen::Bindings::CompositionEventBinding::{self, Compositio use dom::bindings::codegen::Bindings::UIEventBinding::UIEventBinding::UIEventMethods; use dom::bindings::error::Fallible; use dom::bindings::reflector::reflect_dom_object; -use dom::bindings::root::{Root, RootedReference}; +use dom::bindings::root::{DomRoot, RootedReference}; use dom::bindings::str::DOMString; use dom::uievent::UIEvent; use dom::window::Window; @@ -25,7 +25,7 @@ impl CompositionEvent { cancelable: bool, view: Option<&Window>, detail: i32, - data: DOMString) -> Root { + data: DOMString) -> DomRoot { let ev = reflect_dom_object(box CompositionEvent { uievent: UIEvent::new_inherited(), data: data, @@ -39,7 +39,7 @@ impl CompositionEvent { pub fn Constructor(window: &Window, type_: DOMString, init: &CompositionEventBinding::CompositionEventInit) - -> Fallible> { + -> Fallible> { let event = CompositionEvent::new(window, type_, init.parent.parent.bubbles, diff --git a/components/script/dom/create.rs b/components/script/dom/create.rs index c62fc1c14c61..39e91a215e52 100644 --- a/components/script/dom/create.rs +++ b/components/script/dom/create.rs @@ -4,7 +4,7 @@ use dom::bindings::error::{report_pending_exception, throw_dom_exception}; use dom::bindings::reflector::DomObject; -use dom::bindings::root::Root; +use dom::bindings::root::DomRoot; use dom::customelementregistry::{is_valid_custom_element_name, upgrade_element}; use dom::document::Document; use dom::element::{CustomElementCreationMode, CustomElementState, Element, ElementCreator}; @@ -87,17 +87,17 @@ use servo_config::prefs::PREFS; fn create_svg_element(name: QualName, prefix: Option, document: &Document) - -> Root { + -> DomRoot { assert!(name.ns == ns!(svg)); macro_rules! make( ($ctor:ident) => ({ let obj = $ctor::new(name.local, prefix, document); - Root::upcast(obj) + DomRoot::upcast(obj) }); ($ctor:ident, $($arg:expr),+) => ({ let obj = $ctor::new(name.local, prefix, document, $($arg),+); - Root::upcast(obj) + DomRoot::upcast(obj) }) ); @@ -119,7 +119,7 @@ fn create_html_element(name: QualName, document: &Document, creator: ElementCreator, mode: CustomElementCreationMode) - -> Root { + -> DomRoot { assert!(name.ns == ns!(html)); // Step 4 @@ -129,7 +129,7 @@ fn create_html_element(name: QualName, if definition.is_autonomous() { match mode { CustomElementCreationMode::Asynchronous => { - let result = Root::upcast::( + let result = DomRoot::upcast::( HTMLElement::new(name.local.clone(), prefix.clone(), document)); result.set_custom_element_state(CustomElementState::Undefined); ScriptThread::enqueue_upgrade_reaction(&*result, definition); @@ -155,7 +155,7 @@ fn create_html_element(name: QualName, } // Step 6.1.2 - let element = Root::upcast::( + let element = DomRoot::upcast::( HTMLUnknownElement::new(local_name, prefix, document)); element.set_custom_element_state(CustomElementState::Failed); element @@ -195,17 +195,17 @@ pub fn create_native_html_element(name: QualName, prefix: Option, document: &Document, creator: ElementCreator) - -> Root { + -> DomRoot { assert!(name.ns == ns!(html)); macro_rules! make( ($ctor:ident) => ({ let obj = $ctor::new(name.local, prefix, document); - Root::upcast(obj) + DomRoot::upcast(obj) }); ($ctor:ident, $($arg:expr),+) => ({ let obj = $ctor::new(name.local, prefix, document, $($arg),+); - Root::upcast(obj) + DomRoot::upcast(obj) }) ); @@ -364,7 +364,7 @@ pub fn create_element(name: QualName, document: &Document, creator: ElementCreator, mode: CustomElementCreationMode) - -> Root { + -> DomRoot { let prefix = name.prefix.clone(); match name.ns { ns!(html) => create_html_element(name, prefix, is, document, creator, mode), diff --git a/components/script/dom/crypto.rs b/components/script/dom/crypto.rs index afde6f47be92..e6c6354557f8 100644 --- a/components/script/dom/crypto.rs +++ b/components/script/dom/crypto.rs @@ -8,7 +8,7 @@ use dom::bindings::codegen::Bindings::CryptoBinding; use dom::bindings::codegen::Bindings::CryptoBinding::CryptoMethods; use dom::bindings::error::{Error, Fallible}; use dom::bindings::reflector::{Reflector, reflect_dom_object}; -use dom::bindings::root::Root; +use dom::bindings::root::DomRoot; use dom::globalscope::GlobalScope; use dom_struct::dom_struct; use js::jsapi::{JSContext, JSObject}; @@ -33,7 +33,7 @@ impl Crypto { } } - pub fn new(global: &GlobalScope) -> Root { + pub fn new(global: &GlobalScope) -> DomRoot { reflect_dom_object(box Crypto::new_inherited(), global, CryptoBinding::Wrap) } } diff --git a/components/script/dom/cssfontfacerule.rs b/components/script/dom/cssfontfacerule.rs index 1a72f11a5fa7..f24c20037005 100644 --- a/components/script/dom/cssfontfacerule.rs +++ b/components/script/dom/cssfontfacerule.rs @@ -4,7 +4,7 @@ use dom::bindings::codegen::Bindings::CSSFontFaceRuleBinding; use dom::bindings::reflector::reflect_dom_object; -use dom::bindings::root::Root; +use dom::bindings::root::DomRoot; use dom::bindings::str::DOMString; use dom::cssrule::{CSSRule, SpecificCSSRule}; use dom::cssstylesheet::CSSStyleSheet; @@ -32,7 +32,7 @@ impl CSSFontFaceRule { #[allow(unrooted_must_root)] pub fn new(window: &Window, parent_stylesheet: &CSSStyleSheet, - fontfacerule: Arc>) -> Root { + fontfacerule: Arc>) -> DomRoot { reflect_dom_object(box CSSFontFaceRule::new_inherited(parent_stylesheet, fontfacerule), window, CSSFontFaceRuleBinding::Wrap) diff --git a/components/script/dom/cssgroupingrule.rs b/components/script/dom/cssgroupingrule.rs index de5e59f27848..dec666c825e0 100644 --- a/components/script/dom/cssgroupingrule.rs +++ b/components/script/dom/cssgroupingrule.rs @@ -6,7 +6,7 @@ use dom::bindings::codegen::Bindings::CSSGroupingRuleBinding::CSSGroupingRuleMet use dom::bindings::error::{ErrorResult, Fallible}; use dom::bindings::inheritance::Castable; use dom::bindings::reflector::DomObject; -use dom::bindings::root::{MutNullableDom, Root}; +use dom::bindings::root::{DomRoot, MutNullableDom}; use dom::bindings::str::DOMString; use dom::cssrule::CSSRule; use dom::cssrulelist::{CSSRuleList, RulesSource}; @@ -34,7 +34,7 @@ impl CSSGroupingRule { } } - fn rulelist(&self) -> Root { + fn rulelist(&self) -> DomRoot { let parent_stylesheet = self.upcast::().parent_stylesheet(); self.rulelist.or_init(|| CSSRuleList::new(self.global().as_window(), parent_stylesheet, @@ -52,7 +52,7 @@ impl CSSGroupingRule { impl CSSGroupingRuleMethods for CSSGroupingRule { // https://drafts.csswg.org/cssom/#dom-cssgroupingrule-cssrules - fn CssRules(&self) -> Root { + fn CssRules(&self) -> DomRoot { // XXXManishearth check origin clean flag self.rulelist() } diff --git a/components/script/dom/cssimportrule.rs b/components/script/dom/cssimportrule.rs index e0f913bb81e6..78233b998e62 100644 --- a/components/script/dom/cssimportrule.rs +++ b/components/script/dom/cssimportrule.rs @@ -4,7 +4,7 @@ use dom::bindings::codegen::Bindings::CSSImportRuleBinding; use dom::bindings::reflector::reflect_dom_object; -use dom::bindings::root::Root; +use dom::bindings::root::DomRoot; use dom::bindings::str::DOMString; use dom::cssrule::{CSSRule, SpecificCSSRule}; use dom::cssstylesheet::CSSStyleSheet; @@ -34,7 +34,7 @@ impl CSSImportRule { #[allow(unrooted_must_root)] pub fn new(window: &Window, parent_stylesheet: &CSSStyleSheet, - import_rule: Arc>) -> Root { + import_rule: Arc>) -> DomRoot { reflect_dom_object(box Self::new_inherited(parent_stylesheet, import_rule), window, CSSImportRuleBinding::Wrap) diff --git a/components/script/dom/csskeyframerule.rs b/components/script/dom/csskeyframerule.rs index 17b5c7a63c4b..e1883d33af35 100644 --- a/components/script/dom/csskeyframerule.rs +++ b/components/script/dom/csskeyframerule.rs @@ -5,7 +5,7 @@ use dom::bindings::codegen::Bindings::CSSKeyframeRuleBinding::{self, CSSKeyframeRuleMethods}; use dom::bindings::inheritance::Castable; use dom::bindings::reflector::{DomObject, reflect_dom_object}; -use dom::bindings::root::{Dom, MutNullableDom, Root}; +use dom::bindings::root::{Dom, DomRoot, MutNullableDom}; use dom::bindings::str::DOMString; use dom::cssrule::{CSSRule, SpecificCSSRule}; use dom::cssstyledeclaration::{CSSModificationAccess, CSSStyleDeclaration, CSSStyleOwner}; @@ -36,7 +36,7 @@ impl CSSKeyframeRule { #[allow(unrooted_must_root)] pub fn new(window: &Window, parent_stylesheet: &CSSStyleSheet, - keyframerule: Arc>) -> Root { + keyframerule: Arc>) -> DomRoot { reflect_dom_object(box CSSKeyframeRule::new_inherited(parent_stylesheet, keyframerule), window, CSSKeyframeRuleBinding::Wrap) @@ -45,7 +45,7 @@ impl CSSKeyframeRule { impl CSSKeyframeRuleMethods for CSSKeyframeRule { // https://drafts.csswg.org/css-animations/#dom-csskeyframerule-style - fn Style(&self) -> Root { + fn Style(&self) -> DomRoot { self.style_decl.or_init(|| { let guard = self.cssrule.shared_lock().read(); CSSStyleDeclaration::new( diff --git a/components/script/dom/csskeyframesrule.rs b/components/script/dom/csskeyframesrule.rs index 280cd53fcf6a..407a3f78ff1e 100644 --- a/components/script/dom/csskeyframesrule.rs +++ b/components/script/dom/csskeyframesrule.rs @@ -8,7 +8,7 @@ use dom::bindings::codegen::Bindings::CSSKeyframesRuleBinding::CSSKeyframesRuleM use dom::bindings::error::ErrorResult; use dom::bindings::inheritance::Castable; use dom::bindings::reflector::{DomObject, reflect_dom_object}; -use dom::bindings::root::{MutNullableDom, Root}; +use dom::bindings::root::{DomRoot, MutNullableDom}; use dom::bindings::str::DOMString; use dom::csskeyframerule::CSSKeyframeRule; use dom::cssrule::{CSSRule, SpecificCSSRule}; @@ -41,13 +41,13 @@ impl CSSKeyframesRule { #[allow(unrooted_must_root)] pub fn new(window: &Window, parent_stylesheet: &CSSStyleSheet, - keyframesrule: Arc>) -> Root { + keyframesrule: Arc>) -> DomRoot { reflect_dom_object(box CSSKeyframesRule::new_inherited(parent_stylesheet, keyframesrule), window, CSSKeyframesRuleBinding::Wrap) } - fn rulelist(&self) -> Root { + fn rulelist(&self) -> DomRoot { self.rulelist.or_init(|| { let parent_stylesheet = &self.upcast::().parent_stylesheet(); CSSRuleList::new(self.global().as_window(), @@ -76,7 +76,7 @@ impl CSSKeyframesRule { impl CSSKeyframesRuleMethods for CSSKeyframesRule { // https://drafts.csswg.org/css-animations/#dom-csskeyframesrule-cssrules - fn CssRules(&self) -> Root { + fn CssRules(&self) -> DomRoot { self.rulelist() } @@ -104,10 +104,10 @@ impl CSSKeyframesRuleMethods for CSSKeyframesRule { } // https://drafts.csswg.org/css-animations/#dom-csskeyframesrule-findrule - fn FindRule(&self, selector: DOMString) -> Option> { + fn FindRule(&self, selector: DOMString) -> Option> { self.find_rule(&selector).and_then(|idx| { self.rulelist().item(idx as u32) - }).and_then(Root::downcast) + }).and_then(DomRoot::downcast) } // https://drafts.csswg.org/css-animations/#dom-csskeyframesrule-name diff --git a/components/script/dom/cssmediarule.rs b/components/script/dom/cssmediarule.rs index c77ed0b75639..3bf34bc6cf56 100644 --- a/components/script/dom/cssmediarule.rs +++ b/components/script/dom/cssmediarule.rs @@ -7,7 +7,7 @@ use dom::bindings::codegen::Bindings::CSSMediaRuleBinding; use dom::bindings::codegen::Bindings::CSSMediaRuleBinding::CSSMediaRuleMethods; use dom::bindings::codegen::Bindings::WindowBinding::WindowBinding::WindowMethods; use dom::bindings::reflector::{DomObject, reflect_dom_object}; -use dom::bindings::root::{MutNullableDom, Root}; +use dom::bindings::root::{DomRoot, MutNullableDom}; use dom::bindings::str::DOMString; use dom::cssconditionrule::CSSConditionRule; use dom::cssrule::SpecificCSSRule; @@ -44,13 +44,13 @@ impl CSSMediaRule { #[allow(unrooted_must_root)] pub fn new(window: &Window, parent_stylesheet: &CSSStyleSheet, - mediarule: Arc>) -> Root { + mediarule: Arc>) -> DomRoot { reflect_dom_object(box CSSMediaRule::new_inherited(parent_stylesheet, mediarule), window, CSSMediaRuleBinding::Wrap) } - fn medialist(&self) -> Root { + fn medialist(&self) -> DomRoot { self.medialist.or_init(|| { let guard = self.cssconditionrule.shared_lock().read(); MediaList::new(self.global().as_window(), @@ -108,7 +108,7 @@ impl SpecificCSSRule for CSSMediaRule { impl CSSMediaRuleMethods for CSSMediaRule { // https://drafts.csswg.org/cssom/#dom-cssgroupingrule-media - fn Media(&self) -> Root { + fn Media(&self) -> DomRoot { self.medialist() } } diff --git a/components/script/dom/cssnamespacerule.rs b/components/script/dom/cssnamespacerule.rs index b64b46ec4e2c..0d5768d646f7 100644 --- a/components/script/dom/cssnamespacerule.rs +++ b/components/script/dom/cssnamespacerule.rs @@ -5,7 +5,7 @@ use dom::bindings::codegen::Bindings::CSSNamespaceRuleBinding; use dom::bindings::codegen::Bindings::CSSNamespaceRuleBinding::CSSNamespaceRuleMethods; use dom::bindings::reflector::reflect_dom_object; -use dom::bindings::root::Root; +use dom::bindings::root::DomRoot; use dom::bindings::str::DOMString; use dom::cssrule::{CSSRule, SpecificCSSRule}; use dom::cssstylesheet::CSSStyleSheet; @@ -33,7 +33,7 @@ impl CSSNamespaceRule { #[allow(unrooted_must_root)] pub fn new(window: &Window, parent_stylesheet: &CSSStyleSheet, - namespacerule: Arc>) -> Root { + namespacerule: Arc>) -> DomRoot { reflect_dom_object(box CSSNamespaceRule::new_inherited(parent_stylesheet, namespacerule), window, CSSNamespaceRuleBinding::Wrap) diff --git a/components/script/dom/cssrule.rs b/components/script/dom/cssrule.rs index 928762abb3ce..da867be8df05 100644 --- a/components/script/dom/cssrule.rs +++ b/components/script/dom/cssrule.rs @@ -5,7 +5,7 @@ use dom::bindings::codegen::Bindings::CSSRuleBinding::CSSRuleMethods; use dom::bindings::inheritance::Castable; use dom::bindings::reflector::Reflector; -use dom::bindings::root::{Dom, Root}; +use dom::bindings::root::{Dom, DomRoot}; use dom::bindings::str::DOMString; use dom::cssfontfacerule::CSSFontFaceRule; use dom::cssimportrule::CSSImportRule; @@ -72,19 +72,19 @@ impl CSSRule { // Given a StyleCssRule, create a new instance of a derived class of // CSSRule based on which rule it is pub fn new_specific(window: &Window, parent_stylesheet: &CSSStyleSheet, - rule: StyleCssRule) -> Root { + rule: StyleCssRule) -> DomRoot { // be sure to update the match in as_specific when this is updated match rule { - StyleCssRule::Import(s) => Root::upcast(CSSImportRule::new(window, parent_stylesheet, s)), - StyleCssRule::Style(s) => Root::upcast(CSSStyleRule::new(window, parent_stylesheet, s)), - StyleCssRule::FontFace(s) => Root::upcast(CSSFontFaceRule::new(window, parent_stylesheet, s)), + StyleCssRule::Import(s) => DomRoot::upcast(CSSImportRule::new(window, parent_stylesheet, s)), + StyleCssRule::Style(s) => DomRoot::upcast(CSSStyleRule::new(window, parent_stylesheet, s)), + StyleCssRule::FontFace(s) => DomRoot::upcast(CSSFontFaceRule::new(window, parent_stylesheet, s)), StyleCssRule::FontFeatureValues(_) => unimplemented!(), StyleCssRule::CounterStyle(_) => unimplemented!(), - StyleCssRule::Keyframes(s) => Root::upcast(CSSKeyframesRule::new(window, parent_stylesheet, s)), - StyleCssRule::Media(s) => Root::upcast(CSSMediaRule::new(window, parent_stylesheet, s)), - StyleCssRule::Namespace(s) => Root::upcast(CSSNamespaceRule::new(window, parent_stylesheet, s)), - StyleCssRule::Viewport(s) => Root::upcast(CSSViewportRule::new(window, parent_stylesheet, s)), - StyleCssRule::Supports(s) => Root::upcast(CSSSupportsRule::new(window, parent_stylesheet, s)), + StyleCssRule::Keyframes(s) => DomRoot::upcast(CSSKeyframesRule::new(window, parent_stylesheet, s)), + StyleCssRule::Media(s) => DomRoot::upcast(CSSMediaRule::new(window, parent_stylesheet, s)), + StyleCssRule::Namespace(s) => DomRoot::upcast(CSSNamespaceRule::new(window, parent_stylesheet, s)), + StyleCssRule::Viewport(s) => DomRoot::upcast(CSSViewportRule::new(window, parent_stylesheet, s)), + StyleCssRule::Supports(s) => DomRoot::upcast(CSSSupportsRule::new(window, parent_stylesheet, s)), StyleCssRule::Page(_) => unreachable!(), StyleCssRule::Document(_) => unimplemented!(), // TODO } @@ -121,11 +121,11 @@ impl CSSRuleMethods for CSSRule { } // https://drafts.csswg.org/cssom/#dom-cssrule-parentstylesheet - fn GetParentStyleSheet(&self) -> Option> { + fn GetParentStyleSheet(&self) -> Option> { if self.parent_stylesheet_removed.get() { None } else { - Some(Root::from_ref(&*self.parent_stylesheet)) + Some(DomRoot::from_ref(&*self.parent_stylesheet)) } } diff --git a/components/script/dom/cssrulelist.rs b/components/script/dom/cssrulelist.rs index 1690b2f71d11..c33005d0a575 100644 --- a/components/script/dom/cssrulelist.rs +++ b/components/script/dom/cssrulelist.rs @@ -7,7 +7,7 @@ use dom::bindings::codegen::Bindings::CSSRuleListBinding; use dom::bindings::codegen::Bindings::CSSRuleListBinding::CSSRuleListMethods; use dom::bindings::error::{Error, ErrorResult, Fallible}; use dom::bindings::reflector::{DomObject, Reflector, reflect_dom_object}; -use dom::bindings::root::{Dom, MutNullableDom, Root}; +use dom::bindings::root::{Dom, DomRoot, MutNullableDom}; use dom::csskeyframerule::CSSKeyframeRule; use dom::cssrule::CSSRule; use dom::cssstylesheet::CSSStyleSheet; @@ -70,7 +70,7 @@ impl CSSRuleList { #[allow(unrooted_must_root)] pub fn new(window: &Window, parent_stylesheet: &CSSStyleSheet, - rules: RulesSource) -> Root { + rules: RulesSource) -> DomRoot { reflect_dom_object(box CSSRuleList::new_inherited(parent_stylesheet, rules), window, CSSRuleListBinding::Wrap) @@ -133,11 +133,11 @@ impl CSSRuleList { // Remove parent stylesheets from all children pub fn deparent_all(&self) { for rule in self.dom_rules.borrow().iter() { - rule.get().map(|r| Root::upcast(r).deparent()); + rule.get().map(|r| DomRoot::upcast(r).deparent()); } } - pub fn item(&self, idx: u32) -> Option> { + pub fn item(&self, idx: u32) -> Option> { self.dom_rules.borrow().get(idx as usize).map(|rule| { rule.or_init(|| { let parent_stylesheet = &self.parent_stylesheet; @@ -149,7 +149,7 @@ impl CSSRuleList { rules.read_with(&guard).0[idx as usize].clone()) } RulesSource::Keyframes(ref rules) => { - Root::upcast(CSSKeyframeRule::new(self.global().as_window(), + DomRoot::upcast(CSSKeyframeRule::new(self.global().as_window(), parent_stylesheet, rules.read_with(&guard) .keyframes[idx as usize] @@ -176,7 +176,7 @@ impl CSSRuleList { impl CSSRuleListMethods for CSSRuleList { // https://drafts.csswg.org/cssom/#ref-for-dom-cssrulelist-item-1 - fn Item(&self, idx: u32) -> Option> { + fn Item(&self, idx: u32) -> Option> { self.item(idx) } @@ -186,7 +186,7 @@ impl CSSRuleListMethods for CSSRuleList { } // check-tidy: no specs after this line - fn IndexedGetter(&self, index: u32) -> Option> { + fn IndexedGetter(&self, index: u32) -> Option> { self.Item(index) } } diff --git a/components/script/dom/cssstyledeclaration.rs b/components/script/dom/cssstyledeclaration.rs index dc2bf64d166f..f2cb3b4e5ce2 100644 --- a/components/script/dom/cssstyledeclaration.rs +++ b/components/script/dom/cssstyledeclaration.rs @@ -7,7 +7,7 @@ use dom::bindings::codegen::Bindings::WindowBinding::WindowMethods; use dom::bindings::error::{Error, ErrorResult, Fallible}; use dom::bindings::inheritance::Castable; use dom::bindings::reflector::{DomObject, Reflector, reflect_dom_object}; -use dom::bindings::root::{Dom, Root}; +use dom::bindings::root::{Dom, DomRoot}; use dom::bindings::str::DOMString; use dom::cssrule::CSSRule; use dom::element::Element; @@ -137,10 +137,10 @@ impl CSSStyleOwner { } } - fn window(&self) -> Root { + fn window(&self) -> DomRoot { match *self { CSSStyleOwner::Element(ref el) => window_from_node(&**el), - CSSStyleOwner::CSSRule(ref rule, _) => Root::from_ref(rule.global().as_window()), + CSSStyleOwner::CSSRule(ref rule, _) => DomRoot::from_ref(rule.global().as_window()), } } @@ -192,7 +192,7 @@ impl CSSStyleDeclaration { owner: CSSStyleOwner, pseudo: Option, modification_access: CSSModificationAccess) - -> Root { + -> DomRoot { reflect_dom_object(box CSSStyleDeclaration::new_inherited(owner, pseudo, modification_access), diff --git a/components/script/dom/cssstylerule.rs b/components/script/dom/cssstylerule.rs index b8b99b8aef37..e67245f835fc 100644 --- a/components/script/dom/cssstylerule.rs +++ b/components/script/dom/cssstylerule.rs @@ -8,7 +8,7 @@ use dom::bindings::codegen::Bindings::CSSStyleRuleBinding::{self, CSSStyleRuleMe use dom::bindings::codegen::Bindings::WindowBinding::WindowBinding::WindowMethods; use dom::bindings::inheritance::Castable; use dom::bindings::reflector::{DomObject, reflect_dom_object}; -use dom::bindings::root::{Dom, MutNullableDom, Root}; +use dom::bindings::root::{Dom, DomRoot, MutNullableDom}; use dom::bindings::str::DOMString; use dom::cssrule::{CSSRule, SpecificCSSRule}; use dom::cssstyledeclaration::{CSSModificationAccess, CSSStyleDeclaration, CSSStyleOwner}; @@ -42,7 +42,7 @@ impl CSSStyleRule { #[allow(unrooted_must_root)] pub fn new(window: &Window, parent_stylesheet: &CSSStyleSheet, - stylerule: Arc>) -> Root { + stylerule: Arc>) -> DomRoot { reflect_dom_object(box CSSStyleRule::new_inherited(parent_stylesheet, stylerule), window, CSSStyleRuleBinding::Wrap) @@ -63,7 +63,7 @@ impl SpecificCSSRule for CSSStyleRule { impl CSSStyleRuleMethods for CSSStyleRule { // https://drafts.csswg.org/cssom/#dom-cssstylerule-style - fn Style(&self) -> Root { + fn Style(&self) -> DomRoot { self.style_decl.or_init(|| { let guard = self.cssrule.shared_lock().read(); CSSStyleDeclaration::new( diff --git a/components/script/dom/cssstylesheet.rs b/components/script/dom/cssstylesheet.rs index 2839708e6076..bf8f34977b16 100644 --- a/components/script/dom/cssstylesheet.rs +++ b/components/script/dom/cssstylesheet.rs @@ -7,7 +7,7 @@ use dom::bindings::codegen::Bindings::CSSStyleSheetBinding::CSSStyleSheetMethods use dom::bindings::codegen::Bindings::WindowBinding::WindowBinding::WindowMethods; use dom::bindings::error::{Error, ErrorResult, Fallible}; use dom::bindings::reflector::{reflect_dom_object, DomObject}; -use dom::bindings::root::{Dom, MutNullableDom, Root}; +use dom::bindings::root::{Dom, DomRoot, MutNullableDom}; use dom::bindings::str::DOMString; use dom::cssrulelist::{CSSRuleList, RulesSource}; use dom::element::Element; @@ -50,13 +50,13 @@ impl CSSStyleSheet { type_: DOMString, href: Option, title: Option, - stylesheet: Arc) -> Root { + stylesheet: Arc) -> DomRoot { reflect_dom_object(box CSSStyleSheet::new_inherited(owner, type_, href, title, stylesheet), window, CSSStyleSheetBinding::Wrap) } - fn rulelist(&self) -> Root { + fn rulelist(&self) -> DomRoot { self.rulelist.or_init(|| { let rules = self.style_stylesheet.contents.rules.clone(); CSSRuleList::new( @@ -92,7 +92,7 @@ impl CSSStyleSheet { impl CSSStyleSheetMethods for CSSStyleSheet { // https://drafts.csswg.org/cssom/#dom-cssstylesheet-cssrules - fn GetCssRules(&self) -> Fallible> { + fn GetCssRules(&self) -> Fallible> { if !self.origin_clean.get() { return Err(Error::Security); } diff --git a/components/script/dom/cssstylevalue.rs b/components/script/dom/cssstylevalue.rs index a2dd60d87883..a498ff7b59de 100644 --- a/components/script/dom/cssstylevalue.rs +++ b/components/script/dom/cssstylevalue.rs @@ -8,7 +8,7 @@ use dom::bindings::codegen::Bindings::CSSStyleValueBinding::CSSStyleValueMethods use dom::bindings::codegen::Bindings::CSSStyleValueBinding::Wrap; use dom::bindings::reflector::Reflector; use dom::bindings::reflector::reflect_dom_object; -use dom::bindings::root::Root; +use dom::bindings::root::DomRoot; use dom::bindings::str::DOMString; use dom::globalscope::GlobalScope; use dom_struct::dom_struct; @@ -28,7 +28,7 @@ impl CSSStyleValue { } } - pub fn new(global: &GlobalScope, value: String) -> Root { + pub fn new(global: &GlobalScope, value: String) -> DomRoot { reflect_dom_object(box CSSStyleValue::new_inherited(value), global, Wrap) } } diff --git a/components/script/dom/csssupportsrule.rs b/components/script/dom/csssupportsrule.rs index 22466c859817..fe42ebba7172 100644 --- a/components/script/dom/csssupportsrule.rs +++ b/components/script/dom/csssupportsrule.rs @@ -6,7 +6,7 @@ use cssparser::{Parser, ParserInput}; use dom::bindings::codegen::Bindings::CSSSupportsRuleBinding; use dom::bindings::codegen::Bindings::WindowBinding::WindowBinding::WindowMethods; use dom::bindings::reflector::{DomObject, reflect_dom_object}; -use dom::bindings::root::Root; +use dom::bindings::root::DomRoot; use dom::bindings::str::DOMString; use dom::cssconditionrule::CSSConditionRule; use dom::cssrule::SpecificCSSRule; @@ -40,7 +40,7 @@ impl CSSSupportsRule { #[allow(unrooted_must_root)] pub fn new(window: &Window, parent_stylesheet: &CSSStyleSheet, - supportsrule: Arc>) -> Root { + supportsrule: Arc>) -> DomRoot { reflect_dom_object(box CSSSupportsRule::new_inherited(parent_stylesheet, supportsrule), window, CSSSupportsRuleBinding::Wrap) diff --git a/components/script/dom/cssviewportrule.rs b/components/script/dom/cssviewportrule.rs index 47528100e83b..afe845a7882b 100644 --- a/components/script/dom/cssviewportrule.rs +++ b/components/script/dom/cssviewportrule.rs @@ -4,7 +4,7 @@ use dom::bindings::codegen::Bindings::CSSViewportRuleBinding; use dom::bindings::reflector::reflect_dom_object; -use dom::bindings::root::Root; +use dom::bindings::root::DomRoot; use dom::bindings::str::DOMString; use dom::cssrule::{CSSRule, SpecificCSSRule}; use dom::cssstylesheet::CSSStyleSheet; @@ -31,7 +31,7 @@ impl CSSViewportRule { #[allow(unrooted_must_root)] pub fn new(window: &Window, parent_stylesheet: &CSSStyleSheet, - viewportrule: Arc>) -> Root { + viewportrule: Arc>) -> DomRoot { reflect_dom_object(box CSSViewportRule::new_inherited(parent_stylesheet, viewportrule), window, CSSViewportRuleBinding::Wrap) diff --git a/components/script/dom/customelementregistry.rs b/components/script/dom/customelementregistry.rs index 503605428ab5..912a4038a81d 100644 --- a/components/script/dom/customelementregistry.rs +++ b/components/script/dom/customelementregistry.rs @@ -14,7 +14,7 @@ use dom::bindings::conversions::{ConversionResult, FromJSValConvertible, Stringi use dom::bindings::error::{Error, ErrorResult, Fallible, report_pending_exception, throw_dom_exception}; use dom::bindings::inheritance::Castable; use dom::bindings::reflector::{DomObject, Reflector, reflect_dom_object}; -use dom::bindings::root::{Dom, Root}; +use dom::bindings::root::{Dom, DomRoot}; use dom::bindings::str::DOMString; use dom::document::Document; use dom::domexception::{DOMErrorName, DOMException}; @@ -67,7 +67,7 @@ impl CustomElementRegistry { } } - pub fn new(window: &Window) -> Root { + pub fn new(window: &Window) -> DomRoot { reflect_dom_object(box CustomElementRegistry::new_inherited(window), window, CustomElementRegistryBinding::Wrap) @@ -304,7 +304,7 @@ impl CustomElementRegistryMethods for CustomElementRegistry { let document = self.window.Document(); // Steps 14-15 - for candidate in document.upcast::().traverse_preorder().filter_map(Root::downcast::) { + for candidate in document.upcast::().traverse_preorder().filter_map(DomRoot::downcast::) { let is = candidate.get_is(); if *candidate.local_name() == local_name && *candidate.namespace() == ns!(html) && @@ -386,7 +386,7 @@ pub struct LifecycleCallbacks { #[derive(Clone, HeapSizeOf, JSTraceable)] pub enum ConstructionStackEntry { - Element(Root), + Element(DomRoot), AlreadyConstructedMarker, } @@ -431,7 +431,7 @@ impl CustomElementDefinition { /// https://dom.spec.whatwg.org/#concept-create-element Step 6.1 #[allow(unsafe_code)] - pub fn create_element(&self, document: &Document, prefix: Option) -> Fallible> { + pub fn create_element(&self, document: &Document, prefix: Option) -> Fallible> { let window = document.window(); let cx = window.get_cx(); // Step 2 @@ -447,7 +447,7 @@ impl CustomElementDefinition { } rooted!(in(cx) let element_val = ObjectValue(element.get())); - let element: Root = match unsafe { Root::from_jsval(cx, element_val.handle(), ()) } { + let element: DomRoot = match unsafe { DomRoot::from_jsval(cx, element_val.handle(), ()) } { Ok(ConversionResult::Success(element)) => element, Ok(ConversionResult::Failure(..)) => return Err(Error::Type("Constructor did not return a DOM node".to_owned())), @@ -504,7 +504,7 @@ pub fn upgrade_element(definition: Rc, element: &Elemen } // Step 5 - definition.construction_stack.borrow_mut().push(ConstructionStackEntry::Element(Root::from_ref(element))); + definition.construction_stack.borrow_mut().push(ConstructionStackEntry::Element(DomRoot::from_ref(element))); // Step 7 let result = run_upgrade_constructor(&definition.constructor, element); @@ -612,7 +612,7 @@ impl CustomElementReaction { pub enum CallbackReaction { Connected, Disconnected, - Adopted(Root, Root), + Adopted(DomRoot, DomRoot), AttributeChanged(LocalName, Option, Option, Namespace), } @@ -795,8 +795,8 @@ impl ElementQueue { self.queue.borrow_mut().clear(); } - fn next_element(&self) -> Option> { - self.queue.borrow_mut().pop_front().as_ref().map(Dom::deref).map(Root::from_ref) + fn next_element(&self) -> Option> { + self.queue.borrow_mut().pop_front().as_ref().map(Dom::deref).map(DomRoot::from_ref) } fn append_element(&self, element: &Element) { diff --git a/components/script/dom/customevent.rs b/components/script/dom/customevent.rs index 938ef8ed4f8a..0c2d0a26a3a8 100644 --- a/components/script/dom/customevent.rs +++ b/components/script/dom/customevent.rs @@ -8,7 +8,7 @@ use dom::bindings::codegen::Bindings::EventBinding::EventMethods; use dom::bindings::error::Fallible; use dom::bindings::inheritance::Castable; use dom::bindings::reflector::reflect_dom_object; -use dom::bindings::root::Root; +use dom::bindings::root::DomRoot; use dom::bindings::str::DOMString; use dom::bindings::trace::RootedTraceableBox; use dom::event::Event; @@ -34,7 +34,7 @@ impl CustomEvent { } } - pub fn new_uninitialized(global: &GlobalScope) -> Root { + pub fn new_uninitialized(global: &GlobalScope) -> DomRoot { reflect_dom_object(box CustomEvent::new_inherited(), global, CustomEventBinding::Wrap) @@ -44,7 +44,7 @@ impl CustomEvent { bubbles: bool, cancelable: bool, detail: HandleValue) - -> Root { + -> DomRoot { let ev = CustomEvent::new_uninitialized(global); ev.init_custom_event(type_, bubbles, cancelable, detail); ev @@ -54,7 +54,7 @@ impl CustomEvent { pub fn Constructor(global: &GlobalScope, type_: DOMString, init: RootedTraceableBox) - -> Fallible> { + -> Fallible> { Ok(CustomEvent::new(global, Atom::from(type_), init.parent.bubbles, diff --git a/components/script/dom/dedicatedworkerglobalscope.rs b/components/script/dom/dedicatedworkerglobalscope.rs index a52738652835..118f2d328874 100644 --- a/components/script/dom/dedicatedworkerglobalscope.rs +++ b/components/script/dom/dedicatedworkerglobalscope.rs @@ -12,7 +12,7 @@ use dom::bindings::codegen::Bindings::DedicatedWorkerGlobalScopeBinding::Dedicat use dom::bindings::error::{ErrorInfo, ErrorResult}; use dom::bindings::inheritance::Castable; use dom::bindings::reflector::DomObject; -use dom::bindings::root::{Root, RootCollection}; +use dom::bindings::root::{DomRoot, RootCollection}; use dom::bindings::str::DOMString; use dom::bindings::structuredclone::StructuredCloneData; use dom::errorevent::ErrorEvent; @@ -131,7 +131,7 @@ impl DedicatedWorkerGlobalScope { timer_event_chan: IpcSender, timer_event_port: Receiver<(TrustedWorkerAddress, TimerEvent)>, closing: Arc) - -> Root { + -> DomRoot { let cx = runtime.cx(); let scope = box DedicatedWorkerGlobalScope::new_inherited(init, worker_url, @@ -387,7 +387,7 @@ impl DedicatedWorkerGlobalScope { #[allow(unsafe_code)] unsafe extern "C" fn interrupt_callback(cx: *mut JSContext) -> bool { let worker = - Root::downcast::(GlobalScope::from_context(cx)) + DomRoot::downcast::(GlobalScope::from_context(cx)) .expect("global is not a worker scope"); assert!(worker.is::()); diff --git a/components/script/dom/dissimilaroriginlocation.rs b/components/script/dom/dissimilaroriginlocation.rs index 249e960ff07e..b75bff7620dd 100644 --- a/components/script/dom/dissimilaroriginlocation.rs +++ b/components/script/dom/dissimilaroriginlocation.rs @@ -7,7 +7,7 @@ use dom::bindings::codegen::Bindings::DissimilarOriginLocationBinding::Dissimila use dom::bindings::error::{Error, ErrorResult, Fallible}; use dom::bindings::reflector::Reflector; use dom::bindings::reflector::reflect_dom_object; -use dom::bindings::root::{Dom, Root}; +use dom::bindings::root::{Dom, DomRoot}; use dom::bindings::str::DOMString; use dom::bindings::str::USVString; use dom::dissimilaroriginwindow::DissimilarOriginWindow; @@ -39,7 +39,7 @@ impl DissimilarOriginLocation { } } - pub fn new(window: &DissimilarOriginWindow) -> Root { + pub fn new(window: &DissimilarOriginWindow) -> DomRoot { reflect_dom_object(box DissimilarOriginLocation::new_inherited(window), window, DissimilarOriginLocationBinding::Wrap) diff --git a/components/script/dom/dissimilaroriginwindow.rs b/components/script/dom/dissimilaroriginwindow.rs index ba1adf00c216..786169f2921a 100644 --- a/components/script/dom/dissimilaroriginwindow.rs +++ b/components/script/dom/dissimilaroriginwindow.rs @@ -6,7 +6,7 @@ use dom::bindings::codegen::Bindings::DissimilarOriginWindowBinding; use dom::bindings::codegen::Bindings::DissimilarOriginWindowBinding::DissimilarOriginWindowMethods; use dom::bindings::error::{Error, ErrorResult}; use dom::bindings::inheritance::Castable; -use dom::bindings::root::{Dom, MutNullableDom, Root}; +use dom::bindings::root::{Dom, DomRoot, MutNullableDom}; use dom::bindings::str::DOMString; use dom::bindings::structuredclone::StructuredCloneData; use dom::dissimilaroriginlocation::DissimilarOriginLocation; @@ -48,7 +48,7 @@ impl DissimilarOriginWindow { pub fn new( global_to_clone_from: &GlobalScope, window_proxy: &WindowProxy, - ) -> Root { + ) -> DomRoot { let cx = global_to_clone_from.get_cx(); // Any timer events fired on this window are ignored. let (timer_event_chan, _) = ipc::channel().unwrap(); @@ -80,42 +80,42 @@ impl DissimilarOriginWindow { impl DissimilarOriginWindowMethods for DissimilarOriginWindow { // https://html.spec.whatwg.org/multipage/#dom-window - fn Window(&self) -> Root { - Root::from_ref(&*self.window_proxy) + fn Window(&self) -> DomRoot { + DomRoot::from_ref(&*self.window_proxy) } // https://html.spec.whatwg.org/multipage/#dom-self - fn Self_(&self) -> Root { - Root::from_ref(&*self.window_proxy) + fn Self_(&self) -> DomRoot { + DomRoot::from_ref(&*self.window_proxy) } // https://html.spec.whatwg.org/multipage/#dom-frames - fn Frames(&self) -> Root { - Root::from_ref(&*self.window_proxy) + fn Frames(&self) -> DomRoot { + DomRoot::from_ref(&*self.window_proxy) } // https://html.spec.whatwg.org/multipage/#dom-parent - fn GetParent(&self) -> Option> { + fn GetParent(&self) -> Option> { // Steps 1-3. if self.window_proxy.is_browsing_context_discarded() { return None; } // Step 4. if let Some(parent) = self.window_proxy.parent() { - return Some(Root::from_ref(parent)); + return Some(DomRoot::from_ref(parent)); } // Step 5. - Some(Root::from_ref(&*self.window_proxy)) + Some(DomRoot::from_ref(&*self.window_proxy)) } // https://html.spec.whatwg.org/multipage/#dom-top - fn GetTop(&self) -> Option> { + fn GetTop(&self) -> Option> { // Steps 1-3. if self.window_proxy.is_browsing_context_discarded() { return None; } // Steps 4-5. - Some(Root::from_ref(self.window_proxy.top())) + Some(DomRoot::from_ref(self.window_proxy.top())) } // https://html.spec.whatwg.org/multipage/#dom-length @@ -184,7 +184,7 @@ impl DissimilarOriginWindowMethods for DissimilarOriginWindow { } // https://html.spec.whatwg.org/multipage/#dom-location - fn Location(&self) -> Root { + fn Location(&self) -> DomRoot { self.location.or_init(|| DissimilarOriginLocation::new(self)) } } diff --git a/components/script/dom/document.rs b/components/script/dom/document.rs index 7b6bd5e793c5..c29314d04c11 100644 --- a/components/script/dom/document.rs +++ b/components/script/dom/document.rs @@ -27,7 +27,7 @@ use dom::bindings::inheritance::{Castable, ElementTypeId, HTMLElementTypeId, Nod use dom::bindings::num::Finite; use dom::bindings::refcounted::{Trusted, TrustedPromise}; use dom::bindings::reflector::{DomObject, reflect_dom_object}; -use dom::bindings::root::{Dom, LayoutDom, MutNullableDom, Root, RootedReference}; +use dom::bindings::root::{Dom, DomRoot, LayoutDom, MutNullableDom, RootedReference}; use dom::bindings::str::{DOMString, USVString}; use dom::bindings::xmlname::{namespace_from_domstring, validate_and_extract, xml_name_type}; use dom::bindings::xmlname::XMLName::InvalidXMLName; @@ -423,7 +423,7 @@ impl Document { /// https://html.spec.whatwg.org/multipage/#concept-document-bc #[inline] - pub fn browsing_context(&self) -> Option> { + pub fn browsing_context(&self) -> Option> { if self.has_browsing_context { self.window.undiscarded_window_proxy() } else { @@ -523,7 +523,7 @@ impl Document { } /// Returns the first `base` element in the DOM that has an `href` attribute. - pub fn base_element(&self) -> Option> { + pub fn base_element(&self) -> Option> { self.base_element.get() } @@ -532,7 +532,7 @@ impl Document { pub fn refresh_base_element(&self) { let base = self.upcast::() .traverse_preorder() - .filter_map(Root::downcast::) + .filter_map(DomRoot::downcast::) .find(|element| element.upcast::().has_attribute(&local_name!("href"))); self.base_element.set(base.r()); } @@ -674,7 +674,7 @@ impl Document { /// Attempt to find a named element in this page's document. /// https://html.spec.whatwg.org/multipage/#the-indicated-part-of-the-document - pub fn find_fragment_node(&self, fragid: &str) -> Option> { + pub fn find_fragment_node(&self, fragid: &str) -> Option> { // Step 1 is not handled here; the fragid is already obtained by the calling function // Step 2: Simply use None to indicate the top of the document. // Step 3 & 4 @@ -730,7 +730,7 @@ impl Document { } } - fn get_anchor_by_name(&self, name: &str) -> Option> { + fn get_anchor_by_name(&self, name: &str) -> Option> { let check_anchor = |node: &HTMLAnchorElement| { let elem = node.upcast::(); elem.get_attribute(&ns!(), &local_name!("name")) @@ -738,9 +738,9 @@ impl Document { }; let doc_node = self.upcast::(); doc_node.traverse_preorder() - .filter_map(Root::downcast) + .filter_map(DomRoot::downcast) .find(|node| check_anchor(&node)) - .map(Root::upcast) + .map(DomRoot::upcast) } // https://html.spec.whatwg.org/multipage/#current-document-readiness @@ -771,7 +771,7 @@ impl Document { /// Return the element that currently has focus. // https://w3c.github.io/uievents/#events-focusevent-doc-focus - pub fn get_focused_element(&self) -> Option> { + pub fn get_focused_element(&self) -> Option> { self.focused.get() } @@ -863,10 +863,10 @@ impl Document { }; let el = match node.downcast::() { - Some(el) => Root::from_ref(el), + Some(el) => DomRoot::from_ref(el), None => { let parent = node.GetParentNode(); - match parent.and_then(Root::downcast::) { + match parent.and_then(DomRoot::downcast::) { Some(parent) => parent, None => return, } @@ -1018,10 +1018,10 @@ impl Document { }; let el = match node.downcast::() { - Some(el) => Root::from_ref(el), + Some(el) => DomRoot::from_ref(el), None => { let parent = node.GetParentNode(); - match parent.and_then(Root::downcast::) { + match parent.and_then(DomRoot::downcast::) { Some(parent) => parent, None => return } @@ -1126,7 +1126,7 @@ impl Document { let maybe_new_target = self.window.hit_test_query(client_point, true).and_then(|address| { let node = unsafe { node::from_untrusted_node_address(js_runtime, address) }; node.inclusive_ancestors() - .filter_map(Root::downcast::) + .filter_map(DomRoot::downcast::) .next() }); @@ -1169,7 +1169,7 @@ impl Document { if !old_target_is_ancestor_of_new_target { for element in old_target.upcast::() .inclusive_ancestors() - .filter_map(Root::downcast::) { + .filter_map(DomRoot::downcast::) { element.set_hover_state(false); element.set_active_state(false); } @@ -1185,7 +1185,7 @@ impl Document { if let Some(ref new_target) = maybe_new_target { for element in new_target.upcast::() .inclusive_ancestors() - .filter_map(Root::downcast::) { + .filter_map(DomRoot::downcast::) { if element.hover_state() { break; } @@ -1229,10 +1229,10 @@ impl Document { None => return TouchEventResult::Processed(false), }; let el = match node.downcast::() { - Some(el) => Root::from_ref(el), + Some(el) => DomRoot::from_ref(el), None => { let parent = node.GetParentNode(); - match parent.and_then(Root::downcast::) { + match parent.and_then(DomRoot::downcast::) { Some(parent) => parent, None => return TouchEventResult::Processed(false), } @@ -1253,7 +1253,7 @@ impl Document { return TouchEventResult::Forwarded; } - let target = Root::upcast::(el); + let target = DomRoot::upcast::(el); let window = &*self.window; let client_x = Finite::wrap(point.x as f64); @@ -1455,21 +1455,21 @@ impl Document { // https://dom.spec.whatwg.org/#converting-nodes-into-a-node pub fn node_from_nodes_and_strings(&self, mut nodes: Vec) - -> Fallible> { + -> Fallible> { if nodes.len() == 1 { Ok(match nodes.pop().unwrap() { NodeOrString::Node(node) => node, - NodeOrString::String(string) => Root::upcast(self.CreateTextNode(string)), + NodeOrString::String(string) => DomRoot::upcast(self.CreateTextNode(string)), }) } else { - let fragment = Root::upcast::(self.CreateDocumentFragment()); + let fragment = DomRoot::upcast::(self.CreateDocumentFragment()); for node in nodes { match node { NodeOrString::Node(node) => { fragment.AppendChild(&node)?; }, NodeOrString::String(string) => { - let node = Root::upcast::(self.CreateTextNode(string)); + let node = DomRoot::upcast::(self.CreateTextNode(string)); // No try!() here because appending a text node // should not fail. fragment.AppendChild(&node).unwrap(); @@ -1481,7 +1481,7 @@ impl Document { } pub fn get_body_attribute(&self, local_name: &LocalName) -> DOMString { - match self.GetBody().and_then(Root::downcast::) { + match self.GetBody().and_then(DomRoot::downcast::) { Some(ref body) => { body.upcast::().get_string_attribute(local_name) }, @@ -1490,7 +1490,7 @@ impl Document { } pub fn set_body_attribute(&self, local_name: &LocalName, value: DOMString) { - if let Some(ref body) = self.GetBody().and_then(Root::downcast::) { + if let Some(ref body) = self.GetBody().and_then(DomRoot::downcast::) { let body = body.upcast::(); let value = body.parse_attribute(&ns!(), &local_name, value); body.set_attribute(local_name, value); @@ -1948,19 +1948,19 @@ impl Document { self.current_parser.set(script); } - pub fn get_current_parser(&self) -> Option> { + pub fn get_current_parser(&self) -> Option> { self.current_parser.get() } /// Iterate over all iframes in the document. - pub fn iter_iframes(&self) -> impl Iterator> { + pub fn iter_iframes(&self) -> impl Iterator> { self.upcast::() .traverse_preorder() - .filter_map(Root::downcast::) + .filter_map(DomRoot::downcast::) } /// Find an iframe element in the document. - pub fn find_iframe(&self, browsing_context_id: BrowsingContextId) -> Option> { + pub fn find_iframe(&self, browsing_context_id: BrowsingContextId) -> Option> { self.iter_iframes() .find(|node| node.browsing_context_id() == Some(browsing_context_id)) } @@ -1968,7 +1968,7 @@ impl Document { /// Find a mozbrowser iframe element in the document. pub fn find_mozbrowser_iframe(&self, top_level_browsing_context_id: TopLevelBrowsingContextId) - -> Option> + -> Option> { match self.find_iframe(BrowsingContextId::from(top_level_browsing_context_id)) { None => None, @@ -2310,7 +2310,7 @@ impl Document { } // https://dom.spec.whatwg.org/#dom-document-document - pub fn Constructor(window: &Window) -> Fallible> { + pub fn Constructor(window: &Window) -> Fallible> { let doc = window.Document(); let docloader = DocumentLoader::new(&*doc.loader()); Ok(Document::new(window, @@ -2339,7 +2339,7 @@ impl Document { doc_loader: DocumentLoader, referrer: Option, referrer_policy: Option) - -> Root { + -> DomRoot { let document = reflect_dom_object(box Document::new_inherited(window, has_browsing_context, url, @@ -2361,7 +2361,7 @@ impl Document { document } - fn create_node_list bool>(&self, callback: F) -> Root { + fn create_node_list bool>(&self, callback: F) -> DomRoot { let doc = self.GetDocumentElement(); let maybe_node = doc.r().map(Castable::upcast::); let iter = maybe_node.iter() @@ -2370,8 +2370,8 @@ impl Document { NodeList::new_simple_list(&self.window, iter) } - fn get_html_element(&self) -> Option> { - self.GetDocumentElement().and_then(Root::downcast) + fn get_html_element(&self) -> Option> { + self.GetDocumentElement().and_then(DomRoot::downcast) } /// Return a reference to the per-document shared lock used in stylesheets. @@ -2482,7 +2482,7 @@ impl Document { self.stylesheets.borrow().len() } - pub fn stylesheet_at(&self, index: usize) -> Option> { + pub fn stylesheet_at(&self, index: usize) -> Option> { let stylesheets = self.stylesheets.borrow(); stylesheets.get(Origin::Author, index).and_then(|s| { @@ -2491,7 +2491,7 @@ impl Document { } /// https://html.spec.whatwg.org/multipage/#appropriate-template-contents-owner-document - pub fn appropriate_template_contents_owner_document(&self) -> Root { + pub fn appropriate_template_contents_owner_document(&self) -> DomRoot { self.appropriate_template_contents_owner_document.or_init(|| { let doctype = if self.is_html_document { IsHTMLDocument::HTMLDocument @@ -2516,8 +2516,8 @@ impl Document { }) } - pub fn get_element_by_id(&self, id: &Atom) -> Option> { - self.id_map.borrow().get(&id).map(|ref elements| Root::from_ref(&*(*elements)[0])) + pub fn get_element_by_id(&self, id: &Atom) -> Option> { + self.id_map.borrow().get(&id).map(|ref elements| DomRoot::from_ref(&*(*elements)[0])) } pub fn ensure_pending_restyle(&self, el: &Element) -> RefMut { @@ -2747,12 +2747,12 @@ impl Element { impl DocumentMethods for Document { // https://drafts.csswg.org/cssom/#dom-document-stylesheets - fn StyleSheets(&self) -> Root { + fn StyleSheets(&self) -> DomRoot { self.stylesheet_list.or_init(|| StyleSheetList::new(&self.window, Dom::from_ref(&self))) } // https://dom.spec.whatwg.org/#dom-document-implementation - fn Implementation(&self) -> Root { + fn Implementation(&self) -> DomRoot { self.implementation.or_init(|| DOMImplementation::new(self)) } @@ -2762,13 +2762,13 @@ impl DocumentMethods for Document { } // https://html.spec.whatwg.org/multipage/#dom-document-activeelement - fn GetActiveElement(&self) -> Option> { + fn GetActiveElement(&self) -> Option> { // TODO: Step 2. match self.get_focused_element() { Some(element) => Some(element), // Step 3. and 4. None => match self.GetBody() { // Step 5. - Some(body) => Some(Root::upcast(body)), + Some(body) => Some(DomRoot::upcast(body)), None => self.GetDocumentElement(), }, } @@ -2899,20 +2899,20 @@ impl DocumentMethods for Document { } // https://dom.spec.whatwg.org/#dom-document-doctype - fn GetDoctype(&self) -> Option> { - self.upcast::().children().filter_map(Root::downcast).next() + fn GetDoctype(&self) -> Option> { + self.upcast::().children().filter_map(DomRoot::downcast).next() } // https://dom.spec.whatwg.org/#dom-document-documentelement - fn GetDocumentElement(&self) -> Option> { + fn GetDocumentElement(&self) -> Option> { self.upcast::().child_elements().next() } // https://dom.spec.whatwg.org/#dom-document-getelementsbytagname - fn GetElementsByTagName(&self, qualified_name: DOMString) -> Root { + fn GetElementsByTagName(&self, qualified_name: DOMString) -> DomRoot { let qualified_name = LocalName::from(&*qualified_name); match self.tag_map.borrow_mut().entry(qualified_name.clone()) { - Occupied(entry) => Root::from_ref(entry.get()), + Occupied(entry) => DomRoot::from_ref(entry.get()), Vacant(entry) => { let result = HTMLCollection::by_qualified_name( &self.window, self.upcast(), qualified_name); @@ -2926,12 +2926,12 @@ impl DocumentMethods for Document { fn GetElementsByTagNameNS(&self, maybe_ns: Option, tag_name: DOMString) - -> Root { + -> DomRoot { let ns = namespace_from_domstring(maybe_ns); let local = LocalName::from(tag_name); let qname = QualName::new(None, ns, local); match self.tagns_map.borrow_mut().entry(qname.clone()) { - Occupied(entry) => Root::from_ref(entry.get()), + Occupied(entry) => DomRoot::from_ref(entry.get()), Vacant(entry) => { let result = HTMLCollection::by_qual_tag_name(&self.window, self.upcast(), qname); entry.insert(Dom::from_ref(&*result)); @@ -2941,12 +2941,12 @@ impl DocumentMethods for Document { } // https://dom.spec.whatwg.org/#dom-document-getelementsbyclassname - fn GetElementsByClassName(&self, classes: DOMString) -> Root { + fn GetElementsByClassName(&self, classes: DOMString) -> DomRoot { let class_atoms: Vec = split_html_space_chars(&classes) .map(Atom::from) .collect(); match self.classes_map.borrow_mut().entry(class_atoms.clone()) { - Occupied(entry) => Root::from_ref(entry.get()), + Occupied(entry) => DomRoot::from_ref(entry.get()), Vacant(entry) => { let result = HTMLCollection::by_atomic_class_name(&self.window, self.upcast(), @@ -2958,7 +2958,7 @@ impl DocumentMethods for Document { } // https://dom.spec.whatwg.org/#dom-nonelementparentnode-getelementbyid - fn GetElementById(&self, id: DOMString) -> Option> { + fn GetElementById(&self, id: DOMString) -> Option> { self.get_element_by_id(&Atom::from(id)) } @@ -2966,7 +2966,7 @@ impl DocumentMethods for Document { fn CreateElement(&self, mut local_name: DOMString, options: &ElementCreationOptions) - -> Fallible> { + -> Fallible> { if xml_name_type(&local_name) == InvalidXMLName { debug!("Not a valid element name"); return Err(Error::InvalidCharacter); @@ -2991,7 +2991,7 @@ impl DocumentMethods for Document { namespace: Option, qualified_name: DOMString, options: &ElementCreationOptions) - -> Fallible> { + -> Fallible> { let (namespace, prefix, local_name) = validate_and_extract(namespace, &qualified_name)?; let name = QualName::new(prefix, namespace, local_name); @@ -3000,7 +3000,7 @@ impl DocumentMethods for Document { } // https://dom.spec.whatwg.org/#dom-document-createattribute - fn CreateAttribute(&self, mut local_name: DOMString) -> Fallible> { + fn CreateAttribute(&self, mut local_name: DOMString) -> Fallible> { if xml_name_type(&local_name) == InvalidXMLName { debug!("Not a valid element name"); return Err(Error::InvalidCharacter); @@ -3018,7 +3018,7 @@ impl DocumentMethods for Document { fn CreateAttributeNS(&self, namespace: Option, qualified_name: DOMString) - -> Fallible> { + -> Fallible> { let (namespace, prefix, local_name) = validate_and_extract(namespace, &qualified_name)?; let value = AttrValue::String("".to_owned()); @@ -3033,17 +3033,17 @@ impl DocumentMethods for Document { } // https://dom.spec.whatwg.org/#dom-document-createdocumentfragment - fn CreateDocumentFragment(&self) -> Root { + fn CreateDocumentFragment(&self) -> DomRoot { DocumentFragment::new(self) } // https://dom.spec.whatwg.org/#dom-document-createtextnode - fn CreateTextNode(&self, data: DOMString) -> Root { + fn CreateTextNode(&self, data: DOMString) -> DomRoot { Text::new(data, self) } // https://dom.spec.whatwg.org/#dom-document-createcomment - fn CreateComment(&self, data: DOMString) -> Root { + fn CreateComment(&self, data: DOMString) -> DomRoot { Comment::new(data, self) } @@ -3051,7 +3051,7 @@ impl DocumentMethods for Document { fn CreateProcessingInstruction(&self, target: DOMString, data: DOMString) - -> Fallible> { + -> Fallible> { // Step 1. if xml_name_type(&target) == InvalidXMLName { return Err(Error::InvalidCharacter); @@ -3067,7 +3067,7 @@ impl DocumentMethods for Document { } // https://dom.spec.whatwg.org/#dom-document-importnode - fn ImportNode(&self, node: &Node, deep: bool) -> Fallible> { + fn ImportNode(&self, node: &Node, deep: bool) -> Fallible> { // Step 1. if node.is::() { return Err(Error::NotSupported); @@ -3084,7 +3084,7 @@ impl DocumentMethods for Document { } // https://dom.spec.whatwg.org/#dom-document-adoptnode - fn AdoptNode(&self, node: &Node) -> Fallible> { + fn AdoptNode(&self, node: &Node) -> Fallible> { // Step 1. if node.is::() { return Err(Error::NotSupported); @@ -3094,44 +3094,44 @@ impl DocumentMethods for Document { Node::adopt(node, self); // Step 3. - Ok(Root::from_ref(node)) + Ok(DomRoot::from_ref(node)) } // https://dom.spec.whatwg.org/#dom-document-createevent - fn CreateEvent(&self, mut interface: DOMString) -> Fallible> { + fn CreateEvent(&self, mut interface: DOMString) -> Fallible> { interface.make_ascii_lowercase(); match &*interface { "beforeunloadevent" => - Ok(Root::upcast(BeforeUnloadEvent::new_uninitialized(&self.window))), + Ok(DomRoot::upcast(BeforeUnloadEvent::new_uninitialized(&self.window))), "closeevent" => - Ok(Root::upcast(CloseEvent::new_uninitialized(self.window.upcast()))), + Ok(DomRoot::upcast(CloseEvent::new_uninitialized(self.window.upcast()))), "customevent" => - Ok(Root::upcast(CustomEvent::new_uninitialized(self.window.upcast()))), + Ok(DomRoot::upcast(CustomEvent::new_uninitialized(self.window.upcast()))), "errorevent" => - Ok(Root::upcast(ErrorEvent::new_uninitialized(self.window.upcast()))), + Ok(DomRoot::upcast(ErrorEvent::new_uninitialized(self.window.upcast()))), "events" | "event" | "htmlevents" | "svgevents" => Ok(Event::new_uninitialized(&self.window.upcast())), "focusevent" => - Ok(Root::upcast(FocusEvent::new_uninitialized(&self.window))), + Ok(DomRoot::upcast(FocusEvent::new_uninitialized(&self.window))), "hashchangeevent" => - Ok(Root::upcast(HashChangeEvent::new_uninitialized(&self.window))), + Ok(DomRoot::upcast(HashChangeEvent::new_uninitialized(&self.window))), "keyboardevent" => - Ok(Root::upcast(KeyboardEvent::new_uninitialized(&self.window))), + Ok(DomRoot::upcast(KeyboardEvent::new_uninitialized(&self.window))), "messageevent" => - Ok(Root::upcast(MessageEvent::new_uninitialized(self.window.upcast()))), + Ok(DomRoot::upcast(MessageEvent::new_uninitialized(self.window.upcast()))), "mouseevent" | "mouseevents" => - Ok(Root::upcast(MouseEvent::new_uninitialized(&self.window))), + Ok(DomRoot::upcast(MouseEvent::new_uninitialized(&self.window))), "pagetransitionevent" => - Ok(Root::upcast(PageTransitionEvent::new_uninitialized(&self.window))), + Ok(DomRoot::upcast(PageTransitionEvent::new_uninitialized(&self.window))), "popstateevent" => - Ok(Root::upcast(PopStateEvent::new_uninitialized(&self.window))), + Ok(DomRoot::upcast(PopStateEvent::new_uninitialized(&self.window))), "progressevent" => - Ok(Root::upcast(ProgressEvent::new_uninitialized(self.window.upcast()))), + Ok(DomRoot::upcast(ProgressEvent::new_uninitialized(self.window.upcast()))), "storageevent" => { - Ok(Root::upcast(StorageEvent::new_uninitialized(&self.window, "".into()))) + Ok(DomRoot::upcast(StorageEvent::new_uninitialized(&self.window, "".into()))) }, "touchevent" => - Ok(Root::upcast( + Ok(DomRoot::upcast( TouchEvent::new_uninitialized(&self.window, &TouchList::new(&self.window, &[]), &TouchList::new(&self.window, &[]), @@ -3139,9 +3139,9 @@ impl DocumentMethods for Document { ) )), "uievent" | "uievents" => - Ok(Root::upcast(UIEvent::new_uninitialized(&self.window))), + Ok(DomRoot::upcast(UIEvent::new_uninitialized(&self.window))), "webglcontextevent" => - Ok(Root::upcast(WebGLContextEvent::new_uninitialized(&self.window))), + Ok(DomRoot::upcast(WebGLContextEvent::new_uninitialized(&self.window))), _ => Err(Error::NotSupported), } @@ -3156,7 +3156,7 @@ impl DocumentMethods for Document { } // https://dom.spec.whatwg.org/#dom-document-createrange - fn CreateRange(&self) -> Root { + fn CreateRange(&self) -> DomRoot { Range::new_with_doc(self) } @@ -3165,7 +3165,7 @@ impl DocumentMethods for Document { root: &Node, what_to_show: u32, filter: Option>) - -> Root { + -> DomRoot { NodeIterator::new(self, root, what_to_show, filter) } @@ -3178,7 +3178,7 @@ impl DocumentMethods for Document { page_y: Finite, screen_x: Finite, screen_y: Finite) - -> Root { + -> DomRoot { let client_x = Finite::wrap(*page_x - window.PageXOffset() as f64); let client_y = Finite::wrap(*page_y - window.PageYOffset() as f64); Touch::new(window, @@ -3193,7 +3193,7 @@ impl DocumentMethods for Document { } // https://w3c.github.io/touch-events/#idl-def-document-createtouchlist(touch...) - fn CreateTouchList(&self, touches: &[&Touch]) -> Root { + fn CreateTouchList(&self, touches: &[&Touch]) -> DomRoot { TouchList::new(&self.window, &touches) } @@ -3202,7 +3202,7 @@ impl DocumentMethods for Document { root: &Node, what_to_show: u32, filter: Option>) - -> Root { + -> DomRoot { TreeWalker::new(self, root, what_to_show, filter) } @@ -3216,7 +3216,7 @@ impl DocumentMethods for Document { .find(|node| { node.namespace() == &ns!(svg) && node.local_name() == &local_name!("title") }) - .map(Root::upcast::) + .map(DomRoot::upcast::) } else { // Step 2. root.upcast::() @@ -3247,7 +3247,7 @@ impl DocumentMethods for Document { node.namespace() == &ns!(svg) && node.local_name() == &local_name!("title") }); match elem { - Some(elem) => Root::upcast::(elem), + Some(elem) => DomRoot::upcast::(elem), None => { let name = QualName::new(None, ns!(svg), local_name!("title")); let elem = Element::create(name, @@ -3292,18 +3292,18 @@ impl DocumentMethods for Document { } // https://html.spec.whatwg.org/multipage/#dom-document-head - fn GetHead(&self) -> Option> { + fn GetHead(&self) -> Option> { self.get_html_element() - .and_then(|root| root.upcast::().children().filter_map(Root::downcast).next()) + .and_then(|root| root.upcast::().children().filter_map(DomRoot::downcast).next()) } // https://html.spec.whatwg.org/multipage/#dom-document-currentscript - fn GetCurrentScript(&self) -> Option> { + fn GetCurrentScript(&self) -> Option> { self.current_script.get() } // https://html.spec.whatwg.org/multipage/#dom-document-body - fn GetBody(&self) -> Option> { + fn GetBody(&self) -> Option> { self.get_html_element().and_then(|root| { let node = root.upcast::(); node.children().find(|child| { @@ -3312,7 +3312,7 @@ impl DocumentMethods for Document { NodeTypeId::Element(ElementTypeId::HTMLElement(HTMLElementTypeId::HTMLFrameSetElement)) => true, _ => false } - }).map(|node| Root::downcast(node).unwrap()) + }).map(|node| DomRoot::downcast(node).unwrap()) }) } @@ -3357,7 +3357,7 @@ impl DocumentMethods for Document { } // https://html.spec.whatwg.org/multipage/#dom-document-getelementsbyname - fn GetElementsByName(&self, name: DOMString) -> Root { + fn GetElementsByName(&self, name: DOMString) -> DomRoot { self.create_node_list(|node| { let element = match node.downcast::() { Some(element) => element, @@ -3372,7 +3372,7 @@ impl DocumentMethods for Document { } // https://html.spec.whatwg.org/multipage/#dom-document-images - fn Images(&self) -> Root { + fn Images(&self) -> DomRoot { self.images.or_init(|| { let filter = box ImagesFilter; HTMLCollection::create(&self.window, self.upcast(), filter) @@ -3380,7 +3380,7 @@ impl DocumentMethods for Document { } // https://html.spec.whatwg.org/multipage/#dom-document-embeds - fn Embeds(&self) -> Root { + fn Embeds(&self) -> DomRoot { self.embeds.or_init(|| { let filter = box EmbedsFilter; HTMLCollection::create(&self.window, self.upcast(), filter) @@ -3388,12 +3388,12 @@ impl DocumentMethods for Document { } // https://html.spec.whatwg.org/multipage/#dom-document-plugins - fn Plugins(&self) -> Root { + fn Plugins(&self) -> DomRoot { self.Embeds() } // https://html.spec.whatwg.org/multipage/#dom-document-links - fn Links(&self) -> Root { + fn Links(&self) -> DomRoot { self.links.or_init(|| { let filter = box LinksFilter; HTMLCollection::create(&self.window, self.upcast(), filter) @@ -3401,7 +3401,7 @@ impl DocumentMethods for Document { } // https://html.spec.whatwg.org/multipage/#dom-document-forms - fn Forms(&self) -> Root { + fn Forms(&self) -> DomRoot { self.forms.or_init(|| { let filter = box FormsFilter; HTMLCollection::create(&self.window, self.upcast(), filter) @@ -3409,7 +3409,7 @@ impl DocumentMethods for Document { } // https://html.spec.whatwg.org/multipage/#dom-document-scripts - fn Scripts(&self) -> Root { + fn Scripts(&self) -> DomRoot { self.scripts.or_init(|| { let filter = box ScriptsFilter; HTMLCollection::create(&self.window, self.upcast(), filter) @@ -3417,7 +3417,7 @@ impl DocumentMethods for Document { } // https://html.spec.whatwg.org/multipage/#dom-document-anchors - fn Anchors(&self) -> Root { + fn Anchors(&self) -> DomRoot { self.anchors.or_init(|| { let filter = box AnchorsFilter; HTMLCollection::create(&self.window, self.upcast(), filter) @@ -3425,7 +3425,7 @@ impl DocumentMethods for Document { } // https://html.spec.whatwg.org/multipage/#dom-document-applets - fn Applets(&self) -> Root { + fn Applets(&self) -> DomRoot { // FIXME: This should be return OBJECT elements containing applets. self.applets.or_init(|| { let filter = box AppletsFilter; @@ -3434,7 +3434,7 @@ impl DocumentMethods for Document { } // https://html.spec.whatwg.org/multipage/#dom-document-location - fn GetLocation(&self) -> Option> { + fn GetLocation(&self) -> Option> { if self.is_fully_active() { Some(self.window.Location()) } else { @@ -3443,18 +3443,18 @@ impl DocumentMethods for Document { } // https://dom.spec.whatwg.org/#dom-parentnode-children - fn Children(&self) -> Root { + fn Children(&self) -> DomRoot { HTMLCollection::children(&self.window, self.upcast()) } // https://dom.spec.whatwg.org/#dom-parentnode-firstelementchild - fn GetFirstElementChild(&self) -> Option> { + fn GetFirstElementChild(&self) -> Option> { self.upcast::().child_elements().next() } // https://dom.spec.whatwg.org/#dom-parentnode-lastelementchild - fn GetLastElementChild(&self) -> Option> { - self.upcast::().rev_children().filter_map(Root::downcast).next() + fn GetLastElementChild(&self) -> Option> { + self.upcast::().rev_children().filter_map(DomRoot::downcast).next() } // https://dom.spec.whatwg.org/#dom-parentnode-childelementcount @@ -3473,13 +3473,13 @@ impl DocumentMethods for Document { } // https://dom.spec.whatwg.org/#dom-parentnode-queryselector - fn QuerySelector(&self, selectors: DOMString) -> Fallible>> { + fn QuerySelector(&self, selectors: DOMString) -> Fallible>> { let root = self.upcast::(); root.query_selector(selectors) } // https://dom.spec.whatwg.org/#dom-parentnode-queryselectorall - fn QuerySelectorAll(&self, selectors: DOMString) -> Fallible> { + fn QuerySelectorAll(&self, selectors: DOMString) -> Fallible> { let root = self.upcast::(); root.query_selector_all(selectors) } @@ -3490,9 +3490,9 @@ impl DocumentMethods for Document { } // https://html.spec.whatwg.org/multipage/#dom-document-defaultview - fn GetDefaultView(&self) -> Option> { + fn GetDefaultView(&self) -> Option> { if self.has_browsing_context { - Some(Root::from_ref(&*self.window)) + Some(DomRoot::from_ref(&*self.window)) } else { None } @@ -3673,7 +3673,7 @@ impl DocumentMethods for Document { #[allow(unsafe_code)] // https://drafts.csswg.org/cssom-view/#dom-document-elementfrompoint - fn ElementFromPoint(&self, x: Finite, y: Finite) -> Option> { + fn ElementFromPoint(&self, x: Finite, y: Finite) -> Option> { let x = *x as f32; let y = *y as f32; let point = &Point2D::new(x, y); @@ -3700,7 +3700,7 @@ impl DocumentMethods for Document { parent_node.downcast::().unwrap() }); - Some(Root::from_ref(element_ref)) + Some(DomRoot::from_ref(element_ref)) }, None => self.GetDocumentElement() } @@ -3708,7 +3708,7 @@ impl DocumentMethods for Document { #[allow(unsafe_code)] // https://drafts.csswg.org/cssom-view/#dom-document-elementsfrompoint - fn ElementsFromPoint(&self, x: Finite, y: Finite) -> Vec> { + fn ElementsFromPoint(&self, x: Finite, y: Finite) -> Vec> { let x = *x as f32; let y = *y as f32; let point = &Point2D::new(x, y); @@ -3727,12 +3727,12 @@ impl DocumentMethods for Document { let js_runtime = unsafe { JS_GetRuntime(window.get_cx()) }; // Step 1 and Step 3 - let mut elements: Vec> = self.nodes_from_point(point).iter() + let mut elements: Vec> = self.nodes_from_point(point).iter() .flat_map(|&untrusted_node_address| { let node = unsafe { node::from_untrusted_node_address(js_runtime, untrusted_node_address) }; - Root::downcast::(node) + DomRoot::downcast::(node) }).collect(); // Step 4 @@ -3747,7 +3747,7 @@ impl DocumentMethods for Document { } // https://html.spec.whatwg.org/multipage/#dom-document-open - fn Open(&self, type_: DOMString, replace: DOMString) -> Fallible> { + fn Open(&self, type_: DOMString, replace: DOMString) -> Fallible> { if !self.is_html_document() { // Step 1. return Err(Error::InvalidState); @@ -3758,7 +3758,7 @@ impl DocumentMethods for Document { if !self.is_active() { // Step 3. - return Ok(Root::from_ref(self)); + return Ok(DomRoot::from_ref(self)); } let entry_responsible_document = GlobalScope::entry().as_window().Document(); @@ -3773,7 +3773,7 @@ impl DocumentMethods for Document { if self.get_current_parser().map_or(false, |parser| parser.script_nesting_level() > 0) { // Step 5. - return Ok(Root::from_ref(self)); + return Ok(DomRoot::from_ref(self)); } // Step 6. @@ -3889,7 +3889,7 @@ impl DocumentMethods for Document { // Step 34 is handled when creating the parser in step 25. // Step 35. - Ok(Root::from_ref(self)) + Ok(DomRoot::from_ref(self)) } // https://html.spec.whatwg.org/multipage/#dom-document-write @@ -3907,7 +3907,7 @@ impl DocumentMethods for Document { } let parser = match self.get_current_parser() { - Some(ref parser) if parser.can_write() => Root::from_ref(&**parser), + Some(ref parser) if parser.can_write() => DomRoot::from_ref(&**parser), _ => { // Either there is no parser, which means the parsing ended; // or script nesting level is 0, which means the method was @@ -3950,7 +3950,7 @@ impl DocumentMethods for Document { // TODO: handle throw-on-dynamic-markup-insertion counter. let parser = match self.get_current_parser() { - Some(ref parser) if parser.is_script_created() => Root::from_ref(&**parser), + Some(ref parser) if parser.is_script_created() => DomRoot::from_ref(&**parser), _ => { // Step 3. return Ok(()); @@ -3983,7 +3983,7 @@ impl DocumentMethods for Document { } // https://fullscreen.spec.whatwg.org/#dom-document-fullscreenelement - fn GetFullscreenElement(&self) -> Option> { + fn GetFullscreenElement(&self) -> Option> { // TODO ShadowRoot self.fullscreen_element.get() } @@ -4099,7 +4099,7 @@ impl PendingInOrderScriptVec { entry.loaded(result); } - fn take_next_ready_to_be_executed(&self) -> Option<(Root, ScriptResult)> { + fn take_next_ready_to_be_executed(&self) -> Option<(DomRoot, ScriptResult)> { let mut scripts = self.scripts.borrow_mut(); let pair = scripts.front_mut().and_then(PendingScript::take_result); if pair.is_none() { @@ -4135,7 +4135,7 @@ impl PendingScript { self.load = Some(result); } - fn take_result(&mut self) -> Option<(Root, ScriptResult)> { - self.load.take().map(|result| (Root::from_ref(&*self.element), result)) + fn take_result(&mut self) -> Option<(DomRoot, ScriptResult)> { + self.load.take().map(|result| (DomRoot::from_ref(&*self.element), result)) } } diff --git a/components/script/dom/documentfragment.rs b/components/script/dom/documentfragment.rs index f43d93f85176..320d33416915 100644 --- a/components/script/dom/documentfragment.rs +++ b/components/script/dom/documentfragment.rs @@ -8,7 +8,7 @@ use dom::bindings::codegen::Bindings::WindowBinding::WindowMethods; use dom::bindings::codegen::UnionTypes::NodeOrString; use dom::bindings::error::{ErrorResult, Fallible}; use dom::bindings::inheritance::Castable; -use dom::bindings::root::Root; +use dom::bindings::root::DomRoot; use dom::bindings::str::DOMString; use dom::document::Document; use dom::element::Element; @@ -33,13 +33,13 @@ impl DocumentFragment { } } - pub fn new(document: &Document) -> Root { + pub fn new(document: &Document) -> DomRoot { Node::reflect_node(box DocumentFragment::new_inherited(document), document, DocumentFragmentBinding::Wrap) } - pub fn Constructor(window: &Window) -> Fallible> { + pub fn Constructor(window: &Window) -> Fallible> { let document = window.Document(); Ok(DocumentFragment::new(&document)) @@ -48,16 +48,16 @@ impl DocumentFragment { impl DocumentFragmentMethods for DocumentFragment { // https://dom.spec.whatwg.org/#dom-parentnode-children - fn Children(&self) -> Root { + fn Children(&self) -> DomRoot { let window = window_from_node(self); HTMLCollection::children(&window, self.upcast()) } // https://dom.spec.whatwg.org/#dom-nonelementparentnode-getelementbyid - fn GetElementById(&self, id: DOMString) -> Option> { + fn GetElementById(&self, id: DOMString) -> Option> { let node = self.upcast::(); let id = Atom::from(id); - node.traverse_preorder().filter_map(Root::downcast::).find(|descendant| { + node.traverse_preorder().filter_map(DomRoot::downcast::).find(|descendant| { match descendant.get_attribute(&ns!(), &local_name!("id")) { None => false, Some(attr) => *attr.value().as_atom() == id, @@ -66,13 +66,13 @@ impl DocumentFragmentMethods for DocumentFragment { } // https://dom.spec.whatwg.org/#dom-parentnode-firstelementchild - fn GetFirstElementChild(&self) -> Option> { + fn GetFirstElementChild(&self) -> Option> { self.upcast::().child_elements().next() } // https://dom.spec.whatwg.org/#dom-parentnode-lastelementchild - fn GetLastElementChild(&self) -> Option> { - self.upcast::().rev_children().filter_map(Root::downcast::).next() + fn GetLastElementChild(&self) -> Option> { + self.upcast::().rev_children().filter_map(DomRoot::downcast::).next() } // https://dom.spec.whatwg.org/#dom-parentnode-childelementcount @@ -91,12 +91,12 @@ impl DocumentFragmentMethods for DocumentFragment { } // https://dom.spec.whatwg.org/#dom-parentnode-queryselector - fn QuerySelector(&self, selectors: DOMString) -> Fallible>> { + fn QuerySelector(&self, selectors: DOMString) -> Fallible>> { self.upcast::().query_selector(selectors) } // https://dom.spec.whatwg.org/#dom-parentnode-queryselectorall - fn QuerySelectorAll(&self, selectors: DOMString) -> Fallible> { + fn QuerySelectorAll(&self, selectors: DOMString) -> Fallible> { self.upcast::().query_selector_all(selectors) } } diff --git a/components/script/dom/documenttype.rs b/components/script/dom/documenttype.rs index 4eb83c39c916..5fd83343570c 100644 --- a/components/script/dom/documenttype.rs +++ b/components/script/dom/documenttype.rs @@ -7,7 +7,7 @@ use dom::bindings::codegen::Bindings::DocumentTypeBinding::DocumentTypeMethods; use dom::bindings::codegen::UnionTypes::NodeOrString; use dom::bindings::error::ErrorResult; use dom::bindings::inheritance::Castable; -use dom::bindings::root::Root; +use dom::bindings::root::DomRoot; use dom::bindings::str::DOMString; use dom::document::Document; use dom::node::Node; @@ -41,7 +41,7 @@ impl DocumentType { public_id: Option, system_id: Option, document: &Document) - -> Root { + -> DomRoot { Node::reflect_node(box DocumentType::new_inherited(name, public_id, system_id, document), document, DocumentTypeBinding::Wrap) diff --git a/components/script/dom/domexception.rs b/components/script/dom/domexception.rs index 933818e1a4fc..c9fc953950af 100644 --- a/components/script/dom/domexception.rs +++ b/components/script/dom/domexception.rs @@ -6,7 +6,7 @@ use dom::bindings::codegen::Bindings::DOMExceptionBinding; use dom::bindings::codegen::Bindings::DOMExceptionBinding::DOMExceptionConstants; use dom::bindings::codegen::Bindings::DOMExceptionBinding::DOMExceptionMethods; use dom::bindings::reflector::{Reflector, reflect_dom_object}; -use dom::bindings::root::Root; +use dom::bindings::root::DomRoot; use dom::bindings::str::DOMString; use dom::globalscope::GlobalScope; use dom_struct::dom_struct; @@ -51,7 +51,7 @@ impl DOMException { } } - pub fn new(global: &GlobalScope, code: DOMErrorName) -> Root { + pub fn new(global: &GlobalScope, code: DOMErrorName) -> DomRoot { reflect_dom_object(box DOMException::new_inherited(code), global, DOMExceptionBinding::Wrap) diff --git a/components/script/dom/domimplementation.rs b/components/script/dom/domimplementation.rs index 189a10412c35..93ba4b287ff2 100644 --- a/components/script/dom/domimplementation.rs +++ b/components/script/dom/domimplementation.rs @@ -10,7 +10,7 @@ use dom::bindings::codegen::Bindings::NodeBinding::NodeMethods; use dom::bindings::error::Fallible; use dom::bindings::inheritance::Castable; use dom::bindings::reflector::{Reflector, reflect_dom_object}; -use dom::bindings::root::{Dom, Root}; +use dom::bindings::root::{Dom, DomRoot}; use dom::bindings::str::DOMString; use dom::bindings::xmlname::{namespace_from_domstring, validate_qualified_name}; use dom::document::{Document, HasBrowsingContext, IsHTMLDocument}; @@ -41,7 +41,7 @@ impl DOMImplementation { } } - pub fn new(document: &Document) -> Root { + pub fn new(document: &Document) -> DomRoot { let window = document.window(); reflect_dom_object(box DOMImplementation::new_inherited(document), window, @@ -56,7 +56,7 @@ impl DOMImplementationMethods for DOMImplementation { qualified_name: DOMString, pubid: DOMString, sysid: DOMString) - -> Fallible> { + -> Fallible> { validate_qualified_name(&qualified_name)?; Ok(DocumentType::new(qualified_name, Some(pubid), Some(sysid), &self.document)) } @@ -66,7 +66,7 @@ impl DOMImplementationMethods for DOMImplementation { maybe_namespace: Option, qname: DOMString, maybe_doctype: Option<&DocumentType>) - -> Fallible> { + -> Fallible> { let win = self.document.window(); let loader = DocumentLoader::new(&self.document.loader()); let namespace = namespace_from_domstring(maybe_namespace.to_owned()); @@ -121,7 +121,7 @@ impl DOMImplementationMethods for DOMImplementation { } // https://dom.spec.whatwg.org/#dom-domimplementation-createhtmldocument - fn CreateHTMLDocument(&self, title: Option) -> Root { + fn CreateHTMLDocument(&self, title: Option) -> DomRoot { let win = self.document.window(); let loader = DocumentLoader::new(&self.document.loader()); @@ -149,14 +149,14 @@ impl DOMImplementationMethods for DOMImplementation { { // Step 4. let doc_node = doc.upcast::(); - let doc_html = Root::upcast::(HTMLHtmlElement::new(local_name!("html"), + let doc_html = DomRoot::upcast::(HTMLHtmlElement::new(local_name!("html"), None, &doc)); doc_node.AppendChild(&doc_html).expect("Appending failed"); { // Step 5. - let doc_head = Root::upcast::(HTMLHeadElement::new(local_name!("head"), + let doc_head = DomRoot::upcast::(HTMLHeadElement::new(local_name!("head"), None, &doc)); doc_html.AppendChild(&doc_head).unwrap(); @@ -165,7 +165,7 @@ impl DOMImplementationMethods for DOMImplementation { if let Some(title_str) = title { // Step 6.1. let doc_title = - Root::upcast::(HTMLTitleElement::new(local_name!("title"), + DomRoot::upcast::(HTMLTitleElement::new(local_name!("title"), None, &doc)); doc_head.AppendChild(&doc_title).unwrap(); diff --git a/components/script/dom/dommatrix.rs b/components/script/dom/dommatrix.rs index 869dd38d59b2..9bf315299f47 100644 --- a/components/script/dom/dommatrix.rs +++ b/components/script/dom/dommatrix.rs @@ -7,7 +7,7 @@ use dom::bindings::codegen::Bindings::DOMMatrixReadOnlyBinding::DOMMatrixReadOnl use dom::bindings::error::Fallible; use dom::bindings::inheritance::Castable; use dom::bindings::reflector::reflect_dom_object; -use dom::bindings::root::Root; +use dom::bindings::root::DomRoot; use dom::dommatrixreadonly::{dommatrixinit_to_matrix, DOMMatrixReadOnly, entries_to_matrix}; use dom::globalscope::GlobalScope; use dom_struct::dom_struct; @@ -21,7 +21,7 @@ pub struct DOMMatrix { impl DOMMatrix { #[allow(unrooted_must_root)] - pub fn new(global: &GlobalScope, is2D: bool, matrix: Transform3D) -> Root { + pub fn new(global: &GlobalScope, is2D: bool, matrix: Transform3D) -> DomRoot { let dommatrix = Self::new_inherited(is2D, matrix); reflect_dom_object(box dommatrix, global, Wrap) } @@ -33,12 +33,12 @@ impl DOMMatrix { } // https://drafts.fxtf.org/geometry-1/#dom-dommatrix-dommatrix - pub fn Constructor(global: &GlobalScope) -> Fallible> { + pub fn Constructor(global: &GlobalScope) -> Fallible> { Self::Constructor_(global, vec![1.0, 0.0, 0.0, 1.0, 0.0, 0.0]) } // https://drafts.fxtf.org/geometry-1/#dom-dommatrix-dommatrix-numbersequence - pub fn Constructor_(global: &GlobalScope, entries: Vec) -> Fallible> { + pub fn Constructor_(global: &GlobalScope, entries: Vec) -> Fallible> { entries_to_matrix(&entries[..]) .map(|(is2D, matrix)| { Self::new(global, is2D, matrix) @@ -46,14 +46,14 @@ impl DOMMatrix { } // https://drafts.fxtf.org/geometry-1/#dom-dommatrix-frommatrix - pub fn FromMatrix(global: &GlobalScope, other: &DOMMatrixInit) -> Fallible> { + pub fn FromMatrix(global: &GlobalScope, other: &DOMMatrixInit) -> Fallible> { dommatrixinit_to_matrix(&other) .map(|(is2D, matrix)| { Self::new(global, is2D, matrix) }) } - pub fn from_readonly(global: &GlobalScope, ro: &DOMMatrixReadOnly) -> Root { + pub fn from_readonly(global: &GlobalScope, ro: &DOMMatrixReadOnly) -> DomRoot { Self::new(global, ro.is_2d(), ro.matrix().clone()) } } @@ -280,91 +280,91 @@ impl DOMMatrixMethods for DOMMatrix { } // https://drafts.fxtf.org/geometry-1/#dom-dommatrix-multiplyself - fn MultiplySelf(&self, other:&DOMMatrixInit) -> Fallible> { + fn MultiplySelf(&self, other:&DOMMatrixInit) -> Fallible> { // Steps 1-3. self.upcast::().multiply_self(other) // Step 4. - .and(Ok(Root::from_ref(&self))) + .and(Ok(DomRoot::from_ref(&self))) } // https://drafts.fxtf.org/geometry-1/#dom-dommatrix-premultiplyself - fn PreMultiplySelf(&self, other:&DOMMatrixInit) -> Fallible> { + fn PreMultiplySelf(&self, other:&DOMMatrixInit) -> Fallible> { // Steps 1-3. self.upcast::().pre_multiply_self(other) // Step 4. - .and(Ok(Root::from_ref(&self))) + .and(Ok(DomRoot::from_ref(&self))) } // https://drafts.fxtf.org/geometry-1/#dom-dommatrix-translateself - fn TranslateSelf(&self, tx: f64, ty: f64, tz: f64) -> Root { + fn TranslateSelf(&self, tx: f64, ty: f64, tz: f64) -> DomRoot { // Steps 1-2. self.upcast::().translate_self(tx, ty, tz); // Step 3. - Root::from_ref(&self) + DomRoot::from_ref(&self) } // https://drafts.fxtf.org/geometry-1/#dom-dommatrix-scaleself fn ScaleSelf(&self, scaleX: f64, scaleY: Option, scaleZ: f64, - originX: f64, originY: f64, originZ: f64) -> Root { + originX: f64, originY: f64, originZ: f64) -> DomRoot { // Steps 1-6. self.upcast::().scale_self(scaleX, scaleY, scaleZ, originX, originY, originZ); // Step 7. - Root::from_ref(&self) + DomRoot::from_ref(&self) } // https://drafts.fxtf.org/geometry-1/#dom-dommatrix-scale3dself - fn Scale3dSelf(&self, scale: f64, originX: f64, originY: f64, originZ: f64) -> Root { + fn Scale3dSelf(&self, scale: f64, originX: f64, originY: f64, originZ: f64) -> DomRoot { // Steps 1-4. self.upcast::().scale_3d_self(scale, originX, originY, originZ); // Step 5. - Root::from_ref(&self) + DomRoot::from_ref(&self) } // https://drafts.fxtf.org/geometry-1/#dom-dommatrix-rotateself - fn RotateSelf(&self, rotX: f64, rotY: Option, rotZ: Option) -> Root { + fn RotateSelf(&self, rotX: f64, rotY: Option, rotZ: Option) -> DomRoot { // Steps 1-7. self.upcast::().rotate_self(rotX, rotY, rotZ); // Step 8. - Root::from_ref(&self) + DomRoot::from_ref(&self) } // https://drafts.fxtf.org/geometry-1/#dom-dommatrix-rotatefromvectorself - fn RotateFromVectorSelf(&self, x: f64, y: f64) -> Root { + fn RotateFromVectorSelf(&self, x: f64, y: f64) -> DomRoot { // Step 1. self.upcast::().rotate_from_vector_self(x, y); // Step 2. - Root::from_ref(&self) + DomRoot::from_ref(&self) } // https://drafts.fxtf.org/geometry-1/#dom-dommatrix-rotateaxisangleself - fn RotateAxisAngleSelf(&self, x: f64, y: f64, z: f64, angle: f64) -> Root { + fn RotateAxisAngleSelf(&self, x: f64, y: f64, z: f64, angle: f64) -> DomRoot { // Steps 1-2. self.upcast::().rotate_axis_angle_self(x, y, z, angle); // Step 3. - Root::from_ref(&self) + DomRoot::from_ref(&self) } // https://drafts.fxtf.org/geometry-1/#dom-dommatrix-skewxself - fn SkewXSelf(&self, sx: f64) -> Root { + fn SkewXSelf(&self, sx: f64) -> DomRoot { // Step 1. self.upcast::().skew_x_self(sx); // Step 2. - Root::from_ref(&self) + DomRoot::from_ref(&self) } // https://drafts.fxtf.org/geometry-1/#dom-dommatrix-skewyself - fn SkewYSelf(&self, sy: f64) -> Root { + fn SkewYSelf(&self, sy: f64) -> DomRoot { // Step 1. self.upcast::().skew_y_self(sy); // Step 2. - Root::from_ref(&self) + DomRoot::from_ref(&self) } // https://drafts.fxtf.org/geometry-1/#dom-dommatrix-invertself - fn InvertSelf(&self) -> Root { + fn InvertSelf(&self) -> DomRoot { // Steps 1-2. self.upcast::().invert_self(); // Step 3. - Root::from_ref(&self) + DomRoot::from_ref(&self) } } diff --git a/components/script/dom/dommatrixreadonly.rs b/components/script/dom/dommatrixreadonly.rs index 0b6e8be3b6ac..82aa96ba7b7b 100644 --- a/components/script/dom/dommatrixreadonly.rs +++ b/components/script/dom/dommatrixreadonly.rs @@ -9,7 +9,7 @@ use dom::bindings::codegen::Bindings::DOMPointBinding::DOMPointInit; use dom::bindings::error; use dom::bindings::error::Fallible; use dom::bindings::reflector::{reflect_dom_object, DomObject, Reflector}; -use dom::bindings::root::Root; +use dom::bindings::root::DomRoot; use dom::dommatrix::DOMMatrix; use dom::dompoint::DOMPoint; use dom::globalscope::GlobalScope; @@ -27,7 +27,7 @@ pub struct DOMMatrixReadOnly { impl DOMMatrixReadOnly { #[allow(unrooted_must_root)] - pub fn new(global: &GlobalScope, is2D: bool, matrix: Transform3D) -> Root { + pub fn new(global: &GlobalScope, is2D: bool, matrix: Transform3D) -> DomRoot { let dommatrix = Self::new_inherited(is2D, matrix); reflect_dom_object(box dommatrix, global, Wrap) } @@ -41,12 +41,12 @@ impl DOMMatrixReadOnly { } // https://drafts.fxtf.org/geometry-1/#dom-dommatrixreadonly-dommatrixreadonly - pub fn Constructor(global: &GlobalScope) -> Fallible> { + pub fn Constructor(global: &GlobalScope) -> Fallible> { Ok(Self::new(global, true, Transform3D::identity())) } // https://drafts.fxtf.org/geometry-1/#dom-dommatrixreadonly-dommatrixreadonly-numbersequence - pub fn Constructor_(global: &GlobalScope, entries: Vec) -> Fallible> { + pub fn Constructor_(global: &GlobalScope, entries: Vec) -> Fallible> { entries_to_matrix(&entries[..]) .map(|(is2D, matrix)| { Self::new(global, is2D, matrix) @@ -54,7 +54,7 @@ impl DOMMatrixReadOnly { } // https://drafts.fxtf.org/geometry-1/#dom-dommatrixreadonly-frommatrix - pub fn FromMatrix(global: &GlobalScope, other: &DOMMatrixInit) -> Fallible> { + pub fn FromMatrix(global: &GlobalScope, other: &DOMMatrixInit) -> Fallible> { dommatrixinit_to_matrix(&other) .map(|(is2D, matrix)| { Self::new(global, is2D, matrix) @@ -463,55 +463,55 @@ impl DOMMatrixReadOnlyMethods for DOMMatrixReadOnly { } // https://drafts.fxtf.org/geometry-1/#dom-dommatrixreadonly-translate - fn Translate(&self, tx: f64, ty: f64, tz: f64) -> Root { + fn Translate(&self, tx: f64, ty: f64, tz: f64) -> DomRoot { DOMMatrix::from_readonly(&self.global(), self).TranslateSelf(tx, ty, tz) } // https://drafts.fxtf.org/geometry-1/#dom-dommatrixreadonly-scale fn Scale(&self, scaleX: f64, scaleY: Option, scaleZ: f64, - originX: f64, originY: f64, originZ: f64) -> Root { + originX: f64, originY: f64, originZ: f64) -> DomRoot { DOMMatrix::from_readonly(&self.global(), self) .ScaleSelf(scaleX, scaleY, scaleZ, originX, originY, originZ) } // https://drafts.fxtf.org/geometry-1/#dom-dommatrixreadonly-scale3d - fn Scale3d(&self, scale: f64, originX: f64, originY: f64, originZ: f64) -> Root { + fn Scale3d(&self, scale: f64, originX: f64, originY: f64, originZ: f64) -> DomRoot { DOMMatrix::from_readonly(&self.global(), self) .Scale3dSelf(scale, originX, originY, originZ) } // https://drafts.fxtf.org/geometry-1/#dom-dommatrixreadonly-rotate - fn Rotate(&self, rotX: f64, rotY: Option, rotZ: Option) -> Root { + fn Rotate(&self, rotX: f64, rotY: Option, rotZ: Option) -> DomRoot { DOMMatrix::from_readonly(&self.global(), self).RotateSelf(rotX, rotY, rotZ) } // https://drafts.fxtf.org/geometry-1/#dom-dommatrixreadonly-rotatefromvector - fn RotateFromVector(&self, x: f64, y: f64) -> Root { + fn RotateFromVector(&self, x: f64, y: f64) -> DomRoot { DOMMatrix::from_readonly(&self.global(), self).RotateFromVectorSelf(x, y) } // https://drafts.fxtf.org/geometry-1/#dom-dommatrixreadonly-rotateaxisangle - fn RotateAxisAngle(&self, x: f64, y: f64, z: f64, angle: f64) -> Root { + fn RotateAxisAngle(&self, x: f64, y: f64, z: f64, angle: f64) -> DomRoot { DOMMatrix::from_readonly(&self.global(), self).RotateAxisAngleSelf(x, y, z, angle) } // https://drafts.fxtf.org/geometry-1/#dom-dommatrixreadonly-skewx - fn SkewX(&self, sx: f64) -> Root { + fn SkewX(&self, sx: f64) -> DomRoot { DOMMatrix::from_readonly(&self.global(), self).SkewXSelf(sx) } // https://drafts.fxtf.org/geometry-1/#dom-dommatrixreadonly-skewy - fn SkewY(&self, sy: f64) -> Root { + fn SkewY(&self, sy: f64) -> DomRoot { DOMMatrix::from_readonly(&self.global(), self).SkewYSelf(sy) } // https://drafts.fxtf.org/geometry-1/#dom-dommatrixreadonly-multiply - fn Multiply(&self, other: &DOMMatrixInit) -> Fallible> { + fn Multiply(&self, other: &DOMMatrixInit) -> Fallible> { DOMMatrix::from_readonly(&self.global(), self).MultiplySelf(&other) } // https://drafts.fxtf.org/geometry-1/#dom-dommatrixreadonly-flipx - fn FlipX(&self) -> Root { + fn FlipX(&self) -> DomRoot { let is2D = self.is2D.get(); let flip = Transform3D::row_major(-1.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, @@ -522,7 +522,7 @@ impl DOMMatrixReadOnlyMethods for DOMMatrixReadOnly { } // https://drafts.fxtf.org/geometry-1/#dom-dommatrixreadonly-flipy - fn FlipY(&self) -> Root { + fn FlipY(&self) -> DomRoot { let is2D = self.is2D.get(); let flip = Transform3D::row_major(1.0, 0.0, 0.0, 0.0, 0.0, -1.0, 0.0, 0.0, @@ -533,12 +533,12 @@ impl DOMMatrixReadOnlyMethods for DOMMatrixReadOnly { } // https://drafts.fxtf.org/geometry-1/#dom-dommatrixreadonly-inverse - fn Inverse(&self) -> Root { + fn Inverse(&self) -> DomRoot { DOMMatrix::from_readonly(&self.global(), self).InvertSelf() } // https://drafts.fxtf.org/geometry-1/#dom-dommatrixreadonly-transformpoint - fn TransformPoint(&self, point: &DOMPointInit) -> Root { + fn TransformPoint(&self, point: &DOMPointInit) -> DomRoot { // Euclid always normalizes the homogeneous coordinate which is usually the right // thing but may (?) not be compliant with the CSS matrix spec (or at least is // probably not the behavior web authors will expect even if it is mathematically diff --git a/components/script/dom/domparser.rs b/components/script/dom/domparser.rs index 6181087acd7d..957b93f59b28 100644 --- a/components/script/dom/domparser.rs +++ b/components/script/dom/domparser.rs @@ -13,7 +13,7 @@ use dom::bindings::codegen::Bindings::DocumentBinding::DocumentReadyState; use dom::bindings::codegen::Bindings::WindowBinding::WindowMethods; use dom::bindings::error::Fallible; use dom::bindings::reflector::{Reflector, reflect_dom_object}; -use dom::bindings::root::{Dom, Root}; +use dom::bindings::root::{Dom, DomRoot}; use dom::bindings::str::DOMString; use dom::document::{Document, HasBrowsingContext, IsHTMLDocument}; use dom::document::DocumentSource; @@ -36,13 +36,13 @@ impl DOMParser { } } - pub fn new(window: &Window) -> Root { + pub fn new(window: &Window) -> DomRoot { reflect_dom_object(box DOMParser::new_inherited(window), window, DOMParserBinding::Wrap) } - pub fn Constructor(window: &Window) -> Fallible> { + pub fn Constructor(window: &Window) -> Fallible> { Ok(DOMParser::new(window)) } } @@ -52,7 +52,7 @@ impl DOMParserMethods for DOMParser { fn ParseFromString(&self, s: DOMString, ty: DOMParserBinding::SupportedType) - -> Fallible> { + -> Fallible> { let url = self.window.get_url(); let content_type = DOMString::from(ty.as_str()); let doc = self.window.Document(); diff --git a/components/script/dom/dompoint.rs b/components/script/dom/dompoint.rs index 44fe7a99ea7f..8f27603a4568 100644 --- a/components/script/dom/dompoint.rs +++ b/components/script/dom/dompoint.rs @@ -6,7 +6,7 @@ use dom::bindings::codegen::Bindings::DOMPointBinding::{DOMPointInit, DOMPointMe use dom::bindings::codegen::Bindings::DOMPointReadOnlyBinding::DOMPointReadOnlyMethods; use dom::bindings::error::Fallible; use dom::bindings::reflector::reflect_dom_object; -use dom::bindings::root::Root; +use dom::bindings::root::DomRoot; use dom::dompointreadonly::{DOMPointReadOnly, DOMPointWriteMethods}; use dom::globalscope::GlobalScope; use dom_struct::dom_struct; @@ -24,7 +24,7 @@ impl DOMPoint { } } - pub fn new(global: &GlobalScope, x: f64, y: f64, z: f64, w: f64) -> Root { + pub fn new(global: &GlobalScope, x: f64, y: f64, z: f64, w: f64) -> DomRoot { reflect_dom_object(box DOMPoint::new_inherited(x, y, z, w), global, Wrap) } @@ -33,11 +33,11 @@ impl DOMPoint { y: f64, z: f64, w: f64) - -> Fallible> { + -> Fallible> { Ok(DOMPoint::new(global, x, y, z, w)) } - pub fn new_from_init(global: &GlobalScope, p: &DOMPointInit) -> Root { + pub fn new_from_init(global: &GlobalScope, p: &DOMPointInit) -> DomRoot { DOMPoint::new(global, p.x, p.y, p.z, p.w) } } diff --git a/components/script/dom/dompointreadonly.rs b/components/script/dom/dompointreadonly.rs index ae9cab6f3f97..13ec9ee8c0f2 100644 --- a/components/script/dom/dompointreadonly.rs +++ b/components/script/dom/dompointreadonly.rs @@ -5,7 +5,7 @@ use dom::bindings::codegen::Bindings::DOMPointReadOnlyBinding::{DOMPointReadOnlyMethods, Wrap}; use dom::bindings::error::Fallible; use dom::bindings::reflector::{Reflector, reflect_dom_object}; -use dom::bindings::root::Root; +use dom::bindings::root::DomRoot; use dom::globalscope::GlobalScope; use dom_struct::dom_struct; use std::cell::Cell; @@ -31,7 +31,7 @@ impl DOMPointReadOnly { } } - pub fn new(global: &GlobalScope, x: f64, y: f64, z: f64, w: f64) -> Root { + pub fn new(global: &GlobalScope, x: f64, y: f64, z: f64, w: f64) -> DomRoot { reflect_dom_object(box DOMPointReadOnly::new_inherited(x, y, z, w), global, Wrap) @@ -42,7 +42,7 @@ impl DOMPointReadOnly { y: f64, z: f64, w: f64) - -> Fallible> { + -> Fallible> { Ok(DOMPointReadOnly::new(global, x, y, z, w)) } } diff --git a/components/script/dom/domquad.rs b/components/script/dom/domquad.rs index f31cfc3e05e9..54c07b8275c7 100644 --- a/components/script/dom/domquad.rs +++ b/components/script/dom/domquad.rs @@ -7,7 +7,7 @@ use dom::bindings::codegen::Bindings::DOMQuadBinding::{DOMQuadInit, DOMQuadMetho use dom::bindings::codegen::Bindings::DOMRectReadOnlyBinding::DOMRectInit; use dom::bindings::error::Fallible; use dom::bindings::reflector::{DomObject, Reflector, reflect_dom_object}; -use dom::bindings::root::{Root, Dom}; +use dom::bindings::root::{Dom, DomRoot}; use dom::dompoint::DOMPoint; use dom::domrect::DOMRect; use dom::globalscope::GlobalScope; @@ -42,7 +42,7 @@ impl DOMQuad { p1: &DOMPoint, p2: &DOMPoint, p3: &DOMPoint, - p4: &DOMPoint) -> Root { + p4: &DOMPoint) -> DomRoot { reflect_dom_object(box DOMQuad::new_inherited(p1, p2, p3, p4), global, Wrap) @@ -53,7 +53,7 @@ impl DOMQuad { p2: &DOMPointInit, p3: &DOMPointInit, p4: &DOMPointInit) - -> Fallible> { + -> Fallible> { Ok(DOMQuad::new(global, &*DOMPoint::new_from_init(global, p1), &*DOMPoint::new_from_init(global, p2), @@ -62,7 +62,7 @@ impl DOMQuad { } // https://drafts.fxtf.org/geometry/#dom-domquad-fromrect - pub fn FromRect(global: &GlobalScope, other: &DOMRectInit) -> Root { + pub fn FromRect(global: &GlobalScope, other: &DOMRectInit) -> DomRoot { DOMQuad::new(global, &*DOMPoint::new(global, other.x, other.y, 0f64, 1f64), &*DOMPoint::new(global, other.x + other.width, other.y, 0f64, 1f64), @@ -71,7 +71,7 @@ impl DOMQuad { } // https://drafts.fxtf.org/geometry/#dom-domquad-fromquad - pub fn FromQuad(global: &GlobalScope, other: &DOMQuadInit) -> Root { + pub fn FromQuad(global: &GlobalScope, other: &DOMQuadInit) -> DomRoot { DOMQuad::new(global, &DOMPoint::new_from_init(global, &other.p1), &DOMPoint::new_from_init(global, &other.p2), @@ -82,27 +82,27 @@ impl DOMQuad { impl DOMQuadMethods for DOMQuad { // https://drafts.fxtf.org/geometry/#dom-domquad-p1 - fn P1(&self) -> Root { - Root::from_ref(&self.p1) + fn P1(&self) -> DomRoot { + DomRoot::from_ref(&self.p1) } // https://drafts.fxtf.org/geometry/#dom-domquad-p2 - fn P2(&self) -> Root { - Root::from_ref(&self.p2) + fn P2(&self) -> DomRoot { + DomRoot::from_ref(&self.p2) } // https://drafts.fxtf.org/geometry/#dom-domquad-p3 - fn P3(&self) -> Root { - Root::from_ref(&self.p3) + fn P3(&self) -> DomRoot { + DomRoot::from_ref(&self.p3) } // https://drafts.fxtf.org/geometry/#dom-domquad-p4 - fn P4(&self) -> Root { - Root::from_ref(&self.p4) + fn P4(&self) -> DomRoot { + DomRoot::from_ref(&self.p4) } // https://drafts.fxtf.org/geometry/#dom-domquad-getbounds - fn GetBounds(&self) -> Root { + fn GetBounds(&self) -> DomRoot { let left = self.p1.X().min(self.p2.X()).min(self.p3.X()).min(self.p4.X()); let top = self.p1.Y().min(self.p2.Y()).min(self.p3.Y()).min(self.p4.Y()); let right = self.p1.X().max(self.p2.X()).max(self.p3.X()).max(self.p4.X()); diff --git a/components/script/dom/domrect.rs b/components/script/dom/domrect.rs index 5cad05c23f78..4933619d172b 100644 --- a/components/script/dom/domrect.rs +++ b/components/script/dom/domrect.rs @@ -7,7 +7,7 @@ use dom::bindings::codegen::Bindings::DOMRectBinding::DOMRectMethods; use dom::bindings::codegen::Bindings::DOMRectReadOnlyBinding::DOMRectReadOnlyMethods; use dom::bindings::error::Fallible; use dom::bindings::reflector::reflect_dom_object; -use dom::bindings::root::Root; +use dom::bindings::root::DomRoot; use dom::domrectreadonly::DOMRectReadOnly; use dom::globalscope::GlobalScope; use dom_struct::dom_struct; @@ -24,7 +24,7 @@ impl DOMRect { } } - pub fn new(global: &GlobalScope, x: f64, y: f64, width: f64, height: f64) -> Root { + pub fn new(global: &GlobalScope, x: f64, y: f64, width: f64, height: f64) -> DomRoot { reflect_dom_object(box DOMRect::new_inherited(x, y, width, height), global, DOMRectBinding::Wrap) @@ -35,7 +35,7 @@ impl DOMRect { y: f64, width: f64, height: f64) - -> Fallible> { + -> Fallible> { Ok(DOMRect::new(global, x, y, width, height)) } } diff --git a/components/script/dom/domrectreadonly.rs b/components/script/dom/domrectreadonly.rs index 7427cf22b8dd..fe590b0e7491 100644 --- a/components/script/dom/domrectreadonly.rs +++ b/components/script/dom/domrectreadonly.rs @@ -5,7 +5,7 @@ use dom::bindings::codegen::Bindings::DOMRectReadOnlyBinding::{DOMRectReadOnlyMethods, Wrap}; use dom::bindings::error::Fallible; use dom::bindings::reflector::{Reflector, reflect_dom_object}; -use dom::bindings::root::Root; +use dom::bindings::root::DomRoot; use dom::globalscope::GlobalScope; use dom_struct::dom_struct; use std::cell::Cell; @@ -35,7 +35,7 @@ impl DOMRectReadOnly { y: f64, width: f64, height: f64) - -> Root { + -> DomRoot { reflect_dom_object(box DOMRectReadOnly::new_inherited(x, y, width, height), global, Wrap) @@ -46,7 +46,7 @@ impl DOMRectReadOnly { y: f64, width: f64, height: f64) - -> Fallible> { + -> Fallible> { Ok(DOMRectReadOnly::new(global, x, y, width, height)) } diff --git a/components/script/dom/domstringmap.rs b/components/script/dom/domstringmap.rs index ae7387c28255..c349a9d52591 100644 --- a/components/script/dom/domstringmap.rs +++ b/components/script/dom/domstringmap.rs @@ -6,7 +6,7 @@ use dom::bindings::codegen::Bindings::DOMStringMapBinding; use dom::bindings::codegen::Bindings::DOMStringMapBinding::DOMStringMapMethods; use dom::bindings::error::ErrorResult; use dom::bindings::reflector::{Reflector, reflect_dom_object}; -use dom::bindings::root::{Dom, Root}; +use dom::bindings::root::{Dom, DomRoot}; use dom::bindings::str::DOMString; use dom::htmlelement::HTMLElement; use dom::node::window_from_node; @@ -26,7 +26,7 @@ impl DOMStringMap { } } - pub fn new(element: &HTMLElement) -> Root { + pub fn new(element: &HTMLElement) -> DomRoot { let window = window_from_node(element); reflect_dom_object(box DOMStringMap::new_inherited(element), &*window, diff --git a/components/script/dom/domtokenlist.rs b/components/script/dom/domtokenlist.rs index 96fd12269502..22f0a45654bd 100644 --- a/components/script/dom/domtokenlist.rs +++ b/components/script/dom/domtokenlist.rs @@ -7,7 +7,7 @@ use dom::bindings::codegen::Bindings::DOMTokenListBinding; use dom::bindings::codegen::Bindings::DOMTokenListBinding::DOMTokenListMethods; use dom::bindings::error::{Error, ErrorResult, Fallible}; use dom::bindings::reflector::{Reflector, reflect_dom_object}; -use dom::bindings::root::{Dom, Root}; +use dom::bindings::root::{Dom, DomRoot}; use dom::bindings::str::DOMString; use dom::element::Element; use dom::node::window_from_node; @@ -32,14 +32,14 @@ impl DOMTokenList { } } - pub fn new(element: &Element, local_name: &LocalName) -> Root { + pub fn new(element: &Element, local_name: &LocalName) -> DomRoot { let window = window_from_node(element); reflect_dom_object(box DOMTokenList::new_inherited(element, local_name.clone()), &*window, DOMTokenListBinding::Wrap) } - fn attribute(&self) -> Option> { + fn attribute(&self) -> Option> { self.element.get_attribute(&ns!(), &self.local_name) } diff --git a/components/script/dom/element.rs b/components/script/dom/element.rs index 30fa0b59b4a7..509425100062 100644 --- a/components/script/dom/element.rs +++ b/components/script/dom/element.rs @@ -24,7 +24,7 @@ use dom::bindings::error::{Error, ErrorResult, Fallible}; use dom::bindings::inheritance::{Castable, ElementTypeId, HTMLElementTypeId, NodeTypeId}; use dom::bindings::refcounted::{Trusted, TrustedPromise}; use dom::bindings::reflector::DomObject; -use dom::bindings::root::{Dom, LayoutDom, MutNullableDom, Root, RootedReference}; +use dom::bindings::root::{Dom, DomRoot, LayoutDom, MutNullableDom, RootedReference}; use dom::bindings::str::DOMString; use dom::bindings::xmlname::{namespace_from_domstring, validate_and_extract, xml_name_type}; use dom::bindings::xmlname::XMLName::InvalidXMLName; @@ -164,7 +164,7 @@ impl fmt::Debug for Element { } } -impl fmt::Debug for Root { +impl fmt::Debug for DomRoot { fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { (**self).fmt(f) } @@ -235,7 +235,7 @@ impl Element { document: &Document, creator: ElementCreator, mode: CustomElementCreationMode) - -> Root { + -> DomRoot { create_element(name, is, document, creator, mode) } @@ -273,7 +273,7 @@ impl Element { pub fn new(local_name: LocalName, namespace: Namespace, prefix: Option, - document: &Document) -> Root { + document: &Document) -> DomRoot { Node::reflect_node( box Element::new_inherited(local_name, namespace, prefix, document), document, @@ -923,7 +923,7 @@ impl Element { let inclusive_ancestor_elements = self.upcast::() .inclusive_ancestors() - .filter_map(Root::downcast::); + .filter_map(DomRoot::downcast::); // Steps 3-4. for element in inclusive_ancestor_elements { @@ -1002,7 +1002,7 @@ impl Element { } } - pub fn root_element(&self) -> Root { + pub fn root_element(&self) -> DomRoot { if self.node.is_in_doc() { self.upcast::() .owner_doc() @@ -1011,7 +1011,7 @@ impl Element { } else { self.upcast::() .inclusive_ancestors() - .filter_map(Root::downcast) + .filter_map(DomRoot::downcast) .last() .expect("We know inclusive_ancestors will return `self` which is an element") } @@ -1124,18 +1124,18 @@ impl Element { } } - pub fn get_attribute(&self, namespace: &Namespace, local_name: &LocalName) -> Option> { + pub fn get_attribute(&self, namespace: &Namespace, local_name: &LocalName) -> Option> { self.attrs .borrow() .iter() .find(|attr| attr.local_name() == local_name && attr.namespace() == namespace) - .map(|js| Root::from_ref(&**js)) + .map(|js| DomRoot::from_ref(&**js)) } // https://dom.spec.whatwg.org/#concept-element-attributes-get-by-name - pub fn get_attribute_by_name(&self, name: DOMString) -> Option> { + pub fn get_attribute_by_name(&self, name: DOMString) -> Option> { let name = &self.parsed_name(name); - self.attrs.borrow().iter().find(|a| a.name() == name).map(|js| Root::from_ref(&**js)) + self.attrs.borrow().iter().find(|a| a.name() == name).map(|js| DomRoot::from_ref(&**js)) } pub fn set_attribute_from_parser(&self, @@ -1207,7 +1207,7 @@ impl Element { .borrow() .iter() .find(|attr| find(&attr)) - .map(|js| Root::from_ref(&**js)); + .map(|js| DomRoot::from_ref(&**js)); if let Some(attr) = attr { attr.set_value(value, self); } else { @@ -1227,21 +1227,21 @@ impl Element { } } - pub fn remove_attribute(&self, namespace: &Namespace, local_name: &LocalName) -> Option> { + pub fn remove_attribute(&self, namespace: &Namespace, local_name: &LocalName) -> Option> { self.remove_first_matching_attribute(|attr| { attr.namespace() == namespace && attr.local_name() == local_name }) } - pub fn remove_attribute_by_name(&self, name: &LocalName) -> Option> { + pub fn remove_attribute_by_name(&self, name: &LocalName) -> Option> { self.remove_first_matching_attribute(|attr| attr.name() == name) } - fn remove_first_matching_attribute(&self, find: F) -> Option> + fn remove_first_matching_attribute(&self, find: F) -> Option> where F: Fn(&Attr) -> bool { let idx = self.attrs.borrow().iter().position(|attr| find(&attr)); idx.map(|idx| { - let attr = Root::from_ref(&*(*self.attrs.borrow())[idx]); + let attr = DomRoot::from_ref(&*(*self.attrs.borrow())[idx]); self.will_mutate_attr(&attr); let name = attr.local_name().clone(); @@ -1396,7 +1396,7 @@ impl Element { // https://dom.spec.whatwg.org/#insert-adjacent pub fn insert_adjacent(&self, where_: AdjacentPosition, node: &Node) - -> Fallible>> { + -> Fallible>> { let self_node = self.upcast::(); match where_ { AdjacentPosition::BeforeBegin => { @@ -1468,7 +1468,7 @@ impl Element { } // https://w3c.github.io/DOM-Parsing/#parsing - pub fn parse_fragment(&self, markup: DOMString) -> Fallible> { + pub fn parse_fragment(&self, markup: DOMString) -> Fallible> { // Steps 1-2. let context_document = document_from_node(self); // TODO(#11995): XML case. @@ -1483,13 +1483,13 @@ impl Element { Ok(fragment) } - pub fn fragment_parsing_context(owner_doc: &Document, element: Option<&Self>) -> Root { + pub fn fragment_parsing_context(owner_doc: &Document, element: Option<&Self>) -> DomRoot { match element { Some(elem) if elem.local_name() != &local_name!("html") || !elem.html_element_in_html_document() => { - Root::from_ref(elem) + DomRoot::from_ref(elem) }, _ => { - Root::upcast(HTMLBodyElement::new(local_name!("body"), None, owner_doc)) + DomRoot::upcast(HTMLBodyElement::new(local_name!("body"), None, owner_doc)) } } } @@ -1568,12 +1568,12 @@ impl ElementMethods for Element { } // https://dom.spec.whatwg.org/#dom-element-classlist - fn ClassList(&self) -> Root { + fn ClassList(&self) -> DomRoot { self.class_list.or_init(|| DOMTokenList::new(self, &local_name!("class"))) } // https://dom.spec.whatwg.org/#dom-element-attributes - fn Attributes(&self) -> Root { + fn Attributes(&self) -> DomRoot { self.attr_list.or_init(|| NamedNodeMap::new(&window_from_node(self), self)) } @@ -1603,7 +1603,7 @@ impl ElementMethods for Element { } // https://dom.spec.whatwg.org/#dom-element-getattributenode - fn GetAttributeNode(&self, name: DOMString) -> Option> { + fn GetAttributeNode(&self, name: DOMString) -> Option> { self.get_attribute_by_name(name) } @@ -1611,7 +1611,7 @@ impl ElementMethods for Element { fn GetAttributeNodeNS(&self, namespace: Option, local_name: DOMString) - -> Option> { + -> Option> { let namespace = &namespace_from_domstring(namespace); self.get_attribute(namespace, &LocalName::from(local_name)) } @@ -1650,7 +1650,7 @@ impl ElementMethods for Element { } // https://dom.spec.whatwg.org/#dom-element-setattributenode - fn SetAttributeNode(&self, attr: &Attr) -> Fallible>> { + fn SetAttributeNode(&self, attr: &Attr) -> Fallible>> { // Step 1. if let Some(owner) = attr.GetOwnerElement() { if &*owner != self { @@ -1673,11 +1673,11 @@ impl ElementMethods for Element { }); if let Some(position) = position { - let old_attr = Root::from_ref(&*self.attrs.borrow()[position]); + let old_attr = DomRoot::from_ref(&*self.attrs.borrow()[position]); // Step 3. if &*old_attr == attr { - return Ok(Some(Root::from_ref(attr))); + return Ok(Some(DomRoot::from_ref(attr))); } // Step 4. @@ -1712,7 +1712,7 @@ impl ElementMethods for Element { } // https://dom.spec.whatwg.org/#dom-element-setattributenodens - fn SetAttributeNodeNS(&self, attr: &Attr) -> Fallible>> { + fn SetAttributeNodeNS(&self, attr: &Attr) -> Fallible>> { self.SetAttributeNode(attr) } @@ -1730,7 +1730,7 @@ impl ElementMethods for Element { } // https://dom.spec.whatwg.org/#dom-element-removeattributenode - fn RemoveAttributeNode(&self, attr: &Attr) -> Fallible> { + fn RemoveAttributeNode(&self, attr: &Attr) -> Fallible> { self.remove_first_matching_attribute(|a| a == attr) .ok_or(Error::NotFound) } @@ -1746,7 +1746,7 @@ impl ElementMethods for Element { } // https://dom.spec.whatwg.org/#dom-element-getelementsbytagname - fn GetElementsByTagName(&self, localname: DOMString) -> Root { + fn GetElementsByTagName(&self, localname: DOMString) -> DomRoot { let window = window_from_node(self); HTMLCollection::by_qualified_name(&window, self.upcast(), LocalName::from(&*localname)) } @@ -1755,19 +1755,19 @@ impl ElementMethods for Element { fn GetElementsByTagNameNS(&self, maybe_ns: Option, localname: DOMString) - -> Root { + -> DomRoot { let window = window_from_node(self); HTMLCollection::by_tag_name_ns(&window, self.upcast(), localname, maybe_ns) } // https://dom.spec.whatwg.org/#dom-element-getelementsbyclassname - fn GetElementsByClassName(&self, classes: DOMString) -> Root { + fn GetElementsByClassName(&self, classes: DOMString) -> DomRoot { let window = window_from_node(self); HTMLCollection::by_class_name(&window, self.upcast(), classes) } // https://drafts.csswg.org/cssom-view/#dom-element-getclientrects - fn GetClientRects(&self) -> Vec> { + fn GetClientRects(&self) -> Vec> { let win = window_from_node(self); let raw_rects = self.upcast::().content_boxes(); raw_rects.iter().map(|rect| { @@ -1780,7 +1780,7 @@ impl ElementMethods for Element { } // https://drafts.csswg.org/cssom-view/#dom-element-getboundingclientrect - fn GetBoundingClientRect(&self) -> Root { + fn GetBoundingClientRect(&self) -> DomRoot { let win = window_from_node(self); let rect = self.upcast::().bounding_content_box_or_zero(); DOMRect::new(win.upcast(), @@ -2059,9 +2059,9 @@ impl ElementMethods for Element { // Step 2. // https://github.com/w3c/DOM-Parsing/issues/1 let target = if let Some(template) = self.downcast::() { - Root::upcast(template.Content()) + DomRoot::upcast(template.Content()) } else { - Root::from_ref(self.upcast()) + DomRoot::from_ref(self.upcast()) }; Node::replace_all(Some(frag.upcast()), &target); Ok(()) @@ -2096,7 +2096,7 @@ impl ElementMethods for Element { &context_document, ElementCreator::ScriptCreated, CustomElementCreationMode::Synchronous); - Root::upcast(body_elem) + DomRoot::upcast(body_elem) }, _ => context_node.GetParentElement().unwrap() }; @@ -2109,29 +2109,29 @@ impl ElementMethods for Element { } // https://dom.spec.whatwg.org/#dom-nondocumenttypechildnode-previouselementsibling - fn GetPreviousElementSibling(&self) -> Option> { - self.upcast::().preceding_siblings().filter_map(Root::downcast).next() + fn GetPreviousElementSibling(&self) -> Option> { + self.upcast::().preceding_siblings().filter_map(DomRoot::downcast).next() } // https://dom.spec.whatwg.org/#dom-nondocumenttypechildnode-nextelementsibling - fn GetNextElementSibling(&self) -> Option> { - self.upcast::().following_siblings().filter_map(Root::downcast).next() + fn GetNextElementSibling(&self) -> Option> { + self.upcast::().following_siblings().filter_map(DomRoot::downcast).next() } // https://dom.spec.whatwg.org/#dom-parentnode-children - fn Children(&self) -> Root { + fn Children(&self) -> DomRoot { let window = window_from_node(self); HTMLCollection::children(&window, self.upcast()) } // https://dom.spec.whatwg.org/#dom-parentnode-firstelementchild - fn GetFirstElementChild(&self) -> Option> { + fn GetFirstElementChild(&self) -> Option> { self.upcast::().child_elements().next() } // https://dom.spec.whatwg.org/#dom-parentnode-lastelementchild - fn GetLastElementChild(&self) -> Option> { - self.upcast::().rev_children().filter_map(Root::downcast::).next() + fn GetLastElementChild(&self) -> Option> { + self.upcast::().rev_children().filter_map(DomRoot::downcast::).next() } // https://dom.spec.whatwg.org/#dom-parentnode-childelementcount @@ -2150,13 +2150,13 @@ impl ElementMethods for Element { } // https://dom.spec.whatwg.org/#dom-parentnode-queryselector - fn QuerySelector(&self, selectors: DOMString) -> Fallible>> { + fn QuerySelector(&self, selectors: DOMString) -> Fallible>> { let root = self.upcast::(); root.query_selector(selectors) } // https://dom.spec.whatwg.org/#dom-parentnode-queryselectorall - fn QuerySelectorAll(&self, selectors: DOMString) -> Fallible> { + fn QuerySelectorAll(&self, selectors: DOMString) -> Fallible> { let root = self.upcast::(); root.query_selector_all(selectors) } @@ -2190,7 +2190,7 @@ impl ElementMethods for Element { // FIXME(bholley): Consider an nth-index cache here. let mut ctx = MatchingContext::new(MatchingMode::Normal, None, None, quirks_mode); - Ok(matches_selector_list(&selectors, &Root::from_ref(self), &mut ctx)) + Ok(matches_selector_list(&selectors, &DomRoot::from_ref(self), &mut ctx)) } } } @@ -2201,13 +2201,13 @@ impl ElementMethods for Element { } // https://dom.spec.whatwg.org/#dom-element-closest - fn Closest(&self, selectors: DOMString) -> Fallible>> { + fn Closest(&self, selectors: DOMString) -> Fallible>> { match SelectorParser::parse_author_origin_no_namespace(&selectors) { Err(_) => Err(Error::Syntax), Ok(selectors) => { let root = self.upcast::(); for element in root.inclusive_ancestors() { - if let Some(element) = Root::downcast::(element) { + if let Some(element) = DomRoot::downcast::(element) { let quirks_mode = document_from_node(self).quirks_mode(); // FIXME(bholley): Consider an nth-index cache here. let mut ctx = MatchingContext::new(MatchingMode::Normal, None, None, @@ -2224,10 +2224,10 @@ impl ElementMethods for Element { // https://dom.spec.whatwg.org/#dom-element-insertadjacentelement fn InsertAdjacentElement(&self, where_: DOMString, element: &Element) - -> Fallible>> { + -> Fallible>> { let where_ = AdjacentPosition::try_from(&*where_)?; let inserted_node = self.insert_adjacent(where_, element.upcast())?; - Ok(inserted_node.map(|node| Root::downcast(node).unwrap())) + Ok(inserted_node.map(|node| DomRoot::downcast(node).unwrap())) } // https://dom.spec.whatwg.org/#dom-element-insertadjacenttext @@ -2258,7 +2258,7 @@ impl ElementMethods for Element { } } AdjacentPosition::AfterBegin | AdjacentPosition::BeforeEnd => { - Root::from_ref(self.upcast::()) + DomRoot::from_ref(self.upcast::()) } }; @@ -2496,14 +2496,14 @@ impl VirtualMethods for Element { } } -impl<'a> ::selectors::Element for Root { +impl<'a> ::selectors::Element for DomRoot { type Impl = SelectorImpl; fn opaque(&self) -> ::selectors::OpaqueElement { ::selectors::OpaqueElement::new(self.reflector().get_jsobject().get()) } - fn parent_element(&self) -> Option> { + fn parent_element(&self) -> Option> { self.upcast::().GetParentElement() } @@ -2516,20 +2516,20 @@ impl<'a> ::selectors::Element for Root { } - fn first_child_element(&self) -> Option> { + fn first_child_element(&self) -> Option> { self.node.child_elements().next() } - fn last_child_element(&self) -> Option> { - self.node.rev_children().filter_map(Root::downcast).next() + fn last_child_element(&self) -> Option> { + self.node.rev_children().filter_map(DomRoot::downcast).next() } - fn prev_sibling_element(&self) -> Option> { - self.node.preceding_siblings().filter_map(Root::downcast).next() + fn prev_sibling_element(&self) -> Option> { + self.node.preceding_siblings().filter_map(DomRoot::downcast).next() } - fn next_sibling_element(&self) -> Option> { - self.node.following_siblings().filter_map(Root::downcast).next() + fn next_sibling_element(&self) -> Option> { + self.node.following_siblings().filter_map(DomRoot::downcast).next() } fn attr_matches(&self, @@ -2739,15 +2739,15 @@ impl Element { } // https://html.spec.whatwg.org/multipage/#nearest-activatable-element - pub fn nearest_activable_element(&self) -> Option> { + pub fn nearest_activable_element(&self) -> Option> { match self.as_maybe_activatable() { - Some(el) => Some(Root::from_ref(el.as_element())), + Some(el) => Some(DomRoot::from_ref(el.as_element())), None => { let node = self.upcast::(); for node in node.ancestors() { if let Some(node) = node.downcast::() { if node.as_maybe_activatable().is_some() { - return Some(Root::from_ref(node)); + return Some(DomRoot::from_ref(node)); } } } diff --git a/components/script/dom/errorevent.rs b/components/script/dom/errorevent.rs index 337e4f34fcc3..cf9439484556 100644 --- a/components/script/dom/errorevent.rs +++ b/components/script/dom/errorevent.rs @@ -9,7 +9,7 @@ use dom::bindings::codegen::Bindings::EventBinding::EventMethods; use dom::bindings::error::Fallible; use dom::bindings::inheritance::Castable; use dom::bindings::reflector::reflect_dom_object; -use dom::bindings::root::Root; +use dom::bindings::root::DomRoot; use dom::bindings::str::DOMString; use dom::bindings::trace::RootedTraceableBox; use dom::event::{Event, EventBubbles, EventCancelable}; @@ -43,7 +43,7 @@ impl ErrorEvent { } } - pub fn new_uninitialized(global: &GlobalScope) -> Root { + pub fn new_uninitialized(global: &GlobalScope) -> DomRoot { reflect_dom_object(box ErrorEvent::new_inherited(), global, ErrorEventBinding::Wrap) @@ -57,7 +57,7 @@ impl ErrorEvent { filename: DOMString, lineno: u32, colno: u32, - error: HandleValue) -> Root { + error: HandleValue) -> DomRoot { let ev = ErrorEvent::new_uninitialized(global); { let event = ev.upcast::(); @@ -75,7 +75,7 @@ impl ErrorEvent { pub fn Constructor(global: &GlobalScope, type_: DOMString, init: RootedTraceableBox) - -> Fallible>{ + -> Fallible>{ let msg = match init.message.as_ref() { Some(message) => message.clone(), None => DOMString::new(), diff --git a/components/script/dom/event.rs b/components/script/dom/event.rs index 24674147bc5d..e693dd1c5ebd 100644 --- a/components/script/dom/event.rs +++ b/components/script/dom/event.rs @@ -11,7 +11,7 @@ use dom::bindings::error::Fallible; use dom::bindings::inheritance::Castable; use dom::bindings::refcounted::Trusted; use dom::bindings::reflector::{DomObject, Reflector, reflect_dom_object}; -use dom::bindings::root::{Dom, MutNullableDom, Root, RootedReference}; +use dom::bindings::root::{Dom, DomRoot, MutNullableDom, RootedReference}; use dom::bindings::str::DOMString; use dom::document::Document; use dom::eventtarget::{CompiledEventListener, EventTarget, ListenerPhase}; @@ -64,7 +64,7 @@ impl Event { } } - pub fn new_uninitialized(global: &GlobalScope) -> Root { + pub fn new_uninitialized(global: &GlobalScope) -> DomRoot { reflect_dom_object(box Event::new_inherited(), global, EventBinding::Wrap) @@ -73,7 +73,7 @@ impl Event { pub fn new(global: &GlobalScope, type_: Atom, bubbles: EventBubbles, - cancelable: EventCancelable) -> Root { + cancelable: EventCancelable) -> DomRoot { let event = Event::new_uninitialized(global); event.init_event(type_, bool::from(bubbles), bool::from(cancelable)); event @@ -81,7 +81,7 @@ impl Event { pub fn Constructor(global: &GlobalScope, type_: DOMString, - init: &EventBinding::EventInit) -> Fallible> { + init: &EventBinding::EventInit) -> Fallible> { let bubbles = EventBubbles::from(init.bubbles); let cancelable = EventCancelable::from(init.cancelable); Ok(Event::new(global, Atom::from(type_), bubbles, cancelable)) @@ -140,8 +140,8 @@ impl Event { event_path.push(Dom::from_ref(ancestor.upcast::())); } let top_most_ancestor_or_target = - Root::from_ref(event_path.r().last().cloned().unwrap_or(target)); - if let Some(document) = Root::downcast::(top_most_ancestor_or_target) { + DomRoot::from_ref(event_path.r().last().cloned().unwrap_or(target)); + if let Some(document) = DomRoot::downcast::(top_most_ancestor_or_target) { if self.type_() != atom!("load") && document.browsing_context().is_some() { event_path.push(Dom::from_ref(document.window().upcast())); } @@ -233,12 +233,12 @@ impl EventMethods for Event { } // https://dom.spec.whatwg.org/#dom-event-target - fn GetTarget(&self) -> Option> { + fn GetTarget(&self) -> Option> { self.target.get() } // https://dom.spec.whatwg.org/#dom-event-currenttarget - fn GetCurrentTarget(&self) -> Option> { + fn GetCurrentTarget(&self) -> Option> { self.current_target.get() } @@ -416,7 +416,7 @@ fn dispatch_to_listeners(event: &Event, target: &EventTarget, event_path: &[&Eve assert!(!event.stop_propagation.get()); assert!(!event.stop_immediate.get()); - let window = match Root::downcast::(target.global()) { + let window = match DomRoot::downcast::(target.global()) { Some(window) => { if window.need_emit_timeline_marker(TimelineMarkerType::DOMEvent) { Some(window) diff --git a/components/script/dom/eventsource.rs b/components/script/dom/eventsource.rs index 82aa62bba260..962138968d07 100644 --- a/components/script/dom/eventsource.rs +++ b/components/script/dom/eventsource.rs @@ -8,7 +8,7 @@ use dom::bindings::error::{Error, Fallible}; use dom::bindings::inheritance::Castable; use dom::bindings::refcounted::Trusted; use dom::bindings::reflector::{DomObject, reflect_dom_object}; -use dom::bindings::root::Root; +use dom::bindings::root::DomRoot; use dom::bindings::str::DOMString; use dom::event::Event; use dom::eventtarget::EventTarget; @@ -412,7 +412,7 @@ impl EventSource { } } - fn new(global: &GlobalScope, url: ServoUrl, with_credentials: bool) -> Root { + fn new(global: &GlobalScope, url: ServoUrl, with_credentials: bool) -> DomRoot { reflect_dom_object(box EventSource::new_inherited(url, with_credentials), global, Wrap) @@ -424,7 +424,7 @@ impl EventSource { pub fn Constructor(global: &GlobalScope, url: DOMString, - event_source_init: &EventSourceInit) -> Fallible> { + event_source_init: &EventSourceInit) -> Fallible> { // TODO: Step 2 relevant settings object // Step 3 let base_url = global.api_base_url(); diff --git a/components/script/dom/eventtarget.rs b/components/script/dom/eventtarget.rs index 64c903e4de6f..a33f7703e1a5 100644 --- a/components/script/dom/eventtarget.rs +++ b/components/script/dom/eventtarget.rs @@ -18,7 +18,7 @@ use dom::bindings::codegen::UnionTypes::EventOrString; use dom::bindings::error::{Error, Fallible, report_pending_exception}; use dom::bindings::inheritance::Castable; use dom::bindings::reflector::{DomObject, Reflector}; -use dom::bindings::root::Root; +use dom::bindings::root::DomRoot; use dom::bindings::str::DOMString; use dom::element::Element; use dom::errorevent::ErrorEvent; @@ -174,7 +174,7 @@ impl CompiledEventListener { return; } - let _ = handler.Call_(object, EventOrString::Event(Root::from_ref(event)), + let _ = handler.Call_(object, EventOrString::Event(DomRoot::from_ref(event)), None, None, None, None, exception_handle); } @@ -506,28 +506,28 @@ impl EventTarget { } // https://dom.spec.whatwg.org/#concept-event-fire - pub fn fire_event(&self, name: Atom) -> Root { + pub fn fire_event(&self, name: Atom) -> DomRoot { self.fire_event_with_params(name, EventBubbles::DoesNotBubble, EventCancelable::NotCancelable) } // https://dom.spec.whatwg.org/#concept-event-fire - pub fn fire_bubbling_event(&self, name: Atom) -> Root { + pub fn fire_bubbling_event(&self, name: Atom) -> DomRoot { self.fire_event_with_params(name, EventBubbles::Bubbles, EventCancelable::NotCancelable) } // https://dom.spec.whatwg.org/#concept-event-fire - pub fn fire_cancelable_event(&self, name: Atom) -> Root { + pub fn fire_cancelable_event(&self, name: Atom) -> DomRoot { self.fire_event_with_params(name, EventBubbles::DoesNotBubble, EventCancelable::Cancelable) } // https://dom.spec.whatwg.org/#concept-event-fire - pub fn fire_bubbling_cancelable_event(&self, name: Atom) -> Root { + pub fn fire_bubbling_cancelable_event(&self, name: Atom) -> DomRoot { self.fire_event_with_params(name, EventBubbles::Bubbles, EventCancelable::Cancelable) @@ -538,7 +538,7 @@ impl EventTarget { name: Atom, bubbles: EventBubbles, cancelable: EventCancelable) - -> Root { + -> DomRoot { let event = Event::new(&self.global(), name, bubbles, cancelable); event.fire(self); event diff --git a/components/script/dom/extendableevent.rs b/components/script/dom/extendableevent.rs index 50ccda70eb76..4af769b2d697 100644 --- a/components/script/dom/extendableevent.rs +++ b/components/script/dom/extendableevent.rs @@ -7,7 +7,7 @@ use dom::bindings::codegen::Bindings::ExtendableEventBinding; use dom::bindings::error::{Error, ErrorResult, Fallible}; use dom::bindings::inheritance::Castable; use dom::bindings::reflector::reflect_dom_object; -use dom::bindings::root::Root; +use dom::bindings::root::DomRoot; use dom::bindings::str::DOMString; use dom::event::Event; use dom::serviceworkerglobalscope::ServiceWorkerGlobalScope; @@ -33,7 +33,7 @@ impl ExtendableEvent { type_: Atom, bubbles: bool, cancelable: bool) - -> Root { + -> DomRoot { let ev = reflect_dom_object(box ExtendableEvent::new_inherited(), worker, ExtendableEventBinding::Wrap); { let event = ev.upcast::(); @@ -44,7 +44,7 @@ impl ExtendableEvent { pub fn Constructor(worker: &ServiceWorkerGlobalScope, type_: DOMString, - init: &ExtendableEventBinding::ExtendableEventInit) -> Fallible> { + init: &ExtendableEventBinding::ExtendableEventInit) -> Fallible> { Ok(ExtendableEvent::new(worker, Atom::from(type_), init.parent.bubbles, diff --git a/components/script/dom/extendablemessageevent.rs b/components/script/dom/extendablemessageevent.rs index 0bc5403620cc..eacc3fb4e8cd 100644 --- a/components/script/dom/extendablemessageevent.rs +++ b/components/script/dom/extendablemessageevent.rs @@ -7,7 +7,7 @@ use dom::bindings::codegen::Bindings::ExtendableMessageEventBinding::ExtendableM use dom::bindings::error::Fallible; use dom::bindings::inheritance::Castable; use dom::bindings::reflector::reflect_dom_object; -use dom::bindings::root::Root; +use dom::bindings::root::DomRoot; use dom::bindings::str::DOMString; use dom::bindings::trace::RootedTraceableBox; use dom::event::Event; @@ -32,7 +32,7 @@ impl ExtendableMessageEvent { pub fn new(global: &GlobalScope, type_: Atom, bubbles: bool, cancelable: bool, data: HandleValue, origin: DOMString, lastEventId: DOMString) - -> Root { + -> DomRoot { let ev = box ExtendableMessageEvent { event: ExtendableEvent::new_inherited(), data: Heap::default(), @@ -52,7 +52,7 @@ impl ExtendableMessageEvent { pub fn Constructor(worker: &ServiceWorkerGlobalScope, type_: DOMString, init: RootedTraceableBox) - -> Fallible> { + -> Fallible> { let global = worker.upcast::(); let ev = ExtendableMessageEvent::new(global, Atom::from(type_), diff --git a/components/script/dom/file.rs b/components/script/dom/file.rs index bcea622d4d8b..1bfd12a26547 100644 --- a/components/script/dom/file.rs +++ b/components/script/dom/file.rs @@ -8,7 +8,7 @@ use dom::bindings::codegen::UnionTypes::BlobOrString; use dom::bindings::error::{Error, Fallible}; use dom::bindings::inheritance::Castable; use dom::bindings::reflector::reflect_dom_object; -use dom::bindings::root::Root; +use dom::bindings::root::DomRoot; use dom::bindings::str::DOMString; use dom::blob::{Blob, BlobImpl, blob_parts_to_bytes}; use dom::globalscope::GlobalScope; @@ -44,14 +44,14 @@ impl File { #[allow(unrooted_must_root)] pub fn new(global: &GlobalScope, blob_impl: BlobImpl, - name: DOMString, modified: Option, typeString: &str) -> Root { + name: DOMString, modified: Option, typeString: &str) -> DomRoot { reflect_dom_object(box File::new_inherited(blob_impl, name, modified, typeString), global, FileBinding::Wrap) } // Construct from selected file message from file manager thread - pub fn new_from_selected(window: &Window, selected: SelectedFile) -> Root { + pub fn new_from_selected(window: &Window, selected: SelectedFile) -> DomRoot { let name = DOMString::from(selected.filename.to_str().expect("File name encoding error")); File::new(window.upcast(), BlobImpl::new_from_file(selected.id, selected.filename, selected.size), @@ -63,7 +63,7 @@ impl File { fileBits: Vec, filename: DOMString, filePropertyBag: &FileBinding::FilePropertyBag) - -> Fallible> { + -> Fallible> { let bytes: Vec = match blob_parts_to_bytes(fileBits) { Ok(bytes) => bytes, Err(_) => return Err(Error::InvalidCharacter), diff --git a/components/script/dom/filelist.rs b/components/script/dom/filelist.rs index 2591419c4906..559f36cbd7c9 100644 --- a/components/script/dom/filelist.rs +++ b/components/script/dom/filelist.rs @@ -5,7 +5,7 @@ use dom::bindings::codegen::Bindings::FileListBinding; use dom::bindings::codegen::Bindings::FileListBinding::FileListMethods; use dom::bindings::reflector::{Reflector, reflect_dom_object}; -use dom::bindings::root::{Dom, Root}; +use dom::bindings::root::{Dom, DomRoot}; use dom::file::File; use dom::window::Window; use dom_struct::dom_struct; @@ -28,7 +28,7 @@ impl FileList { } #[allow(unrooted_must_root)] - pub fn new(window: &Window, files: Vec>) -> Root { + pub fn new(window: &Window, files: Vec>) -> DomRoot { reflect_dom_object(box FileList::new_inherited(files.iter().map(|r| Dom::from_ref(&**r)).collect()), window, FileListBinding::Wrap) @@ -46,16 +46,16 @@ impl FileListMethods for FileList { } // https://w3c.github.io/FileAPI/#dfn-item - fn Item(&self, index: u32) -> Option> { + fn Item(&self, index: u32) -> Option> { if (index as usize) < self.list.len() { - Some(Root::from_ref(&*(self.list[index as usize]))) + Some(DomRoot::from_ref(&*(self.list[index as usize]))) } else { None } } // check-tidy: no specs after this line - fn IndexedGetter(&self, index: u32) -> Option> { + fn IndexedGetter(&self, index: u32) -> Option> { self.Item(index) } } diff --git a/components/script/dom/filereader.rs b/components/script/dom/filereader.rs index d8ed3788f194..5bd964d41880 100644 --- a/components/script/dom/filereader.rs +++ b/components/script/dom/filereader.rs @@ -11,7 +11,7 @@ use dom::bindings::error::{Error, ErrorResult, Fallible}; use dom::bindings::inheritance::Castable; use dom::bindings::refcounted::Trusted; use dom::bindings::reflector::{DomObject, reflect_dom_object}; -use dom::bindings::root::{MutNullableDom, Root}; +use dom::bindings::root::{DomRoot, MutNullableDom}; use dom::bindings::str::DOMString; use dom::bindings::trace::RootedTraceableBox; use dom::blob::Blob; @@ -103,12 +103,12 @@ impl FileReader { } } - pub fn new(global: &GlobalScope) -> Root { + pub fn new(global: &GlobalScope) -> DomRoot { reflect_dom_object(box FileReader::new_inherited(), global, FileReaderBinding::Wrap) } - pub fn Constructor(global: &GlobalScope) -> Fallible> { + pub fn Constructor(global: &GlobalScope) -> Fallible> { Ok(FileReader::new(global)) } @@ -328,7 +328,7 @@ impl FileReaderMethods for FileReader { } // https://w3c.github.io/FileAPI/#dfn-error - fn GetError(&self) -> Option> { + fn GetError(&self) -> Option> { self.error.get() } diff --git a/components/script/dom/filereadersync.rs b/components/script/dom/filereadersync.rs index f6fb8ca85637..a4e75f4bca54 100644 --- a/components/script/dom/filereadersync.rs +++ b/components/script/dom/filereadersync.rs @@ -5,7 +5,7 @@ use dom::bindings::codegen::Bindings::FileReaderSyncBinding; use dom::bindings::error::Fallible; use dom::bindings::reflector::reflect_dom_object; -use dom::bindings::root::Root; +use dom::bindings::root::DomRoot; use dom::eventtarget::EventTarget; use dom::globalscope::GlobalScope; use dom_struct::dom_struct; @@ -22,12 +22,12 @@ impl FileReaderSync { } } - pub fn new(global: &GlobalScope) -> Root { + pub fn new(global: &GlobalScope) -> DomRoot { reflect_dom_object(box FileReaderSync::new_inherited(), global, FileReaderSyncBinding::Wrap) } - pub fn Constructor(global: &GlobalScope) -> Fallible> { + pub fn Constructor(global: &GlobalScope) -> Fallible> { Ok(FileReaderSync::new(global)) } } diff --git a/components/script/dom/focusevent.rs b/components/script/dom/focusevent.rs index 10d78227aa24..de689683b6b2 100644 --- a/components/script/dom/focusevent.rs +++ b/components/script/dom/focusevent.rs @@ -8,7 +8,7 @@ use dom::bindings::codegen::Bindings::UIEventBinding::UIEventMethods; use dom::bindings::error::Fallible; use dom::bindings::inheritance::Castable; use dom::bindings::reflector::reflect_dom_object; -use dom::bindings::root::{MutNullableDom, Root, RootedReference}; +use dom::bindings::root::{DomRoot, MutNullableDom, RootedReference}; use dom::bindings::str::DOMString; use dom::event::{EventBubbles, EventCancelable}; use dom::eventtarget::EventTarget; @@ -31,7 +31,7 @@ impl FocusEvent { } } - pub fn new_uninitialized(window: &Window) -> Root { + pub fn new_uninitialized(window: &Window) -> DomRoot { reflect_dom_object(box FocusEvent::new_inherited(), window, FocusEventBinding::Wrap) @@ -43,7 +43,7 @@ impl FocusEvent { cancelable: EventCancelable, view: Option<&Window>, detail: i32, - related_target: Option<&EventTarget>) -> Root { + related_target: Option<&EventTarget>) -> DomRoot { let ev = FocusEvent::new_uninitialized(window); ev.upcast::().InitUIEvent(type_, bool::from(can_bubble), @@ -55,7 +55,7 @@ impl FocusEvent { pub fn Constructor(window: &Window, type_: DOMString, - init: &FocusEventBinding::FocusEventInit) -> Fallible> { + init: &FocusEventBinding::FocusEventInit) -> Fallible> { let bubbles = EventBubbles::from(init.parent.parent.bubbles); let cancelable = EventCancelable::from(init.parent.parent.cancelable); let event = FocusEvent::new(window, @@ -71,7 +71,7 @@ impl FocusEvent { impl FocusEventMethods for FocusEvent { // https://w3c.github.io/uievents/#widl-FocusEvent-relatedTarget - fn GetRelatedTarget(&self) -> Option> { + fn GetRelatedTarget(&self) -> Option> { self.related_target.get() } diff --git a/components/script/dom/forcetouchevent.rs b/components/script/dom/forcetouchevent.rs index 6ac5ea83206e..b1159a578473 100644 --- a/components/script/dom/forcetouchevent.rs +++ b/components/script/dom/forcetouchevent.rs @@ -8,7 +8,7 @@ use dom::bindings::codegen::Bindings::UIEventBinding::UIEventMethods; use dom::bindings::inheritance::Castable; use dom::bindings::num::Finite; use dom::bindings::reflector::reflect_dom_object; -use dom::bindings::root::Root; +use dom::bindings::root::DomRoot; use dom::bindings::str::DOMString; use dom::uievent::UIEvent; use dom::window::Window; @@ -30,7 +30,7 @@ impl ForceTouchEvent { pub fn new(window: &Window, type_: DOMString, - force: f32) -> Root { + force: f32) -> DomRoot { let event = box ForceTouchEvent::new_inherited(force); let ev = reflect_dom_object(event, window, ForceTouchEventBinding::Wrap); ev.upcast::().InitUIEvent(type_, true, true, Some(window), 0); diff --git a/components/script/dom/formdata.rs b/components/script/dom/formdata.rs index 100684505dd5..f97b425883a2 100644 --- a/components/script/dom/formdata.rs +++ b/components/script/dom/formdata.rs @@ -10,7 +10,7 @@ use dom::bindings::error::Fallible; use dom::bindings::inheritance::Castable; use dom::bindings::iterable::Iterable; use dom::bindings::reflector::{DomObject, Reflector, reflect_dom_object}; -use dom::bindings::root::Root; +use dom::bindings::root::DomRoot; use dom::bindings::str::{DOMString, USVString}; use dom::blob::{Blob, BlobImpl}; use dom::file::File; @@ -47,12 +47,12 @@ impl FormData { } } - pub fn new(form: Option<&HTMLFormElement>, global: &GlobalScope) -> Root { + pub fn new(form: Option<&HTMLFormElement>, global: &GlobalScope) -> DomRoot { reflect_dom_object(box FormData::new_inherited(form), global, FormDataWrap) } - pub fn Constructor(global: &GlobalScope, form: Option<&HTMLFormElement>) -> Fallible> { + pub fn Constructor(global: &GlobalScope, form: Option<&HTMLFormElement>) -> Fallible> { // TODO: Construct form data set for form if it is supplied Ok(FormData::new(form, global)) } @@ -80,7 +80,7 @@ impl FormDataMethods for FormData { let datum = FormDatum { ty: DOMString::from("file"), name: DOMString::from(name.0.clone()), - value: FormDatumValue::File(Root::from_ref(&*self.create_an_entry(blob, filename))), + value: FormDatumValue::File(DomRoot::from_ref(&*self.create_an_entry(blob, filename))), }; let mut data = self.data.borrow_mut(); @@ -102,7 +102,7 @@ impl FormDataMethods for FormData { .get(&LocalName::from(name.0)) .map(|entry| match entry[0].value { FormDatumValue::String(ref s) => FileOrUSVString::USVString(USVString(s.to_string())), - FormDatumValue::File(ref b) => FileOrUSVString::File(Root::from_ref(&*b)), + FormDatumValue::File(ref b) => FileOrUSVString::File(DomRoot::from_ref(&*b)), }) } @@ -113,7 +113,7 @@ impl FormDataMethods for FormData { .map_or(vec![], |data| data.iter().map(|item| match item.value { FormDatumValue::String(ref s) => FileOrUSVString::USVString(USVString(s.to_string())), - FormDatumValue::File(ref b) => FileOrUSVString::File(Root::from_ref(&*b)), + FormDatumValue::File(ref b) => FileOrUSVString::File(DomRoot::from_ref(&*b)), }).collect() ) } @@ -138,7 +138,7 @@ impl FormDataMethods for FormData { self.data.borrow_mut().insert(LocalName::from(name.0.clone()), vec![FormDatum { ty: DOMString::from("file"), name: DOMString::from(name.0), - value: FormDatumValue::File(Root::from_ref(&*self.create_an_entry(blob, filename))), + value: FormDatumValue::File(DomRoot::from_ref(&*self.create_an_entry(blob, filename))), }]); } @@ -148,7 +148,7 @@ impl FormDataMethods for FormData { impl FormData { // https://xhr.spec.whatwg.org/#create-an-entry // Steps 3-4. - fn create_an_entry(&self, blob: &Blob, opt_filename: Option) -> Root { + fn create_an_entry(&self, blob: &Blob, opt_filename: Option) -> DomRoot { let name = match opt_filename { Some(filename) => DOMString::from(filename.0), None if blob.downcast::().is_none() => DOMString::from("blob"), @@ -185,7 +185,7 @@ impl Iterable for FormData { .value; match *value { FormDatumValue::String(ref s) => FileOrUSVString::USVString(USVString(s.to_string())), - FormDatumValue::File(ref b) => FileOrUSVString::File(Root::from_ref(&*b)), + FormDatumValue::File(ref b) => FileOrUSVString::File(DomRoot::from_ref(&*b)), } } diff --git a/components/script/dom/gamepad.rs b/components/script/dom/gamepad.rs index 0b6dd7af6f52..39e76818906e 100644 --- a/components/script/dom/gamepad.rs +++ b/components/script/dom/gamepad.rs @@ -8,7 +8,7 @@ use dom::bindings::codegen::Bindings::GamepadBinding::GamepadMethods; use dom::bindings::inheritance::Castable; use dom::bindings::num::Finite; use dom::bindings::reflector::{DomObject, Reflector, reflect_dom_object}; -use dom::bindings::root::{Dom, Root}; +use dom::bindings::root::{Dom, DomRoot}; use dom::bindings::str::DOMString; use dom::event::Event; use dom::eventtarget::EventTarget; @@ -71,7 +71,7 @@ impl Gamepad { pub fn new_from_vr(global: &GlobalScope, index: i32, data: &WebVRGamepadData, - state: &WebVRGamepadState) -> Root { + state: &WebVRGamepadState) -> DomRoot { let buttons = GamepadButtonList::new_from_vr(&global, &state.buttons); let pose = VRPose::new(&global, &state.pose); @@ -132,8 +132,8 @@ impl GamepadMethods for Gamepad { } // https://w3c.github.io/gamepad/#dom-gamepad-buttons - fn Buttons(&self) -> Root { - Root::from_ref(&*self.buttons) + fn Buttons(&self) -> DomRoot { + DomRoot::from_ref(&*self.buttons) } // https://w3c.github.io/gamepad/extensions.html#gamepadhand-enum @@ -147,8 +147,8 @@ impl GamepadMethods for Gamepad { } // https://w3c.github.io/gamepad/extensions.html#dom-gamepad-pose - fn GetPose(&self) -> Option> { - self.pose.as_ref().map(|p| Root::from_ref(&**p)) + fn GetPose(&self) -> Option> { + self.pose.as_ref().map(|p| DomRoot::from_ref(&**p)) } // https://w3c.github.io/webvr/spec/1.1/#gamepad-getvrdisplays-attribute diff --git a/components/script/dom/gamepadbutton.rs b/components/script/dom/gamepadbutton.rs index f896b39f3c61..1fc93941f9cc 100644 --- a/components/script/dom/gamepadbutton.rs +++ b/components/script/dom/gamepadbutton.rs @@ -6,7 +6,7 @@ use dom::bindings::codegen::Bindings::GamepadButtonBinding; use dom::bindings::codegen::Bindings::GamepadButtonBinding::GamepadButtonMethods; use dom::bindings::num::Finite; use dom::bindings::reflector::{Reflector, reflect_dom_object}; -use dom::bindings::root::Root; +use dom::bindings::root::DomRoot; use dom::globalscope::GlobalScope; use dom_struct::dom_struct; use std::cell::Cell; @@ -29,7 +29,7 @@ impl GamepadButton { } } - pub fn new(global: &GlobalScope, pressed: bool, touched: bool) -> Root { + pub fn new(global: &GlobalScope, pressed: bool, touched: bool) -> DomRoot { reflect_dom_object(box GamepadButton::new_inherited(pressed, touched), global, GamepadButtonBinding::Wrap) diff --git a/components/script/dom/gamepadbuttonlist.rs b/components/script/dom/gamepadbuttonlist.rs index aa741efc59ea..809760baca29 100644 --- a/components/script/dom/gamepadbuttonlist.rs +++ b/components/script/dom/gamepadbuttonlist.rs @@ -5,7 +5,7 @@ use dom::bindings::codegen::Bindings::GamepadButtonListBinding; use dom::bindings::codegen::Bindings::GamepadButtonListBinding::GamepadButtonListMethods; use dom::bindings::reflector::{Reflector, reflect_dom_object}; -use dom::bindings::root::{Dom, Root, RootedReference}; +use dom::bindings::root::{Dom, DomRoot, RootedReference}; use dom::gamepadbutton::GamepadButton; use dom::globalscope::GlobalScope; use dom_struct::dom_struct; @@ -27,7 +27,7 @@ impl GamepadButtonList { } } - pub fn new_from_vr(global: &GlobalScope, buttons: &[WebVRGamepadButton]) -> Root { + pub fn new_from_vr(global: &GlobalScope, buttons: &[WebVRGamepadButton]) -> DomRoot { rooted_vec!(let list <- buttons.iter() .map(|btn| GamepadButton::new(&global, btn.pressed, btn.touched))); @@ -52,12 +52,12 @@ impl GamepadButtonListMethods for GamepadButtonList { } // https://w3c.github.io/gamepad/#dom-gamepad-buttons - fn Item(&self, index: u32) -> Option> { - self.list.get(index as usize).map(|button| Root::from_ref(&**button)) + fn Item(&self, index: u32) -> Option> { + self.list.get(index as usize).map(|button| DomRoot::from_ref(&**button)) } // https://w3c.github.io/gamepad/#dom-gamepad-buttons - fn IndexedGetter(&self, index: u32) -> Option> { + fn IndexedGetter(&self, index: u32) -> Option> { self.Item(index) } } diff --git a/components/script/dom/gamepadevent.rs b/components/script/dom/gamepadevent.rs index 807cdc427696..644713be2256 100644 --- a/components/script/dom/gamepadevent.rs +++ b/components/script/dom/gamepadevent.rs @@ -8,7 +8,7 @@ use dom::bindings::codegen::Bindings::GamepadEventBinding::GamepadEventMethods; use dom::bindings::error::Fallible; use dom::bindings::inheritance::Castable; use dom::bindings::reflector::{DomObject, reflect_dom_object}; -use dom::bindings::root::{Dom, Root}; +use dom::bindings::root::{Dom, DomRoot}; use dom::bindings::str::DOMString; use dom::event::Event; use dom::gamepad::Gamepad; @@ -41,7 +41,7 @@ impl GamepadEvent { bubbles: bool, cancelable: bool, gamepad: &Gamepad) - -> Root { + -> DomRoot { let ev = reflect_dom_object(box GamepadEvent::new_inherited(&gamepad), global, GamepadEventBinding::Wrap); @@ -53,7 +53,7 @@ impl GamepadEvent { } pub fn new_with_type(global: &GlobalScope, event_type: GamepadEventType, gamepad: &Gamepad) - -> Root { + -> DomRoot { let name = match event_type { GamepadEventType::Connected => "gamepadconnected", GamepadEventType::Disconnected => "gamepaddisconnected" @@ -70,7 +70,7 @@ impl GamepadEvent { pub fn Constructor(window: &Window, type_: DOMString, init: &GamepadEventBinding::GamepadEventInit) - -> Fallible> { + -> Fallible> { Ok(GamepadEvent::new(&window.global(), Atom::from(type_), init.parent.bubbles, @@ -81,8 +81,8 @@ impl GamepadEvent { impl GamepadEventMethods for GamepadEvent { // https://w3c.github.io/gamepad/#gamepadevent-interface - fn Gamepad(&self) -> Root { - Root::from_ref(&*self.gamepad) + fn Gamepad(&self) -> DomRoot { + DomRoot::from_ref(&*self.gamepad) } // https://dom.spec.whatwg.org/#dom-event-istrusted diff --git a/components/script/dom/gamepadlist.rs b/components/script/dom/gamepadlist.rs index 26e78cda654c..bcbb71314565 100644 --- a/components/script/dom/gamepadlist.rs +++ b/components/script/dom/gamepadlist.rs @@ -6,7 +6,7 @@ use dom::bindings::cell::DomRefCell; use dom::bindings::codegen::Bindings::GamepadListBinding; use dom::bindings::codegen::Bindings::GamepadListBinding::GamepadListMethods; use dom::bindings::reflector::{Reflector, reflect_dom_object}; -use dom::bindings::root::{Dom, Root}; +use dom::bindings::root::{Dom, DomRoot}; use dom::gamepad::Gamepad; use dom::globalscope::GlobalScope; use dom_struct::dom_struct; @@ -26,13 +26,13 @@ impl GamepadList { } } - pub fn new(global: &GlobalScope, list: &[&Gamepad]) -> Root { + pub fn new(global: &GlobalScope, list: &[&Gamepad]) -> DomRoot { reflect_dom_object(box GamepadList::new_inherited(list), global, GamepadListBinding::Wrap) } - pub fn add_if_not_exists(&self, gamepads: &[Root]) { + pub fn add_if_not_exists(&self, gamepads: &[DomRoot]) { for gamepad in gamepads { if !self.list.borrow().iter().any(|g| g.gamepad_id() == gamepad.gamepad_id()) { self.list.borrow_mut().push(Dom::from_ref(&*gamepad)); @@ -50,12 +50,12 @@ impl GamepadListMethods for GamepadList { } // https://w3c.github.io/gamepad/#dom-navigator-getgamepads - fn Item(&self, index: u32) -> Option> { - self.list.borrow().get(index as usize).map(|gamepad| Root::from_ref(&**gamepad)) + fn Item(&self, index: u32) -> Option> { + self.list.borrow().get(index as usize).map(|gamepad| DomRoot::from_ref(&**gamepad)) } // https://w3c.github.io/gamepad/#dom-navigator-getgamepads - fn IndexedGetter(&self, index: u32) -> Option> { + fn IndexedGetter(&self, index: u32) -> Option> { self.Item(index) } } diff --git a/components/script/dom/globalscope.rs b/components/script/dom/globalscope.rs index ed5ed5cd941b..386231ac6e35 100644 --- a/components/script/dom/globalscope.rs +++ b/components/script/dom/globalscope.rs @@ -10,7 +10,7 @@ use dom::bindings::conversions::root_from_object; use dom::bindings::error::{ErrorInfo, report_pending_exception}; use dom::bindings::inheritance::Castable; use dom::bindings::reflector::DomObject; -use dom::bindings::root::{MutNullableDom, Root}; +use dom::bindings::root::{DomRoot, MutNullableDom}; use dom::bindings::settings_stack::{AutoEntryScript, entry_global, incumbent_global}; use dom::bindings::str::DOMString; use dom::crypto::Crypto; @@ -148,13 +148,13 @@ impl GlobalScope { /// Returns the global scope of the realm that the given DOM object's reflector /// was created in. #[allow(unsafe_code)] - pub fn from_reflector(reflector: &T) -> Root { + pub fn from_reflector(reflector: &T) -> DomRoot { unsafe { GlobalScope::from_object(*reflector.reflector().get_jsobject()) } } /// Returns the global scope of the realm that the given JS object was created in. #[allow(unsafe_code)] - pub unsafe fn from_object(obj: *mut JSObject) -> Root { + pub unsafe fn from_object(obj: *mut JSObject) -> DomRoot { assert!(!obj.is_null()); let global = GetGlobalForObjectCrossCompartment(obj); global_scope_from_global(global) @@ -162,7 +162,7 @@ impl GlobalScope { /// Returns the global scope for the given JSContext #[allow(unsafe_code)] - pub unsafe fn from_context(cx: *mut JSContext) -> Root { + pub unsafe fn from_context(cx: *mut JSContext) -> DomRoot { let global = CurrentGlobalOrNull(cx); global_scope_from_global(global) } @@ -170,7 +170,7 @@ impl GlobalScope { /// Returns the global object of the realm that the given JS object /// was created in, after unwrapping any wrappers. #[allow(unsafe_code)] - pub unsafe fn from_object_maybe_wrapped(mut obj: *mut JSObject) -> Root { + pub unsafe fn from_object_maybe_wrapped(mut obj: *mut JSObject) -> DomRoot { if IsWrapper(obj) { obj = UnwrapObject(obj, /* stopAtWindowProxy = */ 0); assert!(!obj.is_null()); @@ -190,7 +190,7 @@ impl GlobalScope { } } - pub fn crypto(&self) -> Root { + pub fn crypto(&self) -> DomRoot { self.crypto.or_init(|| Crypto::new(self)) } @@ -496,7 +496,7 @@ impl GlobalScope { /// Perform a microtask checkpoint. pub fn perform_a_microtask_checkpoint(&self) { - self.microtask_queue.checkpoint(|_| Some(Root::from_ref(self))); + self.microtask_queue.checkpoint(|_| Some(DomRoot::from_ref(self))); } /// Enqueue a microtask for subsequent execution. @@ -550,7 +550,7 @@ impl GlobalScope { /// /// ["current"]: https://html.spec.whatwg.org/multipage/#current #[allow(unsafe_code)] - pub fn current() -> Option> { + pub fn current() -> Option> { unsafe { let cx = Runtime::get(); assert!(!cx.is_null()); @@ -566,18 +566,18 @@ impl GlobalScope { /// Returns the ["entry"] global object. /// /// ["entry"]: https://html.spec.whatwg.org/multipage/#entry - pub fn entry() -> Root { + pub fn entry() -> DomRoot { entry_global() } /// Returns the ["incumbent"] global object. /// /// ["incumbent"]: https://html.spec.whatwg.org/multipage/#incumbent - pub fn incumbent() -> Option> { + pub fn incumbent() -> Option> { incumbent_global() } - pub fn performance(&self) -> Root { + pub fn performance(&self) -> DomRoot { if let Some(window) = self.downcast::() { return window.Performance(); } @@ -607,7 +607,7 @@ fn timestamp_in_ms(time: Timespec) -> u64 { /// Returns the Rust global scope from a JS global object. #[allow(unsafe_code)] -unsafe fn global_scope_from_global(global: *mut JSObject) -> Root { +unsafe fn global_scope_from_global(global: *mut JSObject) -> DomRoot { assert!(!global.is_null()); let clasp = get_object_class(global); assert!(((*clasp).flags & (JSCLASS_IS_DOMJSCLASS | JSCLASS_IS_GLOBAL)) != 0); diff --git a/components/script/dom/hashchangeevent.rs b/components/script/dom/hashchangeevent.rs index 4d374685ec65..16dad9f60784 100644 --- a/components/script/dom/hashchangeevent.rs +++ b/components/script/dom/hashchangeevent.rs @@ -8,7 +8,7 @@ use dom::bindings::codegen::Bindings::HashChangeEventBinding::HashChangeEventMet use dom::bindings::error::Fallible; use dom::bindings::inheritance::Castable; use dom::bindings::reflector::reflect_dom_object; -use dom::bindings::root::Root; +use dom::bindings::root::DomRoot; use dom::bindings::str::{DOMString, USVString}; use dom::event::Event; use dom::window::Window; @@ -32,7 +32,7 @@ impl HashChangeEvent { } } - pub fn new_uninitialized(window: &Window) -> Root { + pub fn new_uninitialized(window: &Window) -> DomRoot { reflect_dom_object(box HashChangeEvent::new_inherited(String::new(), String::new()), window, HashChangeEventBinding::Wrap) @@ -44,7 +44,7 @@ impl HashChangeEvent { cancelable: bool, old_url: String, new_url: String) - -> Root { + -> DomRoot { let ev = reflect_dom_object(box HashChangeEvent::new_inherited(old_url, new_url), window, HashChangeEventBinding::Wrap); @@ -58,7 +58,7 @@ impl HashChangeEvent { pub fn Constructor(window: &Window, type_: DOMString, init: &HashChangeEventBinding::HashChangeEventInit) - -> Fallible> { + -> Fallible> { Ok(HashChangeEvent::new(window, Atom::from(type_), init.parent.bubbles, diff --git a/components/script/dom/headers.rs b/components/script/dom/headers.rs index 7bd2eeff8e2a..2baa604b058c 100644 --- a/components/script/dom/headers.rs +++ b/components/script/dom/headers.rs @@ -7,7 +7,7 @@ use dom::bindings::codegen::Bindings::HeadersBinding::{HeadersInit, HeadersMetho use dom::bindings::error::{Error, ErrorResult, Fallible}; use dom::bindings::iterable::Iterable; use dom::bindings::reflector::{Reflector, reflect_dom_object}; -use dom::bindings::root::Root; +use dom::bindings::root::DomRoot; use dom::bindings::str::{ByteString, is_token}; use dom::globalscope::GlobalScope; use dom_struct::dom_struct; @@ -44,13 +44,13 @@ impl Headers { } } - pub fn new(global: &GlobalScope) -> Root { + pub fn new(global: &GlobalScope) -> DomRoot { reflect_dom_object(box Headers::new_inherited(), global, HeadersWrap) } // https://fetch.spec.whatwg.org/#dom-headers pub fn Constructor(global: &GlobalScope, init: Option) - -> Fallible> { + -> Fallible> { let dom_headers_new = Headers::new(global); dom_headers_new.fill(init)?; Ok(dom_headers_new) @@ -206,13 +206,13 @@ impl Headers { } } - pub fn for_request(global: &GlobalScope) -> Root { + pub fn for_request(global: &GlobalScope) -> DomRoot { let headers_for_request = Headers::new(global); headers_for_request.guard.set(Guard::Request); headers_for_request } - pub fn for_response(global: &GlobalScope) -> Root { + pub fn for_response(global: &GlobalScope) -> DomRoot { let headers_for_response = Headers::new(global); headers_for_response.guard.set(Guard::Response); headers_for_response diff --git a/components/script/dom/history.rs b/components/script/dom/history.rs index 7cca59380b6d..9e97a3d5e955 100644 --- a/components/script/dom/history.rs +++ b/components/script/dom/history.rs @@ -9,7 +9,7 @@ use dom::bindings::codegen::Bindings::WindowBinding::WindowMethods; use dom::bindings::error::{Error, ErrorResult, Fallible}; use dom::bindings::inheritance::Castable; use dom::bindings::reflector::{Reflector, reflect_dom_object}; -use dom::bindings::root::{Dom, Root}; +use dom::bindings::root::{Dom, DomRoot}; use dom::globalscope::GlobalScope; use dom::window::Window; use dom_struct::dom_struct; @@ -32,7 +32,7 @@ impl History { } } - pub fn new(window: &Window) -> Root { + pub fn new(window: &Window) -> DomRoot { reflect_dom_object(box History::new_inherited(window), window, HistoryBinding::Wrap) diff --git a/components/script/dom/htmlanchorelement.rs b/components/script/dom/htmlanchorelement.rs index bb5c1b67d69e..5909480eb95d 100644 --- a/components/script/dom/htmlanchorelement.rs +++ b/components/script/dom/htmlanchorelement.rs @@ -11,7 +11,7 @@ use dom::bindings::codegen::Bindings::HTMLAnchorElementBinding::HTMLAnchorElemen use dom::bindings::codegen::Bindings::MouseEventBinding::MouseEventMethods; use dom::bindings::codegen::Bindings::NodeBinding::NodeMethods; use dom::bindings::inheritance::Castable; -use dom::bindings::root::{MutNullableDom, Root}; +use dom::bindings::root::{DomRoot, MutNullableDom}; use dom::bindings::str::{DOMString, USVString}; use dom::document::Document; use dom::domtokenlist::DOMTokenList; @@ -56,7 +56,7 @@ impl HTMLAnchorElement { #[allow(unrooted_must_root)] pub fn new(local_name: LocalName, prefix: Option, - document: &Document) -> Root { + document: &Document) -> DomRoot { Node::reflect_node(box HTMLAnchorElement::new_inherited(local_name, prefix, document), document, HTMLAnchorElementBinding::Wrap) @@ -122,7 +122,7 @@ impl HTMLAnchorElementMethods for HTMLAnchorElement { } // https://html.spec.whatwg.org/multipage/#dom-a-rellist - fn RelList(&self) -> Root { + fn RelList(&self) -> DomRoot { self.rel_list.or_init(|| DOMTokenList::new(self.upcast(), &local_name!("rel"))) } diff --git a/components/script/dom/htmlappletelement.rs b/components/script/dom/htmlappletelement.rs index 61431c6b4478..a28475442837 100644 --- a/components/script/dom/htmlappletelement.rs +++ b/components/script/dom/htmlappletelement.rs @@ -5,7 +5,7 @@ use dom::bindings::codegen::Bindings::HTMLAppletElementBinding; use dom::bindings::codegen::Bindings::HTMLAppletElementBinding::HTMLAppletElementMethods; use dom::bindings::inheritance::Castable; -use dom::bindings::root::Root; +use dom::bindings::root::DomRoot; use dom::bindings::str::DOMString; use dom::document::Document; use dom::htmlelement::HTMLElement; @@ -33,7 +33,7 @@ impl HTMLAppletElement { #[allow(unrooted_must_root)] pub fn new(local_name: LocalName, prefix: Option, - document: &Document) -> Root { + document: &Document) -> DomRoot { Node::reflect_node(box HTMLAppletElement::new_inherited(local_name, prefix, document), document, HTMLAppletElementBinding::Wrap) diff --git a/components/script/dom/htmlareaelement.rs b/components/script/dom/htmlareaelement.rs index 2ea9dfa40066..859c1081e97e 100644 --- a/components/script/dom/htmlareaelement.rs +++ b/components/script/dom/htmlareaelement.rs @@ -7,7 +7,7 @@ use dom::bindings::codegen::Bindings::DOMTokenListBinding::DOMTokenListMethods; use dom::bindings::codegen::Bindings::HTMLAreaElementBinding; use dom::bindings::codegen::Bindings::HTMLAreaElementBinding::HTMLAreaElementMethods; use dom::bindings::inheritance::Castable; -use dom::bindings::root::{MutNullableDom, Root}; +use dom::bindings::root::{DomRoot, MutNullableDom}; use dom::bindings::str::DOMString; use dom::document::Document; use dom::domtokenlist::DOMTokenList; @@ -231,7 +231,7 @@ impl HTMLAreaElement { #[allow(unrooted_must_root)] pub fn new(local_name: LocalName, prefix: Option, - document: &Document) -> Root { + document: &Document) -> DomRoot { Node::reflect_node(box HTMLAreaElement::new_inherited(local_name, prefix, document), document, HTMLAreaElementBinding::Wrap) @@ -273,7 +273,7 @@ impl VirtualMethods for HTMLAreaElement { impl HTMLAreaElementMethods for HTMLAreaElement { // https://html.spec.whatwg.org/multipage/#dom-area-rellist - fn RelList(&self) -> Root { + fn RelList(&self) -> DomRoot { self.rel_list.or_init(|| { DOMTokenList::new(self.upcast(), &local_name!("rel")) }) diff --git a/components/script/dom/htmlaudioelement.rs b/components/script/dom/htmlaudioelement.rs index ed0b0093900c..456baaa23168 100644 --- a/components/script/dom/htmlaudioelement.rs +++ b/components/script/dom/htmlaudioelement.rs @@ -3,7 +3,7 @@ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ use dom::bindings::codegen::Bindings::HTMLAudioElementBinding; -use dom::bindings::root::Root; +use dom::bindings::root::DomRoot; use dom::document::Document; use dom::htmlmediaelement::HTMLMediaElement; use dom::node::Node; @@ -28,7 +28,7 @@ impl HTMLAudioElement { #[allow(unrooted_must_root)] pub fn new(local_name: LocalName, prefix: Option, - document: &Document) -> Root { + document: &Document) -> DomRoot { Node::reflect_node(box HTMLAudioElement::new_inherited(local_name, prefix, document), document, HTMLAudioElementBinding::Wrap) diff --git a/components/script/dom/htmlbaseelement.rs b/components/script/dom/htmlbaseelement.rs index 0ae261d290c8..ada9539833a6 100644 --- a/components/script/dom/htmlbaseelement.rs +++ b/components/script/dom/htmlbaseelement.rs @@ -6,7 +6,7 @@ use dom::attr::Attr; use dom::bindings::codegen::Bindings::HTMLBaseElementBinding; use dom::bindings::codegen::Bindings::HTMLBaseElementBinding::HTMLBaseElementMethods; use dom::bindings::inheritance::Castable; -use dom::bindings::root::Root; +use dom::bindings::root::DomRoot; use dom::bindings::str::DOMString; use dom::document::Document; use dom::element::{AttributeMutation, Element}; @@ -33,7 +33,7 @@ impl HTMLBaseElement { #[allow(unrooted_must_root)] pub fn new(local_name: LocalName, prefix: Option, - document: &Document) -> Root { + document: &Document) -> DomRoot { Node::reflect_node(box HTMLBaseElement::new_inherited(local_name, prefix, document), document, HTMLBaseElementBinding::Wrap) diff --git a/components/script/dom/htmlbodyelement.rs b/components/script/dom/htmlbodyelement.rs index 3ec993ca3df8..4ade5560700b 100644 --- a/components/script/dom/htmlbodyelement.rs +++ b/components/script/dom/htmlbodyelement.rs @@ -7,7 +7,7 @@ use dom::attr::Attr; use dom::bindings::codegen::Bindings::HTMLBodyElementBinding::{self, HTMLBodyElementMethods}; use dom::bindings::codegen::Bindings::WindowBinding::WindowMethods; use dom::bindings::inheritance::Castable; -use dom::bindings::root::{LayoutDom, Root}; +use dom::bindings::root::{LayoutDom, DomRoot}; use dom::bindings::str::DOMString; use dom::document::Document; use dom::element::{AttributeMutation, Element, RawLayoutElementHelpers}; @@ -42,7 +42,7 @@ impl HTMLBodyElement { #[allow(unrooted_must_root)] pub fn new(local_name: LocalName, prefix: Option, document: &Document) - -> Root { + -> DomRoot { Node::reflect_node(box HTMLBodyElement::new_inherited(local_name, prefix, document), document, HTMLBodyElementBinding::Wrap) diff --git a/components/script/dom/htmlbrelement.rs b/components/script/dom/htmlbrelement.rs index 4be8cd477729..fa782cf35645 100644 --- a/components/script/dom/htmlbrelement.rs +++ b/components/script/dom/htmlbrelement.rs @@ -3,7 +3,7 @@ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ use dom::bindings::codegen::Bindings::HTMLBRElementBinding; -use dom::bindings::root::Root; +use dom::bindings::root::DomRoot; use dom::document::Document; use dom::htmlelement::HTMLElement; use dom::node::Node; @@ -25,7 +25,7 @@ impl HTMLBRElement { #[allow(unrooted_must_root)] pub fn new(local_name: LocalName, prefix: Option, - document: &Document) -> Root { + document: &Document) -> DomRoot { Node::reflect_node(box HTMLBRElement::new_inherited(local_name, prefix, document), document, HTMLBRElementBinding::Wrap) diff --git a/components/script/dom/htmlbuttonelement.rs b/components/script/dom/htmlbuttonelement.rs index 37997c93702c..aea8bf5c5857 100755 --- a/components/script/dom/htmlbuttonelement.rs +++ b/components/script/dom/htmlbuttonelement.rs @@ -7,7 +7,7 @@ use dom::attr::Attr; use dom::bindings::codegen::Bindings::HTMLButtonElementBinding; use dom::bindings::codegen::Bindings::HTMLButtonElementBinding::HTMLButtonElementMethods; use dom::bindings::inheritance::Castable; -use dom::bindings::root::{MutNullableDom, Root}; +use dom::bindings::root::{DomRoot, MutNullableDom}; use dom::bindings::str::DOMString; use dom::document::Document; use dom::element::{AttributeMutation, Element}; @@ -61,7 +61,7 @@ impl HTMLButtonElement { #[allow(unrooted_must_root)] pub fn new(local_name: LocalName, prefix: Option, - document: &Document) -> Root { + document: &Document) -> DomRoot { Node::reflect_node(box HTMLButtonElement::new_inherited(local_name, prefix, document), document, HTMLButtonElementBinding::Wrap) @@ -70,7 +70,7 @@ impl HTMLButtonElement { impl HTMLButtonElementMethods for HTMLButtonElement { // https://html.spec.whatwg.org/multipage/#dom-cva-validity - fn Validity(&self) -> Root { + fn Validity(&self) -> DomRoot { let window = window_from_node(self); ValidityState::new(&window, self.upcast()) } @@ -82,7 +82,7 @@ impl HTMLButtonElementMethods for HTMLButtonElement { make_bool_setter!(SetDisabled, "disabled"); // https://html.spec.whatwg.org/multipage/#dom-fae-form - fn GetForm(&self) -> Option> { + fn GetForm(&self) -> Option> { self.form_owner() } @@ -138,7 +138,7 @@ impl HTMLButtonElementMethods for HTMLButtonElement { make_setter!(SetValue, "value"); // https://html.spec.whatwg.org/multipage/#dom-lfe-labels - fn Labels(&self) -> Root { + fn Labels(&self) -> DomRoot { self.upcast::().labels() } } @@ -244,7 +244,7 @@ impl VirtualMethods for HTMLButtonElement { } impl FormControl for HTMLButtonElement { - fn form_owner(&self) -> Option> { + fn form_owner(&self) -> Option> { self.form_owner.get() } @@ -319,7 +319,7 @@ impl Activatable for HTMLButtonElement { return; } node.query_selector_iter(DOMString::from("button[type=submit]")).unwrap() - .filter_map(Root::downcast::) + .filter_map(DomRoot::downcast::) .find(|r| r.form_owner() == owner) .map(|s| synthetic_click_activation(s.as_element(), ctrl_key, diff --git a/components/script/dom/htmlcanvaselement.rs b/components/script/dom/htmlcanvaselement.rs index d277c85fd8a2..c624d5d9fdaa 100644 --- a/components/script/dom/htmlcanvaselement.rs +++ b/components/script/dom/htmlcanvaselement.rs @@ -15,7 +15,7 @@ use dom::bindings::conversions::ConversionResult; use dom::bindings::error::{Error, Fallible}; use dom::bindings::inheritance::Castable; use dom::bindings::num::Finite; -use dom::bindings::root::{Dom, LayoutDom, Root}; +use dom::bindings::root::{Dom, DomRoot, LayoutDom}; use dom::bindings::str::DOMString; use dom::canvasrenderingcontext2d::{CanvasRenderingContext2D, LayoutCanvasRenderingContext2DHelpers}; use dom::document::Document; @@ -67,7 +67,7 @@ impl HTMLCanvasElement { #[allow(unrooted_must_root)] pub fn new(local_name: LocalName, prefix: Option, - document: &Document) -> Root { + document: &Document) -> DomRoot { Node::reflect_node(box HTMLCanvasElement::new_inherited(local_name, prefix, document), document, HTMLCanvasElementBinding::Wrap) @@ -151,7 +151,7 @@ impl LayoutHTMLCanvasElementHelpers for LayoutDom { impl HTMLCanvasElement { - pub fn get_or_init_2d_context(&self) -> Option> { + pub fn get_or_init_2d_context(&self) -> Option> { if self.context.borrow().is_none() { let window = window_from_node(self); let size = self.get_size(); @@ -160,7 +160,7 @@ impl HTMLCanvasElement { } match *self.context.borrow().as_ref().unwrap() { - CanvasContext::Context2d(ref context) => Some(Root::from_ref(&*context)), + CanvasContext::Context2d(ref context) => Some(DomRoot::from_ref(&*context)), _ => None, } } @@ -168,7 +168,7 @@ impl HTMLCanvasElement { #[allow(unsafe_code)] pub fn get_or_init_webgl_context(&self, cx: *mut JSContext, - attrs: Option) -> Option> { + attrs: Option) -> Option> { if self.context.borrow().is_none() { let window = window_from_node(self); let size = self.get_size(); @@ -196,7 +196,7 @@ impl HTMLCanvasElement { } if let Some(CanvasContext::WebGL(ref context)) = *self.context.borrow() { - Some(Root::from_ref(&*context)) + Some(DomRoot::from_ref(&*context)) } else { None } diff --git a/components/script/dom/htmlcollection.rs b/components/script/dom/htmlcollection.rs index dd8a62617db4..cefa1407413d 100644 --- a/components/script/dom/htmlcollection.rs +++ b/components/script/dom/htmlcollection.rs @@ -6,7 +6,7 @@ use dom::bindings::codegen::Bindings::HTMLCollectionBinding; use dom::bindings::codegen::Bindings::HTMLCollectionBinding::HTMLCollectionMethods; use dom::bindings::inheritance::Castable; use dom::bindings::reflector::{Reflector, reflect_dom_object}; -use dom::bindings::root::{Dom, Root, MutNullableDom}; +use dom::bindings::root::{Dom, DomRoot, MutNullableDom}; use dom::bindings::str::DOMString; use dom::bindings::trace::JSTraceable; use dom::bindings::xmlname::namespace_from_domstring; @@ -81,13 +81,13 @@ impl HTMLCollection { } #[allow(unrooted_must_root)] - pub fn new(window: &Window, root: &Node, filter: Box) -> Root { + pub fn new(window: &Window, root: &Node, filter: Box) -> DomRoot { reflect_dom_object(box HTMLCollection::new_inherited(root, filter), window, HTMLCollectionBinding::Wrap) } pub fn create(window: &Window, root: &Node, - filter: Box) -> Root { + filter: Box) -> DomRoot { HTMLCollection::new(window, root, filter) } @@ -104,7 +104,7 @@ impl HTMLCollection { } } - fn set_cached_cursor(&self, index: u32, element: Option>) -> Option> { + fn set_cached_cursor(&self, index: u32, element: Option>) -> Option> { if let Some(element) = element { self.cached_cursor_index.set(OptionU32::some(index)); self.cached_cursor_element.set(Some(&element)); @@ -116,7 +116,7 @@ impl HTMLCollection { // https://dom.spec.whatwg.org/#concept-getelementsbytagname pub fn by_qualified_name(window: &Window, root: &Node, qualified_name: LocalName) - -> Root { + -> DomRoot { // case 1 if qualified_name == local_name!("*") { #[derive(HeapSizeOf, JSTraceable)] @@ -161,14 +161,14 @@ impl HTMLCollection { } pub fn by_tag_name_ns(window: &Window, root: &Node, tag: DOMString, - maybe_ns: Option) -> Root { + maybe_ns: Option) -> DomRoot { let local = LocalName::from(tag); let ns = namespace_from_domstring(maybe_ns); let qname = QualName::new(None, ns, local); HTMLCollection::by_qual_tag_name(window, root, qname) } - pub fn by_qual_tag_name(window: &Window, root: &Node, qname: QualName) -> Root { + pub fn by_qual_tag_name(window: &Window, root: &Node, qname: QualName) -> DomRoot { #[derive(HeapSizeOf, JSTraceable)] struct TagNameNSFilter { qname: QualName @@ -186,13 +186,13 @@ impl HTMLCollection { } pub fn by_class_name(window: &Window, root: &Node, classes: DOMString) - -> Root { + -> DomRoot { let class_atoms = split_html_space_chars(&classes).map(Atom::from).collect(); HTMLCollection::by_atomic_class_name(window, root, class_atoms) } pub fn by_atomic_class_name(window: &Window, root: &Node, classes: Vec) - -> Root { + -> DomRoot { #[derive(HeapSizeOf, JSTraceable)] struct ClassNameFilter { classes: Vec @@ -211,7 +211,7 @@ impl HTMLCollection { HTMLCollection::create(window, root, box filter) } - pub fn children(window: &Window, root: &Node) -> Root { + pub fn children(window: &Window, root: &Node) -> DomRoot { #[derive(HeapSizeOf, JSTraceable)] struct ElementChildFilter; impl CollectionFilter for ElementChildFilter { @@ -222,27 +222,27 @@ impl HTMLCollection { HTMLCollection::create(window, root, box ElementChildFilter) } - pub fn elements_iter_after<'a>(&'a self, after: &'a Node) -> impl Iterator> + 'a { + pub fn elements_iter_after<'a>(&'a self, after: &'a Node) -> impl Iterator> + 'a { // Iterate forwards from a node. after.following_nodes(&self.root) - .filter_map(Root::downcast) + .filter_map(DomRoot::downcast) .filter(move |element| self.filter.filter(&element, &self.root)) } - pub fn elements_iter<'a>(&'a self) -> impl Iterator> + 'a { + pub fn elements_iter<'a>(&'a self) -> impl Iterator> + 'a { // Iterate forwards from the root. self.elements_iter_after(&*self.root) } - pub fn elements_iter_before<'a>(&'a self, before: &'a Node) -> impl Iterator> + 'a { + pub fn elements_iter_before<'a>(&'a self, before: &'a Node) -> impl Iterator> + 'a { // Iterate backwards from a node. before.preceding_nodes(&self.root) - .filter_map(Root::downcast) + .filter_map(DomRoot::downcast) .filter(move |element| self.filter.filter(&element, &self.root)) } - pub fn root_node(&self) -> Root { - Root::from_ref(&self.root) + pub fn root_node(&self) -> DomRoot { + DomRoot::from_ref(&self.root) } } @@ -263,7 +263,7 @@ impl HTMLCollectionMethods for HTMLCollection { } // https://dom.spec.whatwg.org/#dom-htmlcollection-item - fn Item(&self, index: u32) -> Option> { + fn Item(&self, index: u32) -> Option> { self.validate_cache(); if let Some(element) = self.cached_cursor_element.get() { @@ -276,14 +276,14 @@ impl HTMLCollectionMethods for HTMLCollection { // The cursor is before the element we're looking for // Iterate forwards, starting at the cursor. let offset = index - (cached_index + 1); - let node: Root = Root::upcast(element); + let node: DomRoot = DomRoot::upcast(element); let mut iter = self.elements_iter_after(&node); self.set_cached_cursor(index, iter.nth(offset as usize)) } else { // The cursor is after the element we're looking for // Iterate backwards, starting at the cursor. let offset = cached_index - (index + 1); - let node: Root = Root::upcast(element); + let node: DomRoot = DomRoot::upcast(element); let mut iter = self.elements_iter_before(&node); self.set_cached_cursor(index, iter.nth(offset as usize)) } @@ -300,7 +300,7 @@ impl HTMLCollectionMethods for HTMLCollection { } // https://dom.spec.whatwg.org/#dom-htmlcollection-nameditem - fn NamedItem(&self, key: DOMString) -> Option> { + fn NamedItem(&self, key: DOMString) -> Option> { // Step 1. if key.is_empty() { return None; @@ -314,12 +314,12 @@ impl HTMLCollectionMethods for HTMLCollection { } // https://dom.spec.whatwg.org/#dom-htmlcollection-item - fn IndexedGetter(&self, index: u32) -> Option> { + fn IndexedGetter(&self, index: u32) -> Option> { self.Item(index) } // check-tidy: no specs after this line - fn NamedGetter(&self, name: DOMString) -> Option> { + fn NamedGetter(&self, name: DOMString) -> Option> { self.NamedItem(name) } diff --git a/components/script/dom/htmldataelement.rs b/components/script/dom/htmldataelement.rs index 0a32c87261a9..556fec894e28 100644 --- a/components/script/dom/htmldataelement.rs +++ b/components/script/dom/htmldataelement.rs @@ -4,7 +4,7 @@ use dom::bindings::codegen::Bindings::HTMLDataElementBinding; use dom::bindings::codegen::Bindings::HTMLDataElementBinding::HTMLDataElementMethods; -use dom::bindings::root::Root; +use dom::bindings::root::DomRoot; use dom::bindings::str::DOMString; use dom::document::Document; use dom::htmlelement::HTMLElement; @@ -29,7 +29,7 @@ impl HTMLDataElement { #[allow(unrooted_must_root)] pub fn new(local_name: LocalName, prefix: Option, - document: &Document) -> Root { + document: &Document) -> DomRoot { Node::reflect_node(box HTMLDataElement::new_inherited(local_name, prefix, document), document, HTMLDataElementBinding::Wrap) diff --git a/components/script/dom/htmldatalistelement.rs b/components/script/dom/htmldatalistelement.rs index bae9b016456c..1e71ca7502b3 100644 --- a/components/script/dom/htmldatalistelement.rs +++ b/components/script/dom/htmldatalistelement.rs @@ -5,7 +5,7 @@ use dom::bindings::codegen::Bindings::HTMLDataListElementBinding; use dom::bindings::codegen::Bindings::HTMLDataListElementBinding::HTMLDataListElementMethods; use dom::bindings::inheritance::Castable; -use dom::bindings::root::Root; +use dom::bindings::root::DomRoot; use dom::document::Document; use dom::element::Element; use dom::htmlcollection::{CollectionFilter, HTMLCollection}; @@ -33,7 +33,7 @@ impl HTMLDataListElement { #[allow(unrooted_must_root)] pub fn new(local_name: LocalName, prefix: Option, - document: &Document) -> Root { + document: &Document) -> DomRoot { Node::reflect_node(box HTMLDataListElement::new_inherited(local_name, prefix, document), document, HTMLDataListElementBinding::Wrap) @@ -42,7 +42,7 @@ impl HTMLDataListElement { impl HTMLDataListElementMethods for HTMLDataListElement { // https://html.spec.whatwg.org/multipage/#dom-datalist-options - fn Options(&self) -> Root { + fn Options(&self) -> DomRoot { #[derive(HeapSizeOf, JSTraceable)] struct HTMLDataListOptionsFilter; impl CollectionFilter for HTMLDataListOptionsFilter { diff --git a/components/script/dom/htmldetailselement.rs b/components/script/dom/htmldetailselement.rs index 4942253a6672..75780f83d86b 100644 --- a/components/script/dom/htmldetailselement.rs +++ b/components/script/dom/htmldetailselement.rs @@ -7,7 +7,7 @@ use dom::bindings::codegen::Bindings::HTMLDetailsElementBinding; use dom::bindings::codegen::Bindings::HTMLDetailsElementBinding::HTMLDetailsElementMethods; use dom::bindings::inheritance::Castable; use dom::bindings::refcounted::Trusted; -use dom::bindings::root::Root; +use dom::bindings::root::DomRoot; use dom::document::Document; use dom::element::AttributeMutation; use dom::eventtarget::EventTarget; @@ -39,7 +39,7 @@ impl HTMLDetailsElement { #[allow(unrooted_must_root)] pub fn new(local_name: LocalName, prefix: Option, - document: &Document) -> Root { + document: &Document) -> DomRoot { Node::reflect_node(box HTMLDetailsElement::new_inherited(local_name, prefix, document), document, HTMLDetailsElementBinding::Wrap) diff --git a/components/script/dom/htmldialogelement.rs b/components/script/dom/htmldialogelement.rs index 2d26f150628a..39e195e08145 100644 --- a/components/script/dom/htmldialogelement.rs +++ b/components/script/dom/htmldialogelement.rs @@ -6,7 +6,7 @@ use dom::bindings::cell::DomRefCell; use dom::bindings::codegen::Bindings::HTMLDialogElementBinding; use dom::bindings::codegen::Bindings::HTMLDialogElementBinding::HTMLDialogElementMethods; use dom::bindings::inheritance::Castable; -use dom::bindings::root::Root; +use dom::bindings::root::DomRoot; use dom::bindings::str::DOMString; use dom::document::Document; use dom::element::Element; @@ -36,7 +36,7 @@ impl HTMLDialogElement { #[allow(unrooted_must_root)] pub fn new(local_name: LocalName, prefix: Option, - document: &Document) -> Root { + document: &Document) -> DomRoot { Node::reflect_node(box HTMLDialogElement::new_inherited(local_name, prefix, document), document, HTMLDialogElementBinding::Wrap) diff --git a/components/script/dom/htmldirectoryelement.rs b/components/script/dom/htmldirectoryelement.rs index cfec92a71987..2ec56cb6415d 100644 --- a/components/script/dom/htmldirectoryelement.rs +++ b/components/script/dom/htmldirectoryelement.rs @@ -3,7 +3,7 @@ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ use dom::bindings::codegen::Bindings::HTMLDirectoryElementBinding; -use dom::bindings::root::Root; +use dom::bindings::root::DomRoot; use dom::document::Document; use dom::htmlelement::HTMLElement; use dom::node::Node; @@ -28,7 +28,7 @@ impl HTMLDirectoryElement { #[allow(unrooted_must_root)] pub fn new(local_name: LocalName, prefix: Option, - document: &Document) -> Root { + document: &Document) -> DomRoot { Node::reflect_node(box HTMLDirectoryElement::new_inherited(local_name, prefix, document), document, HTMLDirectoryElementBinding::Wrap) diff --git a/components/script/dom/htmldivelement.rs b/components/script/dom/htmldivelement.rs index 5f152d770ad7..001ca7c5ca5e 100644 --- a/components/script/dom/htmldivelement.rs +++ b/components/script/dom/htmldivelement.rs @@ -3,7 +3,7 @@ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ use dom::bindings::codegen::Bindings::HTMLDivElementBinding::{self, HTMLDivElementMethods}; -use dom::bindings::root::Root; +use dom::bindings::root::DomRoot; use dom::bindings::str::DOMString; use dom::document::Document; use dom::htmlelement::HTMLElement; @@ -28,7 +28,7 @@ impl HTMLDivElement { #[allow(unrooted_must_root)] pub fn new(local_name: LocalName, prefix: Option, - document: &Document) -> Root { + document: &Document) -> DomRoot { Node::reflect_node(box HTMLDivElement::new_inherited(local_name, prefix, document), document, HTMLDivElementBinding::Wrap) diff --git a/components/script/dom/htmldlistelement.rs b/components/script/dom/htmldlistelement.rs index c8890e83f1b7..6622571c5c89 100644 --- a/components/script/dom/htmldlistelement.rs +++ b/components/script/dom/htmldlistelement.rs @@ -3,7 +3,7 @@ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ use dom::bindings::codegen::Bindings::HTMLDListElementBinding; -use dom::bindings::root::Root; +use dom::bindings::root::DomRoot; use dom::document::Document; use dom::htmlelement::HTMLElement; use dom::node::Node; @@ -26,7 +26,7 @@ impl HTMLDListElement { #[allow(unrooted_must_root)] pub fn new(local_name: LocalName, prefix: Option, - document: &Document) -> Root { + document: &Document) -> DomRoot { Node::reflect_node(box HTMLDListElement::new_inherited(local_name, prefix, document), document, HTMLDListElementBinding::Wrap) diff --git a/components/script/dom/htmlelement.rs b/components/script/dom/htmlelement.rs index 7890cc5fa895..9f671e2d10ce 100644 --- a/components/script/dom/htmlelement.rs +++ b/components/script/dom/htmlelement.rs @@ -12,7 +12,7 @@ use dom::bindings::codegen::Bindings::WindowBinding::WindowMethods; use dom::bindings::error::{Error, ErrorResult}; use dom::bindings::inheritance::{ElementTypeId, HTMLElementTypeId, NodeTypeId}; use dom::bindings::inheritance::Castable; -use dom::bindings::root::{Dom, MutNullableDom, Root, RootedReference}; +use dom::bindings::root::{Dom, DomRoot, MutNullableDom, RootedReference}; use dom::bindings::str::DOMString; use dom::cssstyledeclaration::{CSSModificationAccess, CSSStyleDeclaration, CSSStyleOwner}; use dom::document::{Document, FocusType}; @@ -61,7 +61,7 @@ impl HTMLElement { } #[allow(unrooted_must_root)] - pub fn new(local_name: LocalName, prefix: Option, document: &Document) -> Root { + pub fn new(local_name: LocalName, prefix: Option, document: &Document) -> DomRoot { Node::reflect_node(box HTMLElement::new_inherited(local_name, prefix, document), document, HTMLElementBinding::Wrap) @@ -111,7 +111,7 @@ impl HTMLElement { impl HTMLElementMethods for HTMLElement { // https://html.spec.whatwg.org/multipage/#the-style-attribute - fn Style(&self) -> Root { + fn Style(&self) -> DomRoot { self.style_decl.or_init(|| { let global = window_from_node(self); CSSStyleDeclaration::new(&global, @@ -143,7 +143,7 @@ impl HTMLElementMethods for HTMLElement { document_and_element_event_handlers!(); // https://html.spec.whatwg.org/multipage/#dom-dataset - fn Dataset(&self) -> Root { + fn Dataset(&self) -> DomRoot { self.dataset.or_init(|| DOMStringMap::new(self)) } @@ -313,7 +313,7 @@ impl HTMLElementMethods for HTMLElement { } // https://drafts.csswg.org/cssom-view/#dom-htmlelement-offsetparent - fn GetOffsetParent(&self) -> Option> { + fn GetOffsetParent(&self) -> Option> { if self.is::() || self.is::() { return None; } @@ -503,7 +503,7 @@ impl HTMLElement { } // https://html.spec.whatwg.org/multipage/#dom-lfe-labels - pub fn labels(&self) -> Root { + pub fn labels(&self) -> DomRoot { debug_assert!(self.is_labelable_element()); let element = self.upcast::(); @@ -514,14 +514,14 @@ impl HTMLElement { let ancestors = self.upcast::() .ancestors() - .filter_map(Root::downcast::) + .filter_map(DomRoot::downcast::) // If we reach a labelable element, we have a guarantee no ancestors above it // will be a label for this HTMLElement .take_while(|elem| !elem.is_labelable_element()) - .filter_map(Root::downcast::) + .filter_map(DomRoot::downcast::) .filter(|elem| !elem.upcast::().has_attribute(&local_name!("for"))) .filter(|elem| elem.first_labelable_descendant().r() == Some(self)) - .map(Root::upcast::); + .map(DomRoot::upcast::); let id = element.Id(); let id = match &id as &str { @@ -533,10 +533,10 @@ impl HTMLElement { let root_element = element.root_element(); let root_node = root_element.upcast::(); let children = root_node.traverse_preorder() - .filter_map(Root::downcast::) + .filter_map(DomRoot::downcast::) .filter(|elem| elem.is::()) .filter(|elem| elem.get_string_attribute(&local_name!("for")) == id) - .map(Root::upcast::); + .map(DomRoot::upcast::); NodeList::new_simple_list(&window, children.chain(ancestors)) } diff --git a/components/script/dom/htmlembedelement.rs b/components/script/dom/htmlembedelement.rs index e5b207764a2b..daa011fcf6d9 100644 --- a/components/script/dom/htmlembedelement.rs +++ b/components/script/dom/htmlembedelement.rs @@ -3,7 +3,7 @@ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ use dom::bindings::codegen::Bindings::HTMLEmbedElementBinding; -use dom::bindings::root::Root; +use dom::bindings::root::DomRoot; use dom::document::Document; use dom::htmlelement::HTMLElement; use dom::node::Node; @@ -25,7 +25,7 @@ impl HTMLEmbedElement { #[allow(unrooted_must_root)] pub fn new(local_name: LocalName, prefix: Option, - document: &Document) -> Root { + document: &Document) -> DomRoot { Node::reflect_node(box HTMLEmbedElement::new_inherited(local_name, prefix, document), document, HTMLEmbedElementBinding::Wrap) diff --git a/components/script/dom/htmlfieldsetelement.rs b/components/script/dom/htmlfieldsetelement.rs index e935169c244b..89e1d2db481e 100644 --- a/components/script/dom/htmlfieldsetelement.rs +++ b/components/script/dom/htmlfieldsetelement.rs @@ -6,7 +6,7 @@ use dom::attr::Attr; use dom::bindings::codegen::Bindings::HTMLFieldSetElementBinding; use dom::bindings::codegen::Bindings::HTMLFieldSetElementBinding::HTMLFieldSetElementMethods; use dom::bindings::inheritance::{Castable, ElementTypeId, HTMLElementTypeId, NodeTypeId}; -use dom::bindings::root::{MutNullableDom, Root}; +use dom::bindings::root::{DomRoot, MutNullableDom}; use dom::document::Document; use dom::element::{AttributeMutation, Element}; use dom::htmlcollection::{CollectionFilter, HTMLCollection}; @@ -42,7 +42,7 @@ impl HTMLFieldSetElement { #[allow(unrooted_must_root)] pub fn new(local_name: LocalName, prefix: Option, - document: &Document) -> Root { + document: &Document) -> DomRoot { Node::reflect_node(box HTMLFieldSetElement::new_inherited(local_name, prefix, document), document, HTMLFieldSetElementBinding::Wrap) @@ -51,7 +51,7 @@ impl HTMLFieldSetElement { impl HTMLFieldSetElementMethods for HTMLFieldSetElement { // https://html.spec.whatwg.org/multipage/#dom-fieldset-elements - fn Elements(&self) -> Root { + fn Elements(&self) -> DomRoot { #[derive(HeapSizeOf, JSTraceable)] struct ElementsFilter; impl CollectionFilter for ElementsFilter { @@ -66,7 +66,7 @@ impl HTMLFieldSetElementMethods for HTMLFieldSetElement { } // https://html.spec.whatwg.org/multipage/#dom-cva-validity - fn Validity(&self) -> Root { + fn Validity(&self) -> DomRoot { let window = window_from_node(self); ValidityState::new(&window, self.upcast()) } @@ -78,7 +78,7 @@ impl HTMLFieldSetElementMethods for HTMLFieldSetElement { make_bool_setter!(SetDisabled, "disabled"); // https://html.spec.whatwg.org/multipage/#dom-fae-form - fn GetForm(&self) -> Option> { + fn GetForm(&self) -> Option> { self.form_owner() } } @@ -159,7 +159,7 @@ impl VirtualMethods for HTMLFieldSetElement { } impl FormControl for HTMLFieldSetElement { - fn form_owner(&self) -> Option> { + fn form_owner(&self) -> Option> { self.form_owner.get() } diff --git a/components/script/dom/htmlfontelement.rs b/components/script/dom/htmlfontelement.rs index e2f9eaeec21b..c5eee1971598 100644 --- a/components/script/dom/htmlfontelement.rs +++ b/components/script/dom/htmlfontelement.rs @@ -7,7 +7,7 @@ use dom::attr::Attr; use dom::bindings::codegen::Bindings::HTMLFontElementBinding; use dom::bindings::codegen::Bindings::HTMLFontElementBinding::HTMLFontElementMethods; use dom::bindings::inheritance::Castable; -use dom::bindings::root::{LayoutDom, Root}; +use dom::bindings::root::{DomRoot, LayoutDom}; use dom::bindings::str::DOMString; use dom::document::Document; use dom::element::{Element, RawLayoutElementHelpers}; @@ -36,7 +36,7 @@ impl HTMLFontElement { #[allow(unrooted_must_root)] pub fn new(local_name: LocalName, prefix: Option, - document: &Document) -> Root { + document: &Document) -> DomRoot { Node::reflect_node(box HTMLFontElement::new_inherited(local_name, prefix, document), document, HTMLFontElementBinding::Wrap) diff --git a/components/script/dom/htmlformcontrolscollection.rs b/components/script/dom/htmlformcontrolscollection.rs index 1b215ba2320d..8b786d2cb357 100644 --- a/components/script/dom/htmlformcontrolscollection.rs +++ b/components/script/dom/htmlformcontrolscollection.rs @@ -7,7 +7,7 @@ use dom::bindings::codegen::Bindings::HTMLFormControlsCollectionBinding; use dom::bindings::codegen::Bindings::HTMLFormControlsCollectionBinding::HTMLFormControlsCollectionMethods; use dom::bindings::codegen::UnionTypes::RadioNodeListOrElement; use dom::bindings::reflector::{DomObject, reflect_dom_object}; -use dom::bindings::root::Root; +use dom::bindings::root::DomRoot; use dom::bindings::str::DOMString; use dom::element::Element; use dom::htmlcollection::{CollectionFilter, HTMLCollection}; @@ -30,7 +30,7 @@ impl HTMLFormControlsCollection { } pub fn new(window: &Window, root: &Node, filter: Box) - -> Root + -> DomRoot { reflect_dom_object(box HTMLFormControlsCollection::new_inherited(root, filter), window, @@ -64,8 +64,8 @@ impl HTMLFormControlsCollectionMethods for HTMLFormControlsCollection { Some(RadioNodeListOrElement::Element(elem)) } else { // Step 4-5 - let once = iter::once(Root::upcast::(elem)); - let list = once.chain(peekable.map(Root::upcast)); + let once = iter::once(DomRoot::upcast::(elem)); + let list = once.chain(peekable.map(DomRoot::upcast)); let global = self.global(); let window = global.as_window(); Some(RadioNodeListOrElement::RadioNodeList(RadioNodeList::new_simple_list(window, list))) @@ -90,7 +90,7 @@ impl HTMLFormControlsCollectionMethods for HTMLFormControlsCollection { // https://github.com/servo/servo/issues/5875 // // https://dom.spec.whatwg.org/#dom-htmlcollection-item - fn IndexedGetter(&self, index: u32) -> Option> { + fn IndexedGetter(&self, index: u32) -> Option> { self.collection.IndexedGetter(index) } } diff --git a/components/script/dom/htmlformelement.rs b/components/script/dom/htmlformelement.rs index abb064fbb19d..a61b7bf3e518 100755 --- a/components/script/dom/htmlformelement.rs +++ b/components/script/dom/htmlformelement.rs @@ -15,7 +15,7 @@ use dom::bindings::codegen::Bindings::HTMLTextAreaElementBinding::HTMLTextAreaEl use dom::bindings::inheritance::{Castable, ElementTypeId, HTMLElementTypeId, NodeTypeId}; use dom::bindings::refcounted::Trusted; use dom::bindings::reflector::DomObject; -use dom::bindings::root::{Dom, DomOnceCell, Root, RootedReference}; +use dom::bindings::root::{Dom, DomOnceCell, DomRoot, RootedReference}; use dom::bindings::str::DOMString; use dom::blob::Blob; use dom::document::Document; @@ -85,7 +85,7 @@ impl HTMLFormElement { #[allow(unrooted_must_root)] pub fn new(local_name: LocalName, prefix: Option, - document: &Document) -> Root { + document: &Document) -> DomRoot { Node::reflect_node(box HTMLFormElement::new_inherited(local_name, prefix, document), document, HTMLFormElementBinding::Wrap) @@ -165,10 +165,10 @@ impl HTMLFormElementMethods for HTMLFormElement { } // https://html.spec.whatwg.org/multipage/#dom-form-elements - fn Elements(&self) -> Root { + fn Elements(&self) -> DomRoot { #[derive(HeapSizeOf, JSTraceable)] struct ElementsFilter { - form: Root + form: DomRoot } impl CollectionFilter for ElementsFilter { fn filter<'a>(&self, elem: &'a Element, _root: &'a Node) -> bool { @@ -216,8 +216,8 @@ impl HTMLFormElementMethods for HTMLFormElement { } } } - Root::from_ref(self.elements.init_once(|| { - let filter = box ElementsFilter { form: Root::from_ref(self) }; + DomRoot::from_ref(self.elements.init_once(|| { + let filter = box ElementsFilter { form: DomRoot::from_ref(self) }; let window = window_from_node(self); HTMLFormControlsCollection::new(&window, self.upcast(), filter) })) @@ -229,7 +229,7 @@ impl HTMLFormElementMethods for HTMLFormElement { } // https://html.spec.whatwg.org/multipage/#dom-form-item - fn IndexedGetter(&self, index: u32) -> Option> { + fn IndexedGetter(&self, index: u32) -> Option> { let elements = self.Elements(); elements.IndexedGetter(index) } @@ -520,7 +520,7 @@ impl HTMLFormElement { // Step 3.1: The field element has a datalist element ancestor. if child.ancestors() - .any(|a| Root::downcast::(a).is_some()) { + .any(|a| DomRoot::downcast::(a).is_some()) { continue; } if let NodeTypeId::Element(ElementTypeId::HTMLElement(element)) = child.type_id() { @@ -677,7 +677,7 @@ impl HTMLFormElement { #[derive(Clone, HeapSizeOf, JSTraceable)] pub enum FormDatumValue { #[allow(dead_code)] - File(Root), + File(DomRoot), String(DOMString) } @@ -718,13 +718,13 @@ pub enum FormMethod { #[derive(HeapSizeOf)] #[allow(dead_code)] pub enum FormSubmittableElement { - ButtonElement(Root), - InputElement(Root), + ButtonElement(DomRoot), + InputElement(DomRoot), // TODO: HTMLKeygenElement unimplemented // KeygenElement(&'a HTMLKeygenElement), - ObjectElement(Root), - SelectElement(Root), - TextAreaElement(Root), + ObjectElement(DomRoot), + SelectElement(DomRoot), + TextAreaElement(DomRoot), } impl FormSubmittableElement { @@ -740,19 +740,19 @@ impl FormSubmittableElement { fn from_element(element: &Element) -> FormSubmittableElement { if let Some(input) = element.downcast::() { - FormSubmittableElement::InputElement(Root::from_ref(&input)) + FormSubmittableElement::InputElement(DomRoot::from_ref(&input)) } else if let Some(input) = element.downcast::() { - FormSubmittableElement::ButtonElement(Root::from_ref(&input)) + FormSubmittableElement::ButtonElement(DomRoot::from_ref(&input)) } else if let Some(input) = element.downcast::() { - FormSubmittableElement::ObjectElement(Root::from_ref(&input)) + FormSubmittableElement::ObjectElement(DomRoot::from_ref(&input)) } else if let Some(input) = element.downcast::() { - FormSubmittableElement::SelectElement(Root::from_ref(&input)) + FormSubmittableElement::SelectElement(DomRoot::from_ref(&input)) } else if let Some(input) = element.downcast::() { - FormSubmittableElement::TextAreaElement(Root::from_ref(&input)) + FormSubmittableElement::TextAreaElement(DomRoot::from_ref(&input)) } else { unreachable!() } @@ -862,7 +862,7 @@ impl<'a> FormSubmitter<'a> { } pub trait FormControl: DomObject { - fn form_owner(&self) -> Option>; + fn form_owner(&self) -> Option>; fn set_form_owner(&self, form: Option<&HTMLFormElement>); @@ -891,7 +891,7 @@ pub trait FormControl: DomObject { let old_owner = self.form_owner(); let has_form_id = elem.has_attribute(&local_name!("form")); let nearest_form_ancestor = node.ancestors() - .filter_map(Root::downcast::) + .filter_map(DomRoot::downcast::) .next(); // Step 1 @@ -905,7 +905,7 @@ pub trait FormControl: DomObject { // Step 3 let doc = document_from_node(node); let form_id = elem.get_string_attribute(&local_name!("form")); - doc.GetElementById(form_id).and_then(Root::downcast::) + doc.GetElementById(form_id).and_then(DomRoot::downcast::) } else { // Step 4 nearest_form_ancestor diff --git a/components/script/dom/htmlframeelement.rs b/components/script/dom/htmlframeelement.rs index 0f70cb99b3e6..147e05a836eb 100644 --- a/components/script/dom/htmlframeelement.rs +++ b/components/script/dom/htmlframeelement.rs @@ -3,7 +3,7 @@ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ use dom::bindings::codegen::Bindings::HTMLFrameElementBinding; -use dom::bindings::root::Root; +use dom::bindings::root::DomRoot; use dom::document::Document; use dom::htmlelement::HTMLElement; use dom::node::Node; @@ -25,7 +25,7 @@ impl HTMLFrameElement { #[allow(unrooted_must_root)] pub fn new(local_name: LocalName, prefix: Option, - document: &Document) -> Root { + document: &Document) -> DomRoot { Node::reflect_node(box HTMLFrameElement::new_inherited(local_name, prefix, document), document, HTMLFrameElementBinding::Wrap) diff --git a/components/script/dom/htmlframesetelement.rs b/components/script/dom/htmlframesetelement.rs index 2f8cf1c99a64..99b58deea3d3 100644 --- a/components/script/dom/htmlframesetelement.rs +++ b/components/script/dom/htmlframesetelement.rs @@ -5,7 +5,7 @@ use dom::bindings::codegen::Bindings::HTMLFrameSetElementBinding; use dom::bindings::codegen::Bindings::HTMLFrameSetElementBinding::HTMLFrameSetElementMethods; use dom::bindings::codegen::Bindings::WindowBinding::WindowMethods; -use dom::bindings::root::Root; +use dom::bindings::root::DomRoot; use dom::document::Document; use dom::htmlelement::HTMLElement; use dom::node::{Node, document_from_node}; @@ -30,7 +30,7 @@ impl HTMLFrameSetElement { #[allow(unrooted_must_root)] pub fn new(local_name: LocalName, prefix: Option, - document: &Document) -> Root { + document: &Document) -> DomRoot { Node::reflect_node(box HTMLFrameSetElement::new_inherited(local_name, prefix, document), document, HTMLFrameSetElementBinding::Wrap) diff --git a/components/script/dom/htmlheadelement.rs b/components/script/dom/htmlheadelement.rs index 0d0f2be734c5..1aaf0a799b59 100644 --- a/components/script/dom/htmlheadelement.rs +++ b/components/script/dom/htmlheadelement.rs @@ -5,7 +5,7 @@ use dom::bindings::codegen::Bindings::DocumentBinding::DocumentMethods; use dom::bindings::codegen::Bindings::HTMLHeadElementBinding; use dom::bindings::inheritance::Castable; -use dom::bindings::root::{Root, RootedReference}; +use dom::bindings::root::{DomRoot, RootedReference}; use dom::document::{Document, determine_policy_for_token}; use dom::element::Element; use dom::htmlelement::HTMLElement; @@ -33,7 +33,7 @@ impl HTMLHeadElement { #[allow(unrooted_must_root)] pub fn new(local_name: LocalName, prefix: Option, - document: &Document) -> Root { + document: &Document) -> DomRoot { Node::reflect_node(box HTMLHeadElement::new_inherited(local_name, prefix, document), document, HTMLHeadElementBinding::Wrap) @@ -49,7 +49,7 @@ impl HTMLHeadElement { let node = self.upcast::(); let candidates = node.traverse_preorder() - .filter_map(Root::downcast::) + .filter_map(DomRoot::downcast::) .filter(|elem| elem.is::()) .filter(|elem| elem.get_string_attribute(&local_name!("name")) == "referrer") .filter(|elem| elem.get_attribute(&ns!(), &local_name!("content")).is_some()); diff --git a/components/script/dom/htmlheadingelement.rs b/components/script/dom/htmlheadingelement.rs index 5b0a90a1374d..44223863dd48 100644 --- a/components/script/dom/htmlheadingelement.rs +++ b/components/script/dom/htmlheadingelement.rs @@ -3,7 +3,7 @@ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ use dom::bindings::codegen::Bindings::HTMLHeadingElementBinding; -use dom::bindings::root::Root; +use dom::bindings::root::DomRoot; use dom::document::Document; use dom::htmlelement::HTMLElement; use dom::node::Node; @@ -42,7 +42,7 @@ impl HTMLHeadingElement { pub fn new(local_name: LocalName, prefix: Option, document: &Document, - level: HeadingLevel) -> Root { + level: HeadingLevel) -> DomRoot { Node::reflect_node(box HTMLHeadingElement::new_inherited(local_name, prefix, document, level), document, HTMLHeadingElementBinding::Wrap) diff --git a/components/script/dom/htmlhrelement.rs b/components/script/dom/htmlhrelement.rs index e66494e68433..e4769ed72024 100644 --- a/components/script/dom/htmlhrelement.rs +++ b/components/script/dom/htmlhrelement.rs @@ -5,7 +5,7 @@ use cssparser::RGBA; use dom::bindings::codegen::Bindings::HTMLHRElementBinding::{self, HTMLHRElementMethods}; use dom::bindings::inheritance::Castable; -use dom::bindings::root::{LayoutDom, Root}; +use dom::bindings::root::{DomRoot, LayoutDom}; use dom::bindings::str::DOMString; use dom::document::Document; use dom::element::{Element, RawLayoutElementHelpers}; @@ -31,7 +31,7 @@ impl HTMLHRElement { #[allow(unrooted_must_root)] pub fn new(local_name: LocalName, prefix: Option, - document: &Document) -> Root { + document: &Document) -> DomRoot { Node::reflect_node(box HTMLHRElement::new_inherited(local_name, prefix, document), document, HTMLHRElementBinding::Wrap) diff --git a/components/script/dom/htmlhtmlelement.rs b/components/script/dom/htmlhtmlelement.rs index 75a233b82ce8..b112e304c09c 100644 --- a/components/script/dom/htmlhtmlelement.rs +++ b/components/script/dom/htmlhtmlelement.rs @@ -3,7 +3,7 @@ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ use dom::bindings::codegen::Bindings::HTMLHtmlElementBinding; -use dom::bindings::root::Root; +use dom::bindings::root::DomRoot; use dom::document::Document; use dom::htmlelement::HTMLElement; use dom::node::Node; @@ -25,7 +25,7 @@ impl HTMLHtmlElement { #[allow(unrooted_must_root)] pub fn new(localName: LocalName, prefix: Option, - document: &Document) -> Root { + document: &Document) -> DomRoot { Node::reflect_node(box HTMLHtmlElement::new_inherited(localName, prefix, document), document, HTMLHtmlElementBinding::Wrap) diff --git a/components/script/dom/htmliframeelement.rs b/components/script/dom/htmliframeelement.rs index 39bb2e672b49..8cc7ca9977bc 100644 --- a/components/script/dom/htmliframeelement.rs +++ b/components/script/dom/htmliframeelement.rs @@ -21,7 +21,7 @@ use dom::bindings::error::{Error, ErrorResult, Fallible}; use dom::bindings::inheritance::Castable; use dom::bindings::refcounted::Trusted; use dom::bindings::reflector::DomObject; -use dom::bindings::root::{LayoutDom, MutNullableDom, Root}; +use dom::bindings::root::{LayoutDom, DomRoot, MutNullableDom}; use dom::bindings::str::DOMString; use dom::customevent::CustomEvent; use dom::document::Document; @@ -337,7 +337,7 @@ impl HTMLIFrameElement { #[allow(unrooted_must_root)] pub fn new(local_name: LocalName, prefix: Option, - document: &Document) -> Root { + document: &Document) -> DomRoot { Node::reflect_node(box HTMLIFrameElement::new_inherited(local_name, prefix, document), document, HTMLIFrameElementBinding::Wrap) @@ -461,7 +461,7 @@ impl HTMLIFrameElementLayoutMethods for LayoutDom { } #[allow(unsafe_code)] -pub fn build_mozbrowser_custom_event(window: &Window, event: MozBrowserEvent) -> Root { +pub fn build_mozbrowser_custom_event(window: &Window, event: MozBrowserEvent) -> DomRoot { // TODO(gw): Support mozbrowser event types that have detail which is not a string. // See https://developer.mozilla.org/en-US/docs/Web/API/Using_the_Browser_API // for a list of mozbrowser events. @@ -583,19 +583,19 @@ impl HTMLIFrameElementMethods for HTMLIFrameElement { } // https://html.spec.whatwg.org/multipage/#dom-iframe-sandbox - fn Sandbox(&self) -> Root { + fn Sandbox(&self) -> DomRoot { self.sandbox.or_init(|| DOMTokenList::new(self.upcast::(), &local_name!("sandbox"))) } // https://html.spec.whatwg.org/multipage/#dom-iframe-contentwindow - fn GetContentWindow(&self) -> Option> { + fn GetContentWindow(&self) -> Option> { self.browsing_context_id.get() .and_then(|browsing_context_id| ScriptThread::find_window_proxy(browsing_context_id)) } // https://html.spec.whatwg.org/multipage/#dom-iframe-contentdocument // https://html.spec.whatwg.org/multipage/#concept-bcc-content-document - fn GetContentDocument(&self) -> Option> { + fn GetContentDocument(&self) -> Option> { // Step 1. let pipeline_id = match self.pipeline_id.get() { None => return None, diff --git a/components/script/dom/htmlimageelement.rs b/components/script/dom/htmlimageelement.rs index dac6c9556260..7c2255d6696a 100644 --- a/components/script/dom/htmlimageelement.rs +++ b/components/script/dom/htmlimageelement.rs @@ -17,7 +17,7 @@ use dom::bindings::error::Fallible; use dom::bindings::inheritance::Castable; use dom::bindings::refcounted::Trusted; use dom::bindings::reflector::DomObject; -use dom::bindings::root::{LayoutDom, MutNullableDom, Root}; +use dom::bindings::root::{DomRoot, LayoutDom, MutNullableDom}; use dom::bindings::str::DOMString; use dom::document::Document; use dom::element::{AttributeMutation, Element, RawLayoutElementHelpers}; @@ -569,7 +569,7 @@ impl HTMLImageElement { // step 6, await a stable state. self.generation.set(self.generation.get() + 1); let task = ImageElementMicrotask::StableStateUpdateImageDataTask { - elem: Root::from_ref(self), + elem: DomRoot::from_ref(self), generation: self.generation.get(), }; ScriptThread::await_stable_state(Microtask::ImageElement(task)); @@ -605,7 +605,7 @@ impl HTMLImageElement { #[allow(unrooted_must_root)] pub fn new(local_name: LocalName, prefix: Option, - document: &Document) -> Root { + document: &Document) -> DomRoot { Node::reflect_node(box HTMLImageElement::new_inherited(local_name, prefix, document), document, HTMLImageElementBinding::Wrap) @@ -613,7 +613,7 @@ impl HTMLImageElement { pub fn Image(window: &Window, width: Option, - height: Option) -> Fallible> { + height: Option) -> Fallible> { let document = window.Document(); let image = HTMLImageElement::new(local_name!("img"), None, &document); if let Some(w) = width { @@ -625,7 +625,7 @@ impl HTMLImageElement { Ok(image) } - pub fn areas(&self) -> Option>> { + pub fn areas(&self) -> Option>> { let elem = self.upcast::(); let usemap_attr = match elem.get_attribute(&ns!(), &local_name!("usemap")) { Some(attr) => attr, @@ -646,7 +646,7 @@ impl HTMLImageElement { let useMapElements = document_from_node(self).upcast::() .traverse_preorder() - .filter_map(Root::downcast::) + .filter_map(DomRoot::downcast::) .find(|n| n.upcast::().get_string_attribute(&LocalName::from("name")) == last); useMapElements.map(|mapElem| mapElem.get_area_elements()) @@ -664,7 +664,7 @@ impl HTMLImageElement { #[derive(HeapSizeOf, JSTraceable)] pub enum ImageElementMicrotask { StableStateUpdateImageDataTask { - elem: Root, + elem: DomRoot, generation: u32, } } @@ -937,7 +937,7 @@ impl VirtualMethods for HTMLImageElement { } impl FormControl for HTMLImageElement { - fn form_owner(&self) -> Option> { + fn form_owner(&self) -> Option> { self.form_owner.get() } diff --git a/components/script/dom/htmlinputelement.rs b/components/script/dom/htmlinputelement.rs index 77ddc6eb8e3d..ce76eb8ced5d 100755 --- a/components/script/dom/htmlinputelement.rs +++ b/components/script/dom/htmlinputelement.rs @@ -15,7 +15,7 @@ use dom::bindings::codegen::Bindings::MouseEventBinding::MouseEventMethods; use dom::bindings::codegen::Bindings::WindowBinding::WindowMethods; use dom::bindings::error::{Error, ErrorResult}; use dom::bindings::inheritance::Castable; -use dom::bindings::root::{Dom, LayoutDom, MutNullableDom, Root, RootedReference}; +use dom::bindings::root::{Dom, DomRoot, LayoutDom, MutNullableDom, RootedReference}; use dom::bindings::str::DOMString; use dom::document::Document; use dom::element::{AttributeMutation, Element, LayoutElementHelpers, RawLayoutElementHelpers}; @@ -164,7 +164,7 @@ impl HTMLInputElement { #[allow(unrooted_must_root)] pub fn new(local_name: LocalName, prefix: Option, - document: &Document) -> Root { + document: &Document) -> DomRoot { Node::reflect_node(box HTMLInputElement::new_inherited(local_name, prefix, document), document, HTMLInputElementBinding::Wrap) @@ -318,12 +318,12 @@ impl HTMLInputElementMethods for HTMLInputElement { make_bool_setter!(SetDisabled, "disabled"); // https://html.spec.whatwg.org/multipage/#dom-fae-form - fn GetForm(&self) -> Option> { + fn GetForm(&self) -> Option> { self.form_owner() } // https://html.spec.whatwg.org/multipage/#dom-input-files - fn GetFiles(&self) -> Option> { + fn GetFiles(&self) -> Option> { match self.filelist.get() { Some(ref fl) => Some(fl.clone()), None => None, @@ -549,7 +549,7 @@ impl HTMLInputElementMethods for HTMLInputElement { } // https://html.spec.whatwg.org/multipage/#dom-lfe-labels - fn Labels(&self) -> Root { + fn Labels(&self) -> DomRoot { if self.type_() == atom!("hidden") { let window = window_from_node(self); NodeList::empty(&window) @@ -638,7 +638,7 @@ fn broadcast_radio_checked(broadcaster: &HTMLInputElement, group: Option<&Atom>) fn do_broadcast(doc_node: &Node, broadcaster: &HTMLInputElement, owner: Option<&HTMLFormElement>, group: Option<&Atom>) { let iter = doc_node.query_selector_iter(DOMString::from("input[type=radio]")).unwrap() - .filter_map(Root::downcast::) + .filter_map(DomRoot::downcast::) .filter(|r| in_same_group(&r, owner, group) && broadcaster != &**r); for ref r in iter { if r.Checked() { @@ -705,7 +705,7 @@ impl HTMLInputElement { datums.push(FormDatum { ty: type_.clone(), name: name.clone(), - value: FormDatumValue::File(Root::from_ref(&f)), + value: FormDatumValue::File(DomRoot::from_ref(&f)), }); } } @@ -805,7 +805,7 @@ impl HTMLInputElement { let origin = get_blob_origin(&window.get_url()); let resource_threads = window.upcast::().resource_threads(); - let mut files: Vec> = vec![]; + let mut files: Vec> = vec![]; let mut error = None; let filter = filter_from_accept(&self.Accept()); @@ -1169,7 +1169,7 @@ impl VirtualMethods for HTMLInputElement { } impl FormControl for HTMLInputElement { - fn form_owner(&self) -> Option> { + fn form_owner(&self) -> Option> { self.form_owner.get() } @@ -1246,7 +1246,7 @@ impl Activatable for HTMLInputElement { // Safe since we only manipulate the DOM tree after finding an element let checked_member = doc_node.query_selector_iter(DOMString::from("input[type=radio]")) .unwrap() - .filter_map(Root::downcast::) + .filter_map(DomRoot::downcast::) .find(|r| { in_same_group(&*r, owner.r(), group.as_ref()) && r.Checked() @@ -1361,7 +1361,7 @@ impl Activatable for HTMLInputElement { } let submit_button; submit_button = node.query_selector_iter(DOMString::from("input[type=submit]")).unwrap() - .filter_map(Root::downcast::) + .filter_map(DomRoot::downcast::) .find(|r| r.form_owner() == owner); match submit_button { Some(ref button) => { @@ -1376,7 +1376,7 @@ impl Activatable for HTMLInputElement { } None => { let inputs = node.query_selector_iter(DOMString::from("input")).unwrap() - .filter_map(Root::downcast::) + .filter_map(DomRoot::downcast::) .filter(|input| { input.form_owner() == owner && match input.type_() { atom!("text") | atom!("search") | atom!("url") | atom!("tel") | diff --git a/components/script/dom/htmllabelelement.rs b/components/script/dom/htmllabelelement.rs index 0e1e99c3f7b2..09397059eabc 100644 --- a/components/script/dom/htmllabelelement.rs +++ b/components/script/dom/htmllabelelement.rs @@ -7,7 +7,7 @@ use dom::attr::Attr; use dom::bindings::codegen::Bindings::HTMLLabelElementBinding; use dom::bindings::codegen::Bindings::HTMLLabelElementBinding::HTMLLabelElementMethods; use dom::bindings::inheritance::Castable; -use dom::bindings::root::Root; +use dom::bindings::root::DomRoot; use dom::bindings::str::DOMString; use dom::document::Document; use dom::element::{AttributeMutation, Element}; @@ -39,7 +39,7 @@ impl HTMLLabelElement { #[allow(unrooted_must_root)] pub fn new(local_name: LocalName, prefix: Option, - document: &Document) -> Root { + document: &Document) -> DomRoot { Node::reflect_node(box HTMLLabelElement::new_inherited(local_name, prefix, document), document, HTMLLabelElementBinding::Wrap) @@ -88,7 +88,7 @@ impl Activatable for HTMLLabelElement { impl HTMLLabelElementMethods for HTMLLabelElement { // https://html.spec.whatwg.org/multipage/#dom-fae-form - fn GetForm(&self) -> Option> { + fn GetForm(&self) -> Option> { self.form_owner() } @@ -99,7 +99,7 @@ impl HTMLLabelElementMethods for HTMLLabelElement { make_atomic_setter!(SetHtmlFor, "for"); // https://html.spec.whatwg.org/multipage/#dom-label-control - fn GetControl(&self) -> Option> { + fn GetControl(&self) -> Option> { if !self.upcast::().is_in_doc() { return None; } @@ -111,7 +111,7 @@ impl HTMLLabelElementMethods for HTMLLabelElement { let for_value = for_attr.value(); document_from_node(self).get_element_by_id(for_value.as_atom()) - .and_then(Root::downcast::) + .and_then(DomRoot::downcast::) .into_iter() .filter(|e| e.is_labelable_element()) .next() @@ -142,18 +142,18 @@ impl VirtualMethods for HTMLLabelElement { } impl HTMLLabelElement { - pub fn first_labelable_descendant(&self) -> Option> { + pub fn first_labelable_descendant(&self) -> Option> { self.upcast::() .traverse_preorder() - .filter_map(Root::downcast::) + .filter_map(DomRoot::downcast::) .filter(|elem| elem.is_labelable_element()) .next() } } impl FormControl for HTMLLabelElement { - fn form_owner(&self) -> Option> { - self.GetControl().map(Root::upcast::).and_then(|elem| { + fn form_owner(&self) -> Option> { + self.GetControl().map(DomRoot::upcast::).and_then(|elem| { elem.as_maybe_form_control().and_then(|control| control.form_owner()) }) } diff --git a/components/script/dom/htmllegendelement.rs b/components/script/dom/htmllegendelement.rs index 010e80c22eef..c54b25f61182 100644 --- a/components/script/dom/htmllegendelement.rs +++ b/components/script/dom/htmllegendelement.rs @@ -6,7 +6,7 @@ use dom::bindings::codegen::Bindings::HTMLLegendElementBinding; use dom::bindings::codegen::Bindings::HTMLLegendElementBinding::HTMLLegendElementMethods; use dom::bindings::codegen::Bindings::NodeBinding::NodeMethods; use dom::bindings::inheritance::Castable; -use dom::bindings::root::{MutNullableDom, Root}; +use dom::bindings::root::{DomRoot, MutNullableDom}; use dom::document::Document; use dom::element::Element; use dom::htmlelement::HTMLElement; @@ -38,7 +38,7 @@ impl HTMLLegendElement { pub fn new(local_name: LocalName, prefix: Option, document: &Document) - -> Root { + -> DomRoot { Node::reflect_node(box HTMLLegendElement::new_inherited(local_name, prefix, document), document, HTMLLegendElementBinding::Wrap) @@ -74,7 +74,7 @@ impl VirtualMethods for HTMLLegendElement { impl HTMLLegendElementMethods for HTMLLegendElement { // https://html.spec.whatwg.org/multipage/#dom-legend-form - fn GetForm(&self) -> Option> { + fn GetForm(&self) -> Option> { let parent = match self.upcast::().GetParentElement() { Some(parent) => parent, None => return None, @@ -87,7 +87,7 @@ impl HTMLLegendElementMethods for HTMLLegendElement { } impl FormControl for HTMLLegendElement { - fn form_owner(&self) -> Option> { + fn form_owner(&self) -> Option> { self.form_owner.get() } diff --git a/components/script/dom/htmllielement.rs b/components/script/dom/htmllielement.rs index b175d3359a94..da98a3d1be29 100644 --- a/components/script/dom/htmllielement.rs +++ b/components/script/dom/htmllielement.rs @@ -5,7 +5,7 @@ use dom::bindings::codegen::Bindings::HTMLLIElementBinding; use dom::bindings::codegen::Bindings::HTMLLIElementBinding::HTMLLIElementMethods; use dom::bindings::inheritance::Castable; -use dom::bindings::root::Root; +use dom::bindings::root::DomRoot; use dom::bindings::str::DOMString; use dom::document::Document; use dom::htmlelement::HTMLElement; @@ -30,7 +30,7 @@ impl HTMLLIElement { #[allow(unrooted_must_root)] pub fn new(local_name: LocalName, prefix: Option, - document: &Document) -> Root { + document: &Document) -> DomRoot { Node::reflect_node(box HTMLLIElement::new_inherited(local_name, prefix, document), document, HTMLLIElementBinding::Wrap) diff --git a/components/script/dom/htmllinkelement.rs b/components/script/dom/htmllinkelement.rs index 42b6f59d6bce..320b425331b2 100644 --- a/components/script/dom/htmllinkelement.rs +++ b/components/script/dom/htmllinkelement.rs @@ -9,7 +9,7 @@ use dom::bindings::codegen::Bindings::DOMTokenListBinding::DOMTokenListBinding:: use dom::bindings::codegen::Bindings::HTMLLinkElementBinding; use dom::bindings::codegen::Bindings::HTMLLinkElementBinding::HTMLLinkElementMethods; use dom::bindings::inheritance::Castable; -use dom::bindings::root::{MutNullableDom, Root, RootedReference}; +use dom::bindings::root::{DomRoot, MutNullableDom, RootedReference}; use dom::bindings::str::DOMString; use dom::cssstylesheet::CSSStyleSheet; use dom::document::Document; @@ -85,7 +85,7 @@ impl HTMLLinkElement { pub fn new(local_name: LocalName, prefix: Option, document: &Document, - creator: ElementCreator) -> Root { + creator: ElementCreator) -> DomRoot { Node::reflect_node(box HTMLLinkElement::new_inherited(local_name, prefix, document, creator), document, HTMLLinkElementBinding::Wrap) @@ -111,7 +111,7 @@ impl HTMLLinkElement { self.stylesheet.borrow().clone() } - pub fn get_cssom_stylesheet(&self) -> Option> { + pub fn get_cssom_stylesheet(&self) -> Option> { self.get_stylesheet().map(|sheet| { self.cssom_stylesheet.or_init(|| { CSSStyleSheet::new(&window_from_node(self), @@ -408,7 +408,7 @@ impl HTMLLinkElementMethods for HTMLLinkElement { make_setter!(SetType, "type"); // https://html.spec.whatwg.org/multipage/#dom-link-rellist - fn RelList(&self) -> Root { + fn RelList(&self) -> DomRoot { self.rel_list.or_init(|| DOMTokenList::new(self.upcast(), &local_name!("rel"))) } @@ -441,7 +441,7 @@ impl HTMLLinkElementMethods for HTMLLinkElement { } // https://drafts.csswg.org/cssom/#dom-linkstyle-sheet - fn GetSheet(&self) -> Option> { - self.get_cssom_stylesheet().map(Root::upcast) + fn GetSheet(&self) -> Option> { + self.get_cssom_stylesheet().map(DomRoot::upcast) } } diff --git a/components/script/dom/htmlmapelement.rs b/components/script/dom/htmlmapelement.rs index 0f977ae1eda3..82afa2c121fe 100644 --- a/components/script/dom/htmlmapelement.rs +++ b/components/script/dom/htmlmapelement.rs @@ -4,7 +4,7 @@ use dom::bindings::codegen::Bindings::HTMLMapElementBinding; use dom::bindings::inheritance::Castable; -use dom::bindings::root::Root; +use dom::bindings::root::DomRoot; use dom::document::Document; use dom::htmlareaelement::HTMLAreaElement; use dom::htmlelement::HTMLElement; @@ -29,15 +29,15 @@ impl HTMLMapElement { #[allow(unrooted_must_root)] pub fn new(local_name: LocalName, prefix: Option, - document: &Document) -> Root { + document: &Document) -> DomRoot { Node::reflect_node(box HTMLMapElement::new_inherited(local_name, prefix, document), document, HTMLMapElementBinding::Wrap) } - pub fn get_area_elements(&self) -> Vec> { + pub fn get_area_elements(&self) -> Vec> { self.upcast::() .traverse_preorder() - .filter_map(Root::downcast::).collect() + .filter_map(DomRoot::downcast::).collect() } } diff --git a/components/script/dom/htmlmediaelement.rs b/components/script/dom/htmlmediaelement.rs index 74f8c87b77b0..7d976a9d899a 100644 --- a/components/script/dom/htmlmediaelement.rs +++ b/components/script/dom/htmlmediaelement.rs @@ -18,7 +18,7 @@ use dom::bindings::error::{Error, ErrorResult}; use dom::bindings::inheritance::Castable; use dom::bindings::refcounted::Trusted; use dom::bindings::reflector::DomObject; -use dom::bindings::root::{MutNullableDom, Root}; +use dom::bindings::root::{DomRoot, MutNullableDom}; use dom::bindings::str::DOMString; use dom::document::Document; use dom::element::{Element, AttributeMutation}; @@ -444,7 +444,7 @@ impl HTMLMediaElement { // right here. let doc = document_from_node(self); let task = MediaElementMicrotask::ResourceSelectionTask { - elem: Root::from_ref(self), + elem: DomRoot::from_ref(self), base_url: doc.base_url() }; @@ -466,7 +466,7 @@ impl HTMLMediaElement { #[allow(dead_code)] Object, Attribute(String), - Children(Root), + Children(DomRoot), } fn mode(media: &HTMLMediaElement) -> Option { if let Some(attr) = media.upcast::().get_attribute(&ns!(), &local_name!("src")) { @@ -474,7 +474,7 @@ impl HTMLMediaElement { } let source_child_element = media.upcast::() .children() - .filter_map(Root::downcast::) + .filter_map(DomRoot::downcast::) .next(); if let Some(element) = source_child_element { return Some(Mode::Children(element)); @@ -880,7 +880,7 @@ impl HTMLMediaElementMethods for HTMLMediaElement { } // https://html.spec.whatwg.org/multipage/#dom-media-error - fn GetError(&self) -> Option> { + fn GetError(&self) -> Option> { self.error.get() } @@ -933,7 +933,7 @@ impl VirtualMethods for HTMLMediaElement { if context.tree_in_doc { let task = MediaElementMicrotask::PauseIfNotInDocumentTask { - elem: Root::from_ref(self) + elem: DomRoot::from_ref(self) }; ScriptThread::await_stable_state(Microtask::MediaElement(task)); } @@ -943,11 +943,11 @@ impl VirtualMethods for HTMLMediaElement { #[derive(HeapSizeOf, JSTraceable)] pub enum MediaElementMicrotask { ResourceSelectionTask { - elem: Root, + elem: DomRoot, base_url: ServoUrl }, PauseIfNotInDocumentTask { - elem: Root, + elem: DomRoot, } } diff --git a/components/script/dom/htmlmetaelement.rs b/components/script/dom/htmlmetaelement.rs index ea79406c336c..36a2f7016430 100644 --- a/components/script/dom/htmlmetaelement.rs +++ b/components/script/dom/htmlmetaelement.rs @@ -8,7 +8,7 @@ use dom::bindings::codegen::Bindings::HTMLMetaElementBinding; use dom::bindings::codegen::Bindings::HTMLMetaElementBinding::HTMLMetaElementMethods; use dom::bindings::codegen::Bindings::NodeBinding::NodeMethods; use dom::bindings::inheritance::Castable; -use dom::bindings::root::{MutNullableDom, Root, RootedReference}; +use dom::bindings::root::{DomRoot, MutNullableDom, RootedReference}; use dom::bindings::str::DOMString; use dom::cssstylesheet::CSSStyleSheet; use dom::document::Document; @@ -51,7 +51,7 @@ impl HTMLMetaElement { #[allow(unrooted_must_root)] pub fn new(local_name: LocalName, prefix: Option, - document: &Document) -> Root { + document: &Document) -> DomRoot { Node::reflect_node(box HTMLMetaElement::new_inherited(local_name, prefix, document), document, HTMLMetaElementBinding::Wrap) @@ -61,7 +61,7 @@ impl HTMLMetaElement { self.stylesheet.borrow().clone() } - pub fn get_cssom_stylesheet(&self) -> Option> { + pub fn get_cssom_stylesheet(&self) -> Option> { self.get_stylesheet().map(|sheet| { self.cssom_stylesheet.or_init(|| { CSSStyleSheet::new(&window_from_node(self), diff --git a/components/script/dom/htmlmeterelement.rs b/components/script/dom/htmlmeterelement.rs index 20a51ac2db3c..2fd7a554fce3 100644 --- a/components/script/dom/htmlmeterelement.rs +++ b/components/script/dom/htmlmeterelement.rs @@ -4,7 +4,7 @@ use dom::bindings::codegen::Bindings::HTMLMeterElementBinding::{self, HTMLMeterElementMethods}; use dom::bindings::inheritance::Castable; -use dom::bindings::root::Root; +use dom::bindings::root::DomRoot; use dom::document::Document; use dom::htmlelement::HTMLElement; use dom::node::Node; @@ -29,7 +29,7 @@ impl HTMLMeterElement { #[allow(unrooted_must_root)] pub fn new(local_name: LocalName, prefix: Option, - document: &Document) -> Root { + document: &Document) -> DomRoot { Node::reflect_node(box HTMLMeterElement::new_inherited(local_name, prefix, document), document, HTMLMeterElementBinding::Wrap) @@ -38,7 +38,7 @@ impl HTMLMeterElement { impl HTMLMeterElementMethods for HTMLMeterElement { // https://html.spec.whatwg.org/multipage/#dom-lfe-labels - fn Labels(&self) -> Root { + fn Labels(&self) -> DomRoot { self.upcast::().labels() } } diff --git a/components/script/dom/htmlmodelement.rs b/components/script/dom/htmlmodelement.rs index 5c1aa846b2d2..4266b954a81e 100644 --- a/components/script/dom/htmlmodelement.rs +++ b/components/script/dom/htmlmodelement.rs @@ -3,7 +3,7 @@ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ use dom::bindings::codegen::Bindings::HTMLModElementBinding; -use dom::bindings::root::Root; +use dom::bindings::root::DomRoot; use dom::document::Document; use dom::htmlelement::HTMLElement; use dom::node::Node; @@ -28,7 +28,7 @@ impl HTMLModElement { #[allow(unrooted_must_root)] pub fn new(local_name: LocalName, prefix: Option, - document: &Document) -> Root { + document: &Document) -> DomRoot { Node::reflect_node(box HTMLModElement::new_inherited(local_name, prefix, document), document, HTMLModElementBinding::Wrap) diff --git a/components/script/dom/htmlobjectelement.rs b/components/script/dom/htmlobjectelement.rs index bd84b1bdd0b0..0cde28ec1a6f 100755 --- a/components/script/dom/htmlobjectelement.rs +++ b/components/script/dom/htmlobjectelement.rs @@ -7,7 +7,7 @@ use dom::bindings::cell::DomRefCell; use dom::bindings::codegen::Bindings::HTMLObjectElementBinding; use dom::bindings::codegen::Bindings::HTMLObjectElementBinding::HTMLObjectElementMethods; use dom::bindings::inheritance::Castable; -use dom::bindings::root::{MutNullableDom, Root}; +use dom::bindings::root::{DomRoot, MutNullableDom}; use dom::bindings::str::DOMString; use dom::document::Document; use dom::element::{AttributeMutation, Element}; @@ -46,7 +46,7 @@ impl HTMLObjectElement { #[allow(unrooted_must_root)] pub fn new(local_name: LocalName, prefix: Option, - document: &Document) -> Root { + document: &Document) -> DomRoot { Node::reflect_node(box HTMLObjectElement::new_inherited(local_name, prefix, document), document, HTMLObjectElementBinding::Wrap) @@ -76,7 +76,7 @@ impl<'a> ProcessDataURL for &'a HTMLObjectElement { impl HTMLObjectElementMethods for HTMLObjectElement { // https://html.spec.whatwg.org/multipage/#dom-cva-validity - fn Validity(&self) -> Root { + fn Validity(&self) -> DomRoot { let window = window_from_node(self); ValidityState::new(&window, self.upcast()) } @@ -88,7 +88,7 @@ impl HTMLObjectElementMethods for HTMLObjectElement { make_setter!(SetType, "type"); // https://html.spec.whatwg.org/multipage/#dom-fae-form - fn GetForm(&self) -> Option> { + fn GetForm(&self) -> Option> { self.form_owner() } } @@ -126,7 +126,7 @@ impl VirtualMethods for HTMLObjectElement { } impl FormControl for HTMLObjectElement { - fn form_owner(&self) -> Option> { + fn form_owner(&self) -> Option> { self.form_owner.get() } diff --git a/components/script/dom/htmlolistelement.rs b/components/script/dom/htmlolistelement.rs index 87d217575f99..58c159f1e686 100644 --- a/components/script/dom/htmlolistelement.rs +++ b/components/script/dom/htmlolistelement.rs @@ -3,7 +3,7 @@ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ use dom::bindings::codegen::Bindings::HTMLOListElementBinding; -use dom::bindings::root::Root; +use dom::bindings::root::DomRoot; use dom::document::Document; use dom::htmlelement::HTMLElement; use dom::node::Node; @@ -27,7 +27,7 @@ impl HTMLOListElement { #[allow(unrooted_must_root)] pub fn new(local_name: LocalName, prefix: Option, - document: &Document) -> Root { + document: &Document) -> DomRoot { Node::reflect_node(box HTMLOListElement::new_inherited(local_name, prefix, document), document, HTMLOListElementBinding::Wrap) diff --git a/components/script/dom/htmloptgroupelement.rs b/components/script/dom/htmloptgroupelement.rs index cbeef475d386..b22bb0a79b57 100644 --- a/components/script/dom/htmloptgroupelement.rs +++ b/components/script/dom/htmloptgroupelement.rs @@ -6,7 +6,7 @@ use dom::attr::Attr; use dom::bindings::codegen::Bindings::HTMLOptGroupElementBinding; use dom::bindings::codegen::Bindings::HTMLOptGroupElementBinding::HTMLOptGroupElementMethods; use dom::bindings::inheritance::Castable; -use dom::bindings::root::Root; +use dom::bindings::root::DomRoot; use dom::document::Document; use dom::element::{AttributeMutation, Element}; use dom::htmlelement::HTMLElement; @@ -36,7 +36,7 @@ impl HTMLOptGroupElement { #[allow(unrooted_must_root)] pub fn new(local_name: LocalName, prefix: Option, - document: &Document) -> Root { + document: &Document) -> DomRoot { Node::reflect_node(box HTMLOptGroupElement::new_inherited(local_name, prefix, document), document, HTMLOptGroupElementBinding::Wrap) @@ -73,7 +73,7 @@ impl VirtualMethods for HTMLOptGroupElement { el.set_enabled_state(!disabled_state); let options = el.upcast::().children().filter(|child| { child.is::() - }).map(|child| Root::from_ref(child.downcast::().unwrap())); + }).map(|child| DomRoot::from_ref(child.downcast::().unwrap())); if disabled_state { for option in options { let el = option.upcast::(); diff --git a/components/script/dom/htmloptionelement.rs b/components/script/dom/htmloptionelement.rs index 41f6996a2508..9e916912b871 100644 --- a/components/script/dom/htmloptionelement.rs +++ b/components/script/dom/htmloptionelement.rs @@ -9,7 +9,7 @@ use dom::bindings::codegen::Bindings::HTMLOptionElementBinding::HTMLOptionElemen use dom::bindings::codegen::Bindings::HTMLSelectElementBinding::HTMLSelectElementBinding::HTMLSelectElementMethods; use dom::bindings::codegen::Bindings::NodeBinding::NodeMethods; use dom::bindings::inheritance::Castable; -use dom::bindings::root::Root; +use dom::bindings::root::DomRoot; use dom::bindings::str::DOMString; use dom::characterdata::CharacterData; use dom::document::Document; @@ -55,7 +55,7 @@ impl HTMLOptionElement { #[allow(unrooted_must_root)] pub fn new(local_name: LocalName, prefix: Option, - document: &Document) -> Root { + document: &Document) -> DomRoot { Node::reflect_node(box HTMLOptionElement::new_inherited(local_name, prefix, document), document, HTMLOptionElementBinding::Wrap) @@ -71,7 +71,7 @@ impl HTMLOptionElement { fn pick_if_selected_and_reset(&self) { if let Some(select) = self.upcast::().ancestors() - .filter_map(Root::downcast::) + .filter_map(DomRoot::downcast::) .next() { if self.Selected() { select.pick_option(self); @@ -119,7 +119,7 @@ impl HTMLOptionElementMethods for HTMLOptionElement { } // https://html.spec.whatwg.org/multipage/#dom-option-form - fn GetForm(&self) -> Option> { + fn GetForm(&self) -> Option> { let parent = self.upcast::().GetParentNode().and_then(|p| if p.is::() { p.upcast::().GetParentNode() @@ -234,7 +234,7 @@ impl VirtualMethods for HTMLOptionElement { self.super_type().unwrap().unbind_from_tree(context); if let Some(select) = context.parent.inclusive_ancestors() - .filter_map(Root::downcast::) + .filter_map(DomRoot::downcast::) .next() { select.ask_for_reset(); } diff --git a/components/script/dom/htmloptionscollection.rs b/components/script/dom/htmloptionscollection.rs index 9e946cf84e32..84d4901aa8b6 100644 --- a/components/script/dom/htmloptionscollection.rs +++ b/components/script/dom/htmloptionscollection.rs @@ -12,7 +12,7 @@ use dom::bindings::codegen::UnionTypes::{HTMLOptionElementOrHTMLOptGroupElement, use dom::bindings::error::{Error, ErrorResult}; use dom::bindings::inheritance::Castable; use dom::bindings::reflector::reflect_dom_object; -use dom::bindings::root::{Root, RootedReference}; +use dom::bindings::root::{DomRoot, RootedReference}; use dom::bindings::str::DOMString; use dom::element::Element; use dom::htmlcollection::{CollectionFilter, HTMLCollection}; @@ -35,7 +35,7 @@ impl HTMLOptionsCollection { } pub fn new(window: &Window, select: &HTMLSelectElement, filter: Box) - -> Root + -> DomRoot { reflect_dom_object(box HTMLOptionsCollection::new_inherited(select, filter), window, @@ -61,7 +61,7 @@ impl HTMLOptionsCollectionMethods for HTMLOptionsCollection { // https://github.com/servo/servo/issues/5875 // // https://dom.spec.whatwg.org/#dom-htmlcollection-nameditem - fn NamedGetter(&self, name: DOMString) -> Option> { + fn NamedGetter(&self, name: DOMString) -> Option> { self.upcast().NamedItem(name) } @@ -75,7 +75,7 @@ impl HTMLOptionsCollectionMethods for HTMLOptionsCollection { // https://github.com/servo/servo/issues/5875 // // https://dom.spec.whatwg.org/#dom-htmlcollection-item - fn IndexedGetter(&self, index: u32) -> Option> { + fn IndexedGetter(&self, index: u32) -> Option> { self.upcast().IndexedGetter(index) } @@ -161,9 +161,9 @@ impl HTMLOptionsCollectionMethods for HTMLOptionsCollection { // Step 4 let reference_node = before.and_then(|before| { match before { - HTMLElementOrLong::HTMLElement(element) => Some(Root::upcast::(element)), + HTMLElementOrLong::HTMLElement(element) => Some(DomRoot::upcast::(element)), HTMLElementOrLong::Long(index) => { - self.upcast().IndexedGetter(index as u32).map(Root::upcast::) + self.upcast().IndexedGetter(index as u32).map(DomRoot::upcast::) } } }); diff --git a/components/script/dom/htmloutputelement.rs b/components/script/dom/htmloutputelement.rs index 2a52cfabcaab..d3d7d5991cff 100644 --- a/components/script/dom/htmloutputelement.rs +++ b/components/script/dom/htmloutputelement.rs @@ -6,7 +6,7 @@ use dom::attr::Attr; use dom::bindings::codegen::Bindings::HTMLOutputElementBinding; use dom::bindings::codegen::Bindings::HTMLOutputElementBinding::HTMLOutputElementMethods; use dom::bindings::inheritance::Castable; -use dom::bindings::root::{MutNullableDom, Root}; +use dom::bindings::root::{DomRoot, MutNullableDom}; use dom::document::Document; use dom::element::{AttributeMutation, Element}; use dom::htmlelement::HTMLElement; @@ -38,7 +38,7 @@ impl HTMLOutputElement { #[allow(unrooted_must_root)] pub fn new(local_name: LocalName, prefix: Option, - document: &Document) -> Root { + document: &Document) -> DomRoot { Node::reflect_node(box HTMLOutputElement::new_inherited(local_name, prefix, document), document, HTMLOutputElementBinding::Wrap) @@ -47,18 +47,18 @@ impl HTMLOutputElement { impl HTMLOutputElementMethods for HTMLOutputElement { // https://html.spec.whatwg.org/multipage/#dom-cva-validity - fn Validity(&self) -> Root { + fn Validity(&self) -> DomRoot { let window = window_from_node(self); ValidityState::new(&window, self.upcast()) } // https://html.spec.whatwg.org/multipage/#dom-fae-form - fn GetForm(&self) -> Option> { + fn GetForm(&self) -> Option> { self.form_owner() } // https://html.spec.whatwg.org/multipage/#dom-lfe-labels - fn Labels(&self) -> Root { + fn Labels(&self) -> DomRoot { self.upcast::().labels() } } @@ -80,7 +80,7 @@ impl VirtualMethods for HTMLOutputElement { } impl FormControl for HTMLOutputElement { - fn form_owner(&self) -> Option> { + fn form_owner(&self) -> Option> { self.form_owner.get() } diff --git a/components/script/dom/htmlparagraphelement.rs b/components/script/dom/htmlparagraphelement.rs index 061847d3e12e..f17b7653b6ff 100644 --- a/components/script/dom/htmlparagraphelement.rs +++ b/components/script/dom/htmlparagraphelement.rs @@ -3,7 +3,7 @@ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ use dom::bindings::codegen::Bindings::HTMLParagraphElementBinding; -use dom::bindings::root::Root; +use dom::bindings::root::DomRoot; use dom::document::Document; use dom::htmlelement::HTMLElement; use dom::node::Node; @@ -28,7 +28,7 @@ impl HTMLParagraphElement { #[allow(unrooted_must_root)] pub fn new(local_name: LocalName, prefix: Option, - document: &Document) -> Root { + document: &Document) -> DomRoot { Node::reflect_node(box HTMLParagraphElement::new_inherited(local_name, prefix, document), document, HTMLParagraphElementBinding::Wrap) diff --git a/components/script/dom/htmlparamelement.rs b/components/script/dom/htmlparamelement.rs index af7d73c3cd80..a1544b8157c3 100644 --- a/components/script/dom/htmlparamelement.rs +++ b/components/script/dom/htmlparamelement.rs @@ -3,7 +3,7 @@ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ use dom::bindings::codegen::Bindings::HTMLParamElementBinding; -use dom::bindings::root::Root; +use dom::bindings::root::DomRoot; use dom::document::Document; use dom::htmlelement::HTMLElement; use dom::node::Node; @@ -28,7 +28,7 @@ impl HTMLParamElement { #[allow(unrooted_must_root)] pub fn new(local_name: LocalName, prefix: Option, - document: &Document) -> Root { + document: &Document) -> DomRoot { Node::reflect_node(box HTMLParamElement::new_inherited(local_name, prefix, document), document, HTMLParamElementBinding::Wrap) diff --git a/components/script/dom/htmlpreelement.rs b/components/script/dom/htmlpreelement.rs index dc531c99b767..7befed936cc8 100644 --- a/components/script/dom/htmlpreelement.rs +++ b/components/script/dom/htmlpreelement.rs @@ -3,7 +3,7 @@ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ use dom::bindings::codegen::Bindings::HTMLPreElementBinding; -use dom::bindings::root::Root; +use dom::bindings::root::DomRoot; use dom::document::Document; use dom::htmlelement::HTMLElement; use dom::node::Node; @@ -28,7 +28,7 @@ impl HTMLPreElement { #[allow(unrooted_must_root)] pub fn new(local_name: LocalName, prefix: Option, - document: &Document) -> Root { + document: &Document) -> DomRoot { Node::reflect_node(box HTMLPreElement::new_inherited(local_name, prefix, document), document, HTMLPreElementBinding::Wrap) diff --git a/components/script/dom/htmlprogresselement.rs b/components/script/dom/htmlprogresselement.rs index c5c777d9816f..c8fb1937fe16 100644 --- a/components/script/dom/htmlprogresselement.rs +++ b/components/script/dom/htmlprogresselement.rs @@ -4,7 +4,7 @@ use dom::bindings::codegen::Bindings::HTMLProgressElementBinding::{self, HTMLProgressElementMethods}; use dom::bindings::inheritance::Castable; -use dom::bindings::root::Root; +use dom::bindings::root::DomRoot; use dom::document::Document; use dom::htmlelement::HTMLElement; use dom::node::Node; @@ -30,7 +30,7 @@ impl HTMLProgressElement { #[allow(unrooted_must_root)] pub fn new(local_name: LocalName, prefix: Option, - document: &Document) -> Root { + document: &Document) -> DomRoot { Node::reflect_node(box HTMLProgressElement::new_inherited(local_name, prefix, document), document, HTMLProgressElementBinding::Wrap) @@ -39,7 +39,7 @@ impl HTMLProgressElement { impl HTMLProgressElementMethods for HTMLProgressElement { // https://html.spec.whatwg.org/multipage/#dom-lfe-labels - fn Labels(&self) -> Root { + fn Labels(&self) -> DomRoot { self.upcast::().labels() } } diff --git a/components/script/dom/htmlquoteelement.rs b/components/script/dom/htmlquoteelement.rs index 2169851edb1d..9db0dbc87f32 100644 --- a/components/script/dom/htmlquoteelement.rs +++ b/components/script/dom/htmlquoteelement.rs @@ -3,7 +3,7 @@ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ use dom::bindings::codegen::Bindings::HTMLQuoteElementBinding; -use dom::bindings::root::Root; +use dom::bindings::root::DomRoot; use dom::document::Document; use dom::htmlelement::HTMLElement; use dom::node::Node; @@ -28,7 +28,7 @@ impl HTMLQuoteElement { #[allow(unrooted_must_root)] pub fn new(local_name: LocalName, prefix: Option, - document: &Document) -> Root { + document: &Document) -> DomRoot { Node::reflect_node(box HTMLQuoteElement::new_inherited(local_name, prefix, document), document, HTMLQuoteElementBinding::Wrap) diff --git a/components/script/dom/htmlscriptelement.rs b/components/script/dom/htmlscriptelement.rs index c6c21329dbfe..7cdebdbcba4b 100644 --- a/components/script/dom/htmlscriptelement.rs +++ b/components/script/dom/htmlscriptelement.rs @@ -11,7 +11,7 @@ use dom::bindings::codegen::Bindings::NodeBinding::NodeMethods; use dom::bindings::inheritance::Castable; use dom::bindings::refcounted::Trusted; use dom::bindings::reflector::DomObject; -use dom::bindings::root::{Dom, Root, RootedReference}; +use dom::bindings::root::{Dom, DomRoot, RootedReference}; use dom::bindings::str::DOMString; use dom::document::Document; use dom::element::{AttributeMutation, Element, ElementCreator}; @@ -83,7 +83,7 @@ impl HTMLScriptElement { #[allow(unrooted_must_root)] pub fn new(local_name: LocalName, prefix: Option, document: &Document, - creator: ElementCreator) -> Root { + creator: ElementCreator) -> DomRoot { Node::reflect_node(box HTMLScriptElement::new_inherited(local_name, prefix, document, creator), document, HTMLScriptElementBinding::Wrap) diff --git a/components/script/dom/htmlselectelement.rs b/components/script/dom/htmlselectelement.rs index 73238870e480..d9eba4dea723 100755 --- a/components/script/dom/htmlselectelement.rs +++ b/components/script/dom/htmlselectelement.rs @@ -14,7 +14,7 @@ use dom::bindings::codegen::UnionTypes::HTMLElementOrLong; use dom::bindings::codegen::UnionTypes::HTMLOptionElementOrHTMLOptGroupElement; //use dom::bindings::error::ErrorResult; use dom::bindings::inheritance::Castable; -use dom::bindings::root::{MutNullableDom, Root}; +use dom::bindings::root::{DomRoot, MutNullableDom}; use dom::bindings::str::DOMString; use dom::document::Document; use dom::element::{AttributeMutation, Element}; @@ -83,22 +83,22 @@ impl HTMLSelectElement { #[allow(unrooted_must_root)] pub fn new(local_name: LocalName, prefix: Option, - document: &Document) -> Root { + document: &Document) -> DomRoot { Node::reflect_node(box HTMLSelectElement::new_inherited(local_name, prefix, document), document, HTMLSelectElementBinding::Wrap) } // https://html.spec.whatwg.org/multipage/#concept-select-option-list - fn list_of_options(&self) -> impl Iterator> { + fn list_of_options(&self) -> impl Iterator> { self.upcast::() .children() .flat_map(|node| { if node.is::() { - let node = Root::downcast::(node).unwrap(); + let node = DomRoot::downcast::(node).unwrap(); Choice3::First(iter::once(node)) } else if node.is::() { - Choice3::Second(node.children().filter_map(Root::downcast)) + Choice3::Second(node.children().filter_map(DomRoot::downcast)) } else { Choice3::Third(iter::empty()) } @@ -120,17 +120,17 @@ impl HTMLSelectElement { return; } - let mut first_enabled: Option> = None; - let mut last_selected: Option> = None; + let mut first_enabled: Option> = None; + let mut last_selected: Option> = None; for opt in self.list_of_options() { if opt.Selected() { opt.set_selectedness(false); - last_selected = Some(Root::from_ref(&opt)); + last_selected = Some(DomRoot::from_ref(&opt)); } let element = opt.upcast::(); if first_enabled.is_none() && !element.disabled_state() { - first_enabled = Some(Root::from_ref(&opt)); + first_enabled = Some(DomRoot::from_ref(&opt)); } } @@ -189,7 +189,7 @@ impl HTMLSelectElement { impl HTMLSelectElementMethods for HTMLSelectElement { // https://html.spec.whatwg.org/multipage/#dom-cva-validity - fn Validity(&self) -> Root { + fn Validity(&self) -> DomRoot { let window = window_from_node(self); ValidityState::new(&window, self.upcast()) } @@ -206,7 +206,7 @@ impl HTMLSelectElementMethods for HTMLSelectElement { make_bool_setter!(SetDisabled, "disabled"); // https://html.spec.whatwg.org/multipage/#dom-fae-form - fn GetForm(&self) -> Option> { + fn GetForm(&self) -> Option> { self.form_owner() } @@ -238,12 +238,12 @@ impl HTMLSelectElementMethods for HTMLSelectElement { } // https://html.spec.whatwg.org/multipage/#dom-lfe-labels - fn Labels(&self) -> Root { + fn Labels(&self) -> DomRoot { self.upcast::().labels() } // https://html.spec.whatwg.org/multipage/#dom-select-options - fn Options(&self) -> Root { + fn Options(&self) -> DomRoot { self.options.or_init(|| { let window = window_from_node(self); HTMLOptionsCollection::new( @@ -262,18 +262,18 @@ impl HTMLSelectElementMethods for HTMLSelectElement { } // https://html.spec.whatwg.org/multipage/#dom-select-item - fn Item(&self, index: u32) -> Option> { + fn Item(&self, index: u32) -> Option> { self.Options().upcast().Item(index) } // https://html.spec.whatwg.org/multipage/#dom-select-item - fn IndexedGetter(&self, index: u32) -> Option> { + fn IndexedGetter(&self, index: u32) -> Option> { self.Options().IndexedGetter(index) } // https://html.spec.whatwg.org/multipage/#dom-select-nameditem - fn NamedItem(&self, name: DOMString) -> Option> { - self.Options().NamedGetter(name).map_or(None, |e| Root::downcast::(e)) + fn NamedItem(&self, name: DOMString) -> Option> { + self.Options().NamedGetter(name).map_or(None, |e| DomRoot::downcast::(e)) } // https://html.spec.whatwg.org/multipage/#dom-select-remove @@ -398,7 +398,7 @@ impl VirtualMethods for HTMLSelectElement { } impl FormControl for HTMLSelectElement { - fn form_owner(&self) -> Option> { + fn form_owner(&self) -> Option> { self.form_owner.get() } diff --git a/components/script/dom/htmlsourceelement.rs b/components/script/dom/htmlsourceelement.rs index 9ff82f59aef7..c7a60c159c86 100644 --- a/components/script/dom/htmlsourceelement.rs +++ b/components/script/dom/htmlsourceelement.rs @@ -5,7 +5,7 @@ use dom::bindings::codegen::Bindings::HTMLSourceElementBinding; use dom::bindings::codegen::Bindings::NodeBinding::NodeBinding::NodeMethods; use dom::bindings::inheritance::Castable; -use dom::bindings::root::Root; +use dom::bindings::root::DomRoot; use dom::document::Document; use dom::htmlelement::HTMLElement; use dom::htmlmediaelement::HTMLMediaElement; @@ -32,7 +32,7 @@ impl HTMLSourceElement { #[allow(unrooted_must_root)] pub fn new(local_name: LocalName, prefix: Option, - document: &Document) -> Root { + document: &Document) -> DomRoot { Node::reflect_node(box HTMLSourceElement::new_inherited(local_name, prefix, document), document, HTMLSourceElementBinding::Wrap) diff --git a/components/script/dom/htmlspanelement.rs b/components/script/dom/htmlspanelement.rs index 9713ad86007e..f0a16e47d612 100644 --- a/components/script/dom/htmlspanelement.rs +++ b/components/script/dom/htmlspanelement.rs @@ -3,7 +3,7 @@ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ use dom::bindings::codegen::Bindings::HTMLSpanElementBinding; -use dom::bindings::root::Root; +use dom::bindings::root::DomRoot; use dom::document::Document; use dom::htmlelement::HTMLElement; use dom::node::Node; @@ -25,7 +25,7 @@ impl HTMLSpanElement { #[allow(unrooted_must_root)] pub fn new(local_name: LocalName, prefix: Option, - document: &Document) -> Root { + document: &Document) -> DomRoot { Node::reflect_node(box HTMLSpanElement::new_inherited(local_name, prefix, document), document, HTMLSpanElementBinding::Wrap) diff --git a/components/script/dom/htmlstyleelement.rs b/components/script/dom/htmlstyleelement.rs index 0ba69b635499..952c143ad688 100644 --- a/components/script/dom/htmlstyleelement.rs +++ b/components/script/dom/htmlstyleelement.rs @@ -8,7 +8,7 @@ use dom::bindings::codegen::Bindings::HTMLStyleElementBinding; use dom::bindings::codegen::Bindings::HTMLStyleElementBinding::HTMLStyleElementMethods; use dom::bindings::codegen::Bindings::NodeBinding::NodeMethods; use dom::bindings::inheritance::Castable; -use dom::bindings::root::{MutNullableDom, Root}; +use dom::bindings::root::{DomRoot, MutNullableDom}; use dom::cssstylesheet::CSSStyleSheet; use dom::document::Document; use dom::element::{Element, ElementCreator}; @@ -63,7 +63,7 @@ impl HTMLStyleElement { pub fn new(local_name: LocalName, prefix: Option, document: &Document, - creator: ElementCreator) -> Root { + creator: ElementCreator) -> DomRoot { Node::reflect_node(box HTMLStyleElement::new_inherited(local_name, prefix, document, creator), document, HTMLStyleElementBinding::Wrap) @@ -128,7 +128,7 @@ impl HTMLStyleElement { self.stylesheet.borrow().clone() } - pub fn get_cssom_stylesheet(&self) -> Option> { + pub fn get_cssom_stylesheet(&self) -> Option> { self.get_stylesheet().map(|sheet| { self.cssom_stylesheet.or_init(|| { CSSStyleSheet::new(&window_from_node(self), @@ -236,7 +236,7 @@ impl StylesheetOwner for HTMLStyleElement { impl HTMLStyleElementMethods for HTMLStyleElement { // https://drafts.csswg.org/cssom/#dom-linkstyle-sheet - fn GetSheet(&self) -> Option> { - self.get_cssom_stylesheet().map(Root::upcast) + fn GetSheet(&self) -> Option> { + self.get_cssom_stylesheet().map(DomRoot::upcast) } } diff --git a/components/script/dom/htmltablecaptionelement.rs b/components/script/dom/htmltablecaptionelement.rs index 852850f4db99..2ceecc50609e 100644 --- a/components/script/dom/htmltablecaptionelement.rs +++ b/components/script/dom/htmltablecaptionelement.rs @@ -3,7 +3,7 @@ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ use dom::bindings::codegen::Bindings::HTMLTableCaptionElementBinding; -use dom::bindings::root::Root; +use dom::bindings::root::DomRoot; use dom::document::Document; use dom::htmlelement::HTMLElement; use dom::node::Node; @@ -28,7 +28,7 @@ impl HTMLTableCaptionElement { #[allow(unrooted_must_root)] pub fn new(local_name: LocalName, prefix: Option, - document: &Document) -> Root { + document: &Document) -> DomRoot { Node::reflect_node(box HTMLTableCaptionElement::new_inherited(local_name, prefix, document), document, HTMLTableCaptionElementBinding::Wrap) diff --git a/components/script/dom/htmltablecolelement.rs b/components/script/dom/htmltablecolelement.rs index d2910023466a..ffbef21ed897 100644 --- a/components/script/dom/htmltablecolelement.rs +++ b/components/script/dom/htmltablecolelement.rs @@ -3,7 +3,7 @@ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ use dom::bindings::codegen::Bindings::HTMLTableColElementBinding; -use dom::bindings::root::Root; +use dom::bindings::root::DomRoot; use dom::document::Document; use dom::htmlelement::HTMLElement; use dom::node::Node; @@ -28,7 +28,7 @@ impl HTMLTableColElement { #[allow(unrooted_must_root)] pub fn new(local_name: LocalName, prefix: Option, - document: &Document) -> Root { + document: &Document) -> DomRoot { Node::reflect_node(box HTMLTableColElement::new_inherited(local_name, prefix, document), document, HTMLTableColElementBinding::Wrap) diff --git a/components/script/dom/htmltabledatacellelement.rs b/components/script/dom/htmltabledatacellelement.rs index 6c9a2c638179..7ebd64f20dc0 100644 --- a/components/script/dom/htmltabledatacellelement.rs +++ b/components/script/dom/htmltabledatacellelement.rs @@ -3,7 +3,7 @@ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ use dom::bindings::codegen::Bindings::HTMLTableDataCellElementBinding; -use dom::bindings::root::Root; +use dom::bindings::root::DomRoot; use dom::document::Document; use dom::htmltablecellelement::HTMLTableCellElement; use dom::node::Node; @@ -27,7 +27,7 @@ impl HTMLTableDataCellElement { #[allow(unrooted_must_root)] pub fn new(local_name: LocalName, prefix: Option, document: &Document) - -> Root { + -> DomRoot { Node::reflect_node(box HTMLTableDataCellElement::new_inherited(local_name, prefix, document), diff --git a/components/script/dom/htmltableelement.rs b/components/script/dom/htmltableelement.rs index 3571dda873d1..2f8e3e3857b2 100644 --- a/components/script/dom/htmltableelement.rs +++ b/components/script/dom/htmltableelement.rs @@ -10,7 +10,7 @@ use dom::bindings::codegen::Bindings::HTMLTableElementBinding::HTMLTableElementM use dom::bindings::codegen::Bindings::NodeBinding::NodeMethods; use dom::bindings::error::{Error, ErrorResult, Fallible}; use dom::bindings::inheritance::Castable; -use dom::bindings::root::{Dom, LayoutDom, MutNullableDom, Root, RootedReference}; +use dom::bindings::root::{Dom, DomRoot, LayoutDom, MutNullableDom, RootedReference}; use dom::bindings::str::DOMString; use dom::document::Document; use dom::element::{AttributeMutation, Element, RawLayoutElementHelpers}; @@ -62,7 +62,7 @@ impl HTMLTableElement { #[allow(unrooted_must_root)] pub fn new(local_name: LocalName, prefix: Option, document: &Document) - -> Root { + -> DomRoot { Node::reflect_node(box HTMLTableElement::new_inherited(local_name, prefix, document), document, HTMLTableElementBinding::Wrap) @@ -74,11 +74,11 @@ impl HTMLTableElement { // https://html.spec.whatwg.org/multipage/#dom-table-thead // https://html.spec.whatwg.org/multipage/#dom-table-tfoot - fn get_first_section_of_type(&self, atom: &LocalName) -> Option> { + fn get_first_section_of_type(&self, atom: &LocalName) -> Option> { self.upcast::() .child_elements() .find(|n| n.is::() && n.local_name() == atom) - .and_then(|n| n.downcast().map(Root::from_ref)) + .and_then(|n| n.downcast().map(DomRoot::from_ref)) } // https://html.spec.whatwg.org/multipage/#dom-table-thead @@ -88,7 +88,7 @@ impl HTMLTableElement { section: Option<&HTMLTableSectionElement>, reference_predicate: P) -> ErrorResult - where P: FnMut(&Root) -> bool { + where P: FnMut(&DomRoot) -> bool { if let Some(e) = section { if e.upcast::().local_name() != atom { return Err(Error::HierarchyRequest) @@ -111,7 +111,7 @@ impl HTMLTableElement { // https://html.spec.whatwg.org/multipage/#dom-table-createthead // https://html.spec.whatwg.org/multipage/#dom-table-createtfoot - fn create_section_of_type(&self, atom: &LocalName) -> Root { + fn create_section_of_type(&self, atom: &LocalName) -> DomRoot { if let Some(section) = self.get_first_section_of_type(atom) { return section } @@ -149,14 +149,14 @@ impl HTMLTableElement { impl HTMLTableElementMethods for HTMLTableElement { // https://html.spec.whatwg.org/multipage/#dom-table-rows - fn Rows(&self) -> Root { + fn Rows(&self) -> DomRoot { let filter = self.get_rows(); HTMLCollection::new(&window_from_node(self), self.upcast(), box filter) } // https://html.spec.whatwg.org/multipage/#dom-table-caption - fn GetCaption(&self) -> Option> { - self.upcast::().children().filter_map(Root::downcast).next() + fn GetCaption(&self) -> Option> { + self.upcast::().children().filter_map(DomRoot::downcast).next() } // https://html.spec.whatwg.org/multipage/#dom-table-caption @@ -173,7 +173,7 @@ impl HTMLTableElementMethods for HTMLTableElement { } // https://html.spec.whatwg.org/multipage/#dom-table-createcaption - fn CreateCaption(&self) -> Root { + fn CreateCaption(&self) -> DomRoot { match self.GetCaption() { Some(caption) => caption, None => { @@ -195,7 +195,7 @@ impl HTMLTableElementMethods for HTMLTableElement { // https://html.spec.whatwg.org/multipage/#dom-table-thead - fn GetTHead(&self) -> Option> { + fn GetTHead(&self) -> Option> { self.get_first_section_of_type(&local_name!("thead")) } @@ -207,7 +207,7 @@ impl HTMLTableElementMethods for HTMLTableElement { } // https://html.spec.whatwg.org/multipage/#dom-table-createthead - fn CreateTHead(&self) -> Root { + fn CreateTHead(&self) -> DomRoot { self.create_section_of_type(&local_name!("thead")) } @@ -217,7 +217,7 @@ impl HTMLTableElementMethods for HTMLTableElement { } // https://html.spec.whatwg.org/multipage/#dom-table-tfoot - fn GetTFoot(&self) -> Option> { + fn GetTFoot(&self) -> Option> { self.get_first_section_of_type(&local_name!("tfoot")) } @@ -241,7 +241,7 @@ impl HTMLTableElementMethods for HTMLTableElement { } // https://html.spec.whatwg.org/multipage/#dom-table-createtfoot - fn CreateTFoot(&self) -> Root { + fn CreateTFoot(&self) -> DomRoot { self.create_section_of_type(&local_name!("tfoot")) } @@ -251,7 +251,7 @@ impl HTMLTableElementMethods for HTMLTableElement { } // https://html.spec.whatwg.org/multipage/#dom-table-tbodies - fn TBodies(&self) -> Root { + fn TBodies(&self) -> DomRoot { #[derive(JSTraceable)] struct TBodiesFilter; impl CollectionFilter for TBodiesFilter { @@ -271,14 +271,14 @@ impl HTMLTableElementMethods for HTMLTableElement { // https://html.spec.whatwg.org/multipage/#dom-table-createtbody - fn CreateTBody(&self) -> Root { + fn CreateTBody(&self) -> DomRoot { let tbody = HTMLTableSectionElement::new(local_name!("tbody"), None, &document_from_node(self)); let node = self.upcast::(); let last_tbody = node.rev_children() - .filter_map(Root::downcast::) + .filter_map(DomRoot::downcast::) .find(|n| n.is::() && n.local_name() == &local_name!("tbody")); let reference_element = last_tbody.and_then(|t| t.upcast::().GetNextSibling()); @@ -289,7 +289,7 @@ impl HTMLTableElementMethods for HTMLTableElement { } // https://html.spec.whatwg.org/multipage/#dom-table-insertrow - fn InsertRow(&self, index: i32) -> Fallible> { + fn InsertRow(&self, index: i32) -> Fallible> { let rows = self.Rows(); let number_of_row_elements = rows.Length(); @@ -305,7 +305,7 @@ impl HTMLTableElementMethods for HTMLTableElement { if number_of_row_elements == 0 { // append new row to last or new tbody in table if let Some(last_tbody) = node.rev_children() - .filter_map(Root::downcast::) + .filter_map(DomRoot::downcast::) .find(|n| n.is::() && n.local_name() == &local_name!("tbody")) { last_tbody.upcast::().AppendChild(new_row.upcast::()) .expect("InsertRow failed to append first row."); @@ -355,7 +355,7 @@ impl HTMLTableElementMethods for HTMLTableElement { return Err(Error::IndexSize); } // Step 3. - Root::upcast::(rows.Item(index as u32).unwrap()).remove_self(); + DomRoot::upcast::(rows.Item(index as u32).unwrap()).remove_self(); Ok(()) } diff --git a/components/script/dom/htmltableheadercellelement.rs b/components/script/dom/htmltableheadercellelement.rs index 7f426ff9dca9..6b03b4211171 100644 --- a/components/script/dom/htmltableheadercellelement.rs +++ b/components/script/dom/htmltableheadercellelement.rs @@ -3,7 +3,7 @@ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ use dom::bindings::codegen::Bindings::HTMLTableHeaderCellElementBinding; -use dom::bindings::root::Root; +use dom::bindings::root::DomRoot; use dom::document::Document; use dom::htmltablecellelement::HTMLTableCellElement; use dom::node::Node; @@ -28,7 +28,7 @@ impl HTMLTableHeaderCellElement { #[allow(unrooted_must_root)] pub fn new(local_name: LocalName, prefix: Option, - document: &Document) -> Root { + document: &Document) -> DomRoot { Node::reflect_node(box HTMLTableHeaderCellElement::new_inherited(local_name, prefix, document), document, HTMLTableHeaderCellElementBinding::Wrap) diff --git a/components/script/dom/htmltablerowelement.rs b/components/script/dom/htmltablerowelement.rs index ded30ae590c2..bdc6708ee4f2 100644 --- a/components/script/dom/htmltablerowelement.rs +++ b/components/script/dom/htmltablerowelement.rs @@ -9,7 +9,7 @@ use dom::bindings::codegen::Bindings::HTMLTableSectionElementBinding::HTMLTableS use dom::bindings::codegen::Bindings::NodeBinding::NodeMethods; use dom::bindings::error::{ErrorResult, Fallible}; use dom::bindings::inheritance::Castable; -use dom::bindings::root::{LayoutDom, MutNullableDom, Root, RootedReference}; +use dom::bindings::root::{DomRoot, LayoutDom, MutNullableDom, RootedReference}; use dom::bindings::str::DOMString; use dom::document::Document; use dom::element::{Element, RawLayoutElementHelpers}; @@ -51,7 +51,7 @@ impl HTMLTableRowElement { #[allow(unrooted_must_root)] pub fn new(local_name: LocalName, prefix: Option, document: &Document) - -> Root { + -> DomRoot { Node::reflect_node(box HTMLTableRowElement::new_inherited(local_name, prefix, document), document, HTMLTableRowElementBinding::Wrap) @@ -59,7 +59,7 @@ impl HTMLTableRowElement { /// Determine the index for this `HTMLTableRowElement` within the given /// `HTMLCollection`. Returns `-1` if not found within collection. - fn row_index(&self, collection: Root) -> i32 { + fn row_index(&self, collection: DomRoot) -> i32 { collection.elements_iter() .position(|elem| (&elem as &Element) == self.upcast()) .map_or(-1, |i| i as i32) @@ -74,7 +74,7 @@ impl HTMLTableRowElementMethods for HTMLTableRowElement { make_legacy_color_setter!(SetBgColor, "bgcolor"); // https://html.spec.whatwg.org/multipage/#dom-tr-cells - fn Cells(&self) -> Root { + fn Cells(&self) -> DomRoot { self.cells.or_init(|| { let window = window_from_node(self); let filter = box CellsFilter; @@ -83,7 +83,7 @@ impl HTMLTableRowElementMethods for HTMLTableRowElement { } // https://html.spec.whatwg.org/multipage/#dom-tr-insertcell - fn InsertCell(&self, index: i32) -> Fallible> { + fn InsertCell(&self, index: i32) -> Fallible> { let node = self.upcast::(); node.insert_cell_or_row( index, diff --git a/components/script/dom/htmltablesectionelement.rs b/components/script/dom/htmltablesectionelement.rs index ffaaeea04273..1b4d1c72020d 100644 --- a/components/script/dom/htmltablesectionelement.rs +++ b/components/script/dom/htmltablesectionelement.rs @@ -7,7 +7,7 @@ use dom::bindings::codegen::Bindings::HTMLTableSectionElementBinding::{self, HTM use dom::bindings::codegen::Bindings::NodeBinding::NodeMethods; use dom::bindings::error::{ErrorResult, Fallible}; use dom::bindings::inheritance::Castable; -use dom::bindings::root::{LayoutDom, Root, RootedReference}; +use dom::bindings::root::{DomRoot, LayoutDom, RootedReference}; use dom::bindings::str::DOMString; use dom::document::Document; use dom::element::{Element, RawLayoutElementHelpers}; @@ -35,7 +35,7 @@ impl HTMLTableSectionElement { #[allow(unrooted_must_root)] pub fn new(local_name: LocalName, prefix: Option, document: &Document) - -> Root { + -> DomRoot { Node::reflect_node(box HTMLTableSectionElement::new_inherited(local_name, prefix, document), document, HTMLTableSectionElementBinding::Wrap) @@ -53,12 +53,12 @@ impl CollectionFilter for RowsFilter { impl HTMLTableSectionElementMethods for HTMLTableSectionElement { // https://html.spec.whatwg.org/multipage/#dom-tbody-rows - fn Rows(&self) -> Root { + fn Rows(&self) -> DomRoot { HTMLCollection::create(&window_from_node(self), self.upcast(), box RowsFilter) } // https://html.spec.whatwg.org/multipage/#dom-tbody-insertrow - fn InsertRow(&self, index: i32) -> Fallible> { + fn InsertRow(&self, index: i32) -> Fallible> { let node = self.upcast::(); node.insert_cell_or_row( index, diff --git a/components/script/dom/htmltemplateelement.rs b/components/script/dom/htmltemplateelement.rs index 5f345206a949..dde9d380c728 100644 --- a/components/script/dom/htmltemplateelement.rs +++ b/components/script/dom/htmltemplateelement.rs @@ -7,7 +7,7 @@ use dom::bindings::codegen::Bindings::HTMLTemplateElementBinding; use dom::bindings::codegen::Bindings::HTMLTemplateElementBinding::HTMLTemplateElementMethods; use dom::bindings::codegen::Bindings::NodeBinding::NodeMethods; use dom::bindings::inheritance::Castable; -use dom::bindings::root::{MutNullableDom, Root}; +use dom::bindings::root::{DomRoot, MutNullableDom}; use dom::document::Document; use dom::documentfragment::DocumentFragment; use dom::htmlelement::HTMLElement; @@ -38,7 +38,7 @@ impl HTMLTemplateElement { #[allow(unrooted_must_root)] pub fn new(local_name: LocalName, prefix: Option, - document: &Document) -> Root { + document: &Document) -> DomRoot { Node::reflect_node(box HTMLTemplateElement::new_inherited(local_name, prefix, document), document, HTMLTemplateElementBinding::Wrap) @@ -47,7 +47,7 @@ impl HTMLTemplateElement { impl HTMLTemplateElementMethods for HTMLTemplateElement { /// https://html.spec.whatwg.org/multipage/#dom-template-content - fn Content(&self) -> Root { + fn Content(&self) -> DomRoot { self.contents.or_init(|| { let doc = document_from_node(self); doc.appropriate_template_contents_owner_document().CreateDocumentFragment() @@ -79,7 +79,7 @@ impl VirtualMethods for HTMLTemplateElement { } let copy = copy.downcast::().unwrap(); // Steps 2-3. - let copy_contents = Root::upcast::(copy.Content()); + let copy_contents = DomRoot::upcast::(copy.Content()); let copy_contents_doc = copy_contents.owner_doc(); for child in self.Content().upcast::().children() { let copy_child = Node::clone( diff --git a/components/script/dom/htmltextareaelement.rs b/components/script/dom/htmltextareaelement.rs index 3d0cc360deb3..c599113f6b39 100755 --- a/components/script/dom/htmltextareaelement.rs +++ b/components/script/dom/htmltextareaelement.rs @@ -9,7 +9,7 @@ use dom::bindings::codegen::Bindings::HTMLTextAreaElementBinding; use dom::bindings::codegen::Bindings::HTMLTextAreaElementBinding::HTMLTextAreaElementMethods; use dom::bindings::codegen::Bindings::NodeBinding::NodeMethods; use dom::bindings::inheritance::Castable; -use dom::bindings::root::{LayoutDom, MutNullableDom, Root}; +use dom::bindings::root::{DomRoot, LayoutDom, MutNullableDom}; use dom::bindings::str::DOMString; use dom::document::Document; use dom::element::{AttributeMutation, Element}; @@ -124,7 +124,7 @@ impl HTMLTextAreaElement { #[allow(unrooted_must_root)] pub fn new(local_name: LocalName, prefix: Option, - document: &Document) -> Root { + document: &Document) -> DomRoot { Node::reflect_node(box HTMLTextAreaElement::new_inherited(local_name, prefix, document), document, HTMLTextAreaElementBinding::Wrap) @@ -156,7 +156,7 @@ impl HTMLTextAreaElementMethods for HTMLTextAreaElement { make_bool_setter!(SetDisabled, "disabled"); // https://html.spec.whatwg.org/multipage/#dom-fae-form - fn GetForm(&self) -> Option> { + fn GetForm(&self) -> Option> { self.form_owner() } @@ -232,7 +232,7 @@ impl HTMLTextAreaElementMethods for HTMLTextAreaElement { } // https://html.spec.whatwg.org/multipage/#dom-lfe-labels - fn Labels(&self) -> Root { + fn Labels(&self) -> DomRoot { self.upcast::().labels() } @@ -441,7 +441,7 @@ impl VirtualMethods for HTMLTextAreaElement { } impl FormControl for HTMLTextAreaElement { - fn form_owner(&self) -> Option> { + fn form_owner(&self) -> Option> { self.form_owner.get() } diff --git a/components/script/dom/htmltimeelement.rs b/components/script/dom/htmltimeelement.rs index c5a54bc0ebcd..0653d32ad5fe 100644 --- a/components/script/dom/htmltimeelement.rs +++ b/components/script/dom/htmltimeelement.rs @@ -4,7 +4,7 @@ use dom::bindings::codegen::Bindings::HTMLTimeElementBinding; use dom::bindings::codegen::Bindings::HTMLTimeElementBinding::HTMLTimeElementMethods; -use dom::bindings::root::Root; +use dom::bindings::root::DomRoot; use dom::bindings::str::DOMString; use dom::document::Document; use dom::htmlelement::HTMLElement; @@ -27,7 +27,7 @@ impl HTMLTimeElement { #[allow(unrooted_must_root)] pub fn new(local_name: LocalName, prefix: Option, - document: &Document) -> Root { + document: &Document) -> DomRoot { Node::reflect_node(box HTMLTimeElement::new_inherited(local_name, prefix, document), document, HTMLTimeElementBinding::Wrap) diff --git a/components/script/dom/htmltitleelement.rs b/components/script/dom/htmltitleelement.rs index 4e7208dc9ad7..0c1aeac47b60 100644 --- a/components/script/dom/htmltitleelement.rs +++ b/components/script/dom/htmltitleelement.rs @@ -6,7 +6,7 @@ use dom::bindings::codegen::Bindings::HTMLTitleElementBinding; use dom::bindings::codegen::Bindings::HTMLTitleElementBinding::HTMLTitleElementMethods; use dom::bindings::codegen::Bindings::NodeBinding::NodeMethods; use dom::bindings::inheritance::Castable; -use dom::bindings::root::Root; +use dom::bindings::root::DomRoot; use dom::bindings::str::DOMString; use dom::document::Document; use dom::htmlelement::HTMLElement; @@ -30,7 +30,7 @@ impl HTMLTitleElement { #[allow(unrooted_must_root)] pub fn new(local_name: LocalName, prefix: Option, - document: &Document) -> Root { + document: &Document) -> DomRoot { Node::reflect_node(box HTMLTitleElement::new_inherited(local_name, prefix, document), document, HTMLTitleElementBinding::Wrap) diff --git a/components/script/dom/htmltrackelement.rs b/components/script/dom/htmltrackelement.rs index f91ea1aba3d4..94015862c58b 100644 --- a/components/script/dom/htmltrackelement.rs +++ b/components/script/dom/htmltrackelement.rs @@ -3,7 +3,7 @@ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ use dom::bindings::codegen::Bindings::HTMLTrackElementBinding; -use dom::bindings::root::Root; +use dom::bindings::root::DomRoot; use dom::document::Document; use dom::htmlelement::HTMLElement; use dom::node::Node; @@ -25,7 +25,7 @@ impl HTMLTrackElement { #[allow(unrooted_must_root)] pub fn new(local_name: LocalName, prefix: Option, - document: &Document) -> Root { + document: &Document) -> DomRoot { Node::reflect_node(box HTMLTrackElement::new_inherited(local_name, prefix, document), document, HTMLTrackElementBinding::Wrap) diff --git a/components/script/dom/htmlulistelement.rs b/components/script/dom/htmlulistelement.rs index 7240597d4f03..d6b1b7ea41e1 100644 --- a/components/script/dom/htmlulistelement.rs +++ b/components/script/dom/htmlulistelement.rs @@ -3,7 +3,7 @@ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ use dom::bindings::codegen::Bindings::HTMLUListElementBinding; -use dom::bindings::root::Root; +use dom::bindings::root::DomRoot; use dom::document::Document; use dom::htmlelement::HTMLElement; use dom::node::Node; @@ -25,7 +25,7 @@ impl HTMLUListElement { #[allow(unrooted_must_root)] pub fn new(local_name: LocalName, prefix: Option, - document: &Document) -> Root { + document: &Document) -> DomRoot { Node::reflect_node(box HTMLUListElement::new_inherited(local_name, prefix, document), document, HTMLUListElementBinding::Wrap) diff --git a/components/script/dom/htmlunknownelement.rs b/components/script/dom/htmlunknownelement.rs index 7894dfafc432..1622b88cb777 100644 --- a/components/script/dom/htmlunknownelement.rs +++ b/components/script/dom/htmlunknownelement.rs @@ -3,7 +3,7 @@ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ use dom::bindings::codegen::Bindings::HTMLUnknownElementBinding; -use dom::bindings::root::Root; +use dom::bindings::root::DomRoot; use dom::document::Document; use dom::htmlelement::HTMLElement; use dom::node::Node; @@ -28,7 +28,7 @@ impl HTMLUnknownElement { #[allow(unrooted_must_root)] pub fn new(local_name: LocalName, prefix: Option, - document: &Document) -> Root { + document: &Document) -> DomRoot { Node::reflect_node(box HTMLUnknownElement::new_inherited(local_name, prefix, document), document, HTMLUnknownElementBinding::Wrap) diff --git a/components/script/dom/htmlvideoelement.rs b/components/script/dom/htmlvideoelement.rs index c841832c17d2..998f46c279bc 100644 --- a/components/script/dom/htmlvideoelement.rs +++ b/components/script/dom/htmlvideoelement.rs @@ -3,7 +3,7 @@ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ use dom::bindings::codegen::Bindings::HTMLVideoElementBinding; -use dom::bindings::root::Root; +use dom::bindings::root::DomRoot; use dom::document::Document; use dom::htmlmediaelement::HTMLMediaElement; use dom::node::Node; @@ -26,7 +26,7 @@ impl HTMLVideoElement { #[allow(unrooted_must_root)] pub fn new(local_name: LocalName, prefix: Option, - document: &Document) -> Root { + document: &Document) -> DomRoot { Node::reflect_node(box HTMLVideoElement::new_inherited(local_name, prefix, document), document, HTMLVideoElementBinding::Wrap) diff --git a/components/script/dom/imagedata.rs b/components/script/dom/imagedata.rs index 910bc4004ded..98be416ff457 100644 --- a/components/script/dom/imagedata.rs +++ b/components/script/dom/imagedata.rs @@ -7,7 +7,7 @@ use dom::bindings::codegen::Bindings::ImageDataBinding; use dom::bindings::codegen::Bindings::ImageDataBinding::ImageDataMethods; use dom::bindings::error::{Fallible, Error}; use dom::bindings::reflector::{Reflector, reflect_dom_object}; -use dom::bindings::root::Root; +use dom::bindings::root::DomRoot; use dom::globalscope::GlobalScope; use dom_struct::dom_struct; use euclid::Size2D; @@ -32,7 +32,7 @@ impl ImageData { width: u32, height: u32, mut data: Option>) - -> Fallible> { + -> Fallible> { let len = width * height * 4; unsafe { let cx = global.get_cx(); @@ -54,7 +54,7 @@ impl ImageData { width: u32, mut opt_height: Option, opt_jsobject: Option<*mut JSObject>) - -> Fallible> { + -> Fallible> { assert!(opt_jsobject.is_some() || opt_height.is_some()); if width == 0 { @@ -113,7 +113,7 @@ impl ImageData { // https://html.spec.whatwg.org/multipage/#pixel-manipulation:dom-imagedata-3 #[allow(unsafe_code)] - pub fn Constructor(global: &GlobalScope, width: u32, height: u32) -> Fallible> { + pub fn Constructor(global: &GlobalScope, width: u32, height: u32) -> Fallible> { unsafe { Self::new_with_jsobject(global, width, Some(height), None) } } @@ -125,7 +125,7 @@ impl ImageData { jsobject: *mut JSObject, width: u32, opt_height: Option) - -> Fallible> { + -> Fallible> { Self::new_with_jsobject(global, width, opt_height, Some(jsobject)) } diff --git a/components/script/dom/inputevent.rs b/components/script/dom/inputevent.rs index 821008bb383e..641eb21a5d30 100644 --- a/components/script/dom/inputevent.rs +++ b/components/script/dom/inputevent.rs @@ -6,7 +6,7 @@ use dom::bindings::codegen::Bindings::InputEventBinding::{self, InputEventMethod use dom::bindings::codegen::Bindings::UIEventBinding::UIEventBinding::UIEventMethods; use dom::bindings::error::Fallible; use dom::bindings::reflector::reflect_dom_object; -use dom::bindings::root::{Root, RootedReference}; +use dom::bindings::root::{DomRoot, RootedReference}; use dom::bindings::str::DOMString; use dom::uievent::UIEvent; use dom::window::Window; @@ -27,7 +27,7 @@ impl InputEvent { view: Option<&Window>, detail: i32, data: Option, - is_composing: bool) -> Root { + is_composing: bool) -> DomRoot { let ev = reflect_dom_object(box InputEvent { uievent: UIEvent::new_inherited(), data: data, @@ -42,7 +42,7 @@ impl InputEvent { pub fn Constructor(window: &Window, type_: DOMString, init: &InputEventBinding::InputEventInit) - -> Fallible> { + -> Fallible> { let event = InputEvent::new(window, type_, init.parent.parent.bubbles, diff --git a/components/script/dom/keyboardevent.rs b/components/script/dom/keyboardevent.rs index 4107c809d3e4..69d71ae665af 100644 --- a/components/script/dom/keyboardevent.rs +++ b/components/script/dom/keyboardevent.rs @@ -9,7 +9,7 @@ use dom::bindings::codegen::Bindings::UIEventBinding::UIEventMethods; use dom::bindings::error::Fallible; use dom::bindings::inheritance::Castable; use dom::bindings::reflector::reflect_dom_object; -use dom::bindings::root::{Root, RootedReference}; +use dom::bindings::root::{DomRoot, RootedReference}; use dom::bindings::str::DOMString; use dom::event::Event; use dom::uievent::UIEvent; @@ -60,7 +60,7 @@ impl KeyboardEvent { } } - pub fn new_uninitialized(window: &Window) -> Root { + pub fn new_uninitialized(window: &Window) -> DomRoot { reflect_dom_object(box KeyboardEvent::new_inherited(), window, KeyboardEventBinding::Wrap) @@ -84,7 +84,7 @@ impl KeyboardEvent { shift_key: bool, meta_key: bool, char_code: Option, - key_code: u32) -> Root { + key_code: u32) -> DomRoot { let ev = KeyboardEvent::new_uninitialized(window); ev.InitKeyboardEvent(type_, can_bubble, cancelable, view, key_string, location, DOMString::new(), repeat, DOMString::new()); @@ -103,7 +103,7 @@ impl KeyboardEvent { pub fn Constructor(window: &Window, type_: DOMString, - init: &KeyboardEventBinding::KeyboardEventInit) -> Fallible> { + init: &KeyboardEventBinding::KeyboardEventInit) -> Fallible> { let event = KeyboardEvent::new(window, type_, init.parent.parent.parent.bubbles, diff --git a/components/script/dom/location.rs b/components/script/dom/location.rs index 839e709d71cb..868b9df22660 100644 --- a/components/script/dom/location.rs +++ b/components/script/dom/location.rs @@ -7,7 +7,7 @@ use dom::bindings::codegen::Bindings::LocationBinding::LocationMethods; use dom::bindings::codegen::Bindings::WindowBinding::WindowBinding::WindowMethods; use dom::bindings::error::{Error, ErrorResult, Fallible}; use dom::bindings::reflector::{Reflector, reflect_dom_object}; -use dom::bindings::root::{Dom, Root}; +use dom::bindings::root::{Dom, DomRoot}; use dom::bindings::str::{DOMString, USVString}; use dom::globalscope::GlobalScope; use dom::urlhelper::UrlHelper; @@ -29,7 +29,7 @@ impl Location { } } - pub fn new(window: &Window) -> Root { + pub fn new(window: &Window) -> DomRoot { reflect_dom_object(box Location::new_inherited(window), window, LocationBinding::Wrap) diff --git a/components/script/dom/macros.rs b/components/script/dom/macros.rs index 43b1b17724f7..9029a2b694a9 100644 --- a/components/script/dom/macros.rs +++ b/components/script/dom/macros.rs @@ -601,7 +601,7 @@ macro_rules! impl_performance_entry_struct( ($binding:ident, $struct:ident, $type:expr) => ( use dom::bindings::codegen::Bindings::$binding; use dom::bindings::reflector::reflect_dom_object; - use dom::bindings::root::Root; + use dom::bindings::root::DomRoot; use dom::bindings::str::DOMString; use dom::globalscope::GlobalScope; use dom::performanceentry::PerformanceEntry; @@ -627,7 +627,7 @@ macro_rules! impl_performance_entry_struct( pub fn new(global: &GlobalScope, name: DOMString, start_time: f64, - duration: f64) -> Root<$struct> { + duration: f64) -> DomRoot<$struct> { let entry = $struct::new_inherited(name, start_time, duration); reflect_dom_object(box entry, global, $binding::Wrap) } diff --git a/components/script/dom/mediaerror.rs b/components/script/dom/mediaerror.rs index a506134b90ca..5787085e9fc7 100644 --- a/components/script/dom/mediaerror.rs +++ b/components/script/dom/mediaerror.rs @@ -4,7 +4,7 @@ use dom::bindings::codegen::Bindings::MediaErrorBinding::{self, MediaErrorMethods}; use dom::bindings::reflector::{Reflector, reflect_dom_object}; -use dom::bindings::root::Root; +use dom::bindings::root::DomRoot; use dom::window::Window; use dom_struct::dom_struct; @@ -22,7 +22,7 @@ impl MediaError { } } - pub fn new(window: &Window, code: u16) -> Root { + pub fn new(window: &Window, code: u16) -> DomRoot { reflect_dom_object(box MediaError::new_inherited(code), window, MediaErrorBinding::Wrap) diff --git a/components/script/dom/medialist.rs b/components/script/dom/medialist.rs index e707dd428cf5..8b67de260719 100644 --- a/components/script/dom/medialist.rs +++ b/components/script/dom/medialist.rs @@ -7,7 +7,7 @@ use dom::bindings::codegen::Bindings::MediaListBinding; use dom::bindings::codegen::Bindings::MediaListBinding::MediaListMethods; use dom::bindings::codegen::Bindings::WindowBinding::WindowBinding::WindowMethods; use dom::bindings::reflector::{DomObject, Reflector, reflect_dom_object}; -use dom::bindings::root::{Dom, Root}; +use dom::bindings::root::{Dom, DomRoot}; use dom::bindings::str::DOMString; use dom::cssstylesheet::CSSStyleSheet; use dom::window::Window; @@ -42,7 +42,7 @@ impl MediaList { #[allow(unrooted_must_root)] pub fn new(window: &Window, parent_stylesheet: &CSSStyleSheet, media_queries: Arc>) - -> Root { + -> DomRoot { reflect_dom_object(box MediaList::new_inherited(parent_stylesheet, media_queries), window, MediaListBinding::Wrap) diff --git a/components/script/dom/mediaquerylist.rs b/components/script/dom/mediaquerylist.rs index 4c23ee080bac..33eb2dc92d53 100644 --- a/components/script/dom/mediaquerylist.rs +++ b/components/script/dom/mediaquerylist.rs @@ -9,7 +9,7 @@ use dom::bindings::codegen::Bindings::MediaQueryListBinding::{self, MediaQueryLi use dom::bindings::inheritance::Castable; use dom::bindings::reflector::DomObject; use dom::bindings::reflector::reflect_dom_object; -use dom::bindings::root::{Dom, Root}; +use dom::bindings::root::{Dom, DomRoot}; use dom::bindings::str::DOMString; use dom::bindings::trace::JSTraceable; use dom::bindings::weakref::{WeakRef, WeakRefVec}; @@ -47,7 +47,7 @@ impl MediaQueryList { } } - pub fn new(document: &Document, media_query_list: MediaList) -> Root { + pub fn new(document: &Document, media_query_list: MediaList) -> DomRoot { reflect_dom_object(box MediaQueryList::new_inherited(document, media_query_list), document.window(), MediaQueryListBinding::Wrap) diff --git a/components/script/dom/mediaquerylistevent.rs b/components/script/dom/mediaquerylistevent.rs index e825b278730a..8eb1c8a3520b 100644 --- a/components/script/dom/mediaquerylistevent.rs +++ b/components/script/dom/mediaquerylistevent.rs @@ -9,7 +9,7 @@ use dom::bindings::codegen::Bindings::MediaQueryListEventBinding::MediaQueryList use dom::bindings::error::Fallible; use dom::bindings::inheritance::Castable; use dom::bindings::reflector::reflect_dom_object; -use dom::bindings::root::Root; +use dom::bindings::root::DomRoot; use dom::bindings::str::DOMString; use dom::event::Event; use dom::globalscope::GlobalScope; @@ -29,7 +29,7 @@ pub struct MediaQueryListEvent { impl MediaQueryListEvent { pub fn new_initialized(global: &GlobalScope, media: DOMString, - matches: bool) -> Root { + matches: bool) -> DomRoot { let ev = box MediaQueryListEvent { event: Event::new_inherited(), media: media, @@ -40,7 +40,7 @@ impl MediaQueryListEvent { pub fn new(global: &GlobalScope, type_: Atom, bubbles: bool, cancelable: bool, - media: DOMString, matches: bool) -> Root { + media: DOMString, matches: bool) -> DomRoot { let ev = MediaQueryListEvent::new_initialized(global, media, matches); { let event = ev.upcast::(); @@ -51,7 +51,7 @@ impl MediaQueryListEvent { pub fn Constructor(window: &Window, type_: DOMString, init: &MediaQueryListEventInit) - -> Fallible> { + -> Fallible> { let global = window.upcast::(); Ok(MediaQueryListEvent::new(global, Atom::from(type_), init.parent.bubbles, init.parent.cancelable, diff --git a/components/script/dom/messageevent.rs b/components/script/dom/messageevent.rs index 7987032f42d4..cab9e245f8a1 100644 --- a/components/script/dom/messageevent.rs +++ b/components/script/dom/messageevent.rs @@ -8,7 +8,7 @@ use dom::bindings::codegen::Bindings::MessageEventBinding::MessageEventMethods; use dom::bindings::error::Fallible; use dom::bindings::inheritance::Castable; use dom::bindings::reflector::reflect_dom_object; -use dom::bindings::root::Root; +use dom::bindings::root::DomRoot; use dom::bindings::str::DOMString; use dom::bindings::trace::RootedTraceableBox; use dom::event::Event; @@ -28,7 +28,7 @@ pub struct MessageEvent { } impl MessageEvent { - pub fn new_uninitialized(global: &GlobalScope) -> Root { + pub fn new_uninitialized(global: &GlobalScope) -> DomRoot { MessageEvent::new_initialized(global, HandleValue::undefined(), DOMString::new(), @@ -38,7 +38,7 @@ impl MessageEvent { pub fn new_initialized(global: &GlobalScope, data: HandleValue, origin: DOMString, - lastEventId: DOMString) -> Root { + lastEventId: DOMString) -> DomRoot { let ev = box MessageEvent { event: Event::new_inherited(), data: Heap::default(), @@ -54,7 +54,7 @@ impl MessageEvent { pub fn new(global: &GlobalScope, type_: Atom, bubbles: bool, cancelable: bool, data: HandleValue, origin: DOMString, lastEventId: DOMString) - -> Root { + -> DomRoot { let ev = MessageEvent::new_initialized(global, data, origin, lastEventId); { let event = ev.upcast::(); @@ -66,7 +66,7 @@ impl MessageEvent { pub fn Constructor(global: &GlobalScope, type_: DOMString, init: RootedTraceableBox) - -> Fallible> { + -> Fallible> { let ev = MessageEvent::new(global, Atom::from(type_), init.parent.bubbles, diff --git a/components/script/dom/mimetype.rs b/components/script/dom/mimetype.rs index b27255e85b2d..ecef40321e55 100644 --- a/components/script/dom/mimetype.rs +++ b/components/script/dom/mimetype.rs @@ -4,7 +4,7 @@ use dom::bindings::codegen::Bindings::MimeTypeBinding::MimeTypeMethods; use dom::bindings::reflector::Reflector; -use dom::bindings::root::Root; +use dom::bindings::root::DomRoot; use dom::bindings::str::DOMString; use dom::plugin::Plugin; use dom_struct::dom_struct; @@ -31,7 +31,7 @@ impl MimeTypeMethods for MimeType { } // https://html.spec.whatwg.org/multipage/#dom-mimetype-enabledplugin - fn EnabledPlugin(&self) -> Root { + fn EnabledPlugin(&self) -> DomRoot { unreachable!() } } diff --git a/components/script/dom/mimetypearray.rs b/components/script/dom/mimetypearray.rs index 6b87bb60b3f1..7a195e3fe7f6 100644 --- a/components/script/dom/mimetypearray.rs +++ b/components/script/dom/mimetypearray.rs @@ -5,7 +5,7 @@ use dom::bindings::codegen::Bindings::MimeTypeArrayBinding; use dom::bindings::codegen::Bindings::MimeTypeArrayBinding::MimeTypeArrayMethods; use dom::bindings::reflector::{Reflector, reflect_dom_object}; -use dom::bindings::root::Root; +use dom::bindings::root::DomRoot; use dom::bindings::str::DOMString; use dom::globalscope::GlobalScope; use dom::mimetype::MimeType; @@ -23,7 +23,7 @@ impl MimeTypeArray { } } - pub fn new(global: &GlobalScope) -> Root { + pub fn new(global: &GlobalScope) -> DomRoot { reflect_dom_object(box MimeTypeArray::new_inherited(), global, MimeTypeArrayBinding::Wrap) @@ -37,22 +37,22 @@ impl MimeTypeArrayMethods for MimeTypeArray { } // https://html.spec.whatwg.org/multipage/#dom-mimetypearray-item - fn Item(&self, _index: u32) -> Option> { + fn Item(&self, _index: u32) -> Option> { None } // https://html.spec.whatwg.org/multipage/#dom-mimetypearray-nameditem - fn NamedItem(&self, _name: DOMString) -> Option> { + fn NamedItem(&self, _name: DOMString) -> Option> { None } // https://html.spec.whatwg.org/multipage/#dom-mimetypearray-item - fn IndexedGetter(&self, _index: u32) -> Option> { + fn IndexedGetter(&self, _index: u32) -> Option> { None } // check-tidy: no specs after this line - fn NamedGetter(&self, _name: DOMString) -> Option> { + fn NamedGetter(&self, _name: DOMString) -> Option> { None } diff --git a/components/script/dom/mod.rs b/components/script/dom/mod.rs index deede3622d07..6866efd17d02 100644 --- a/components/script/dom/mod.rs +++ b/components/script/dom/mod.rs @@ -94,7 +94,7 @@ //! DOM objects of type `T` in Servo have two constructors: //! //! * a `T::new_inherited` static method that returns a plain `T`, and -//! * a `T::new` static method that returns `Root`. +//! * a `T::new` static method that returns `DomRoot`. //! //! (The result of either method can be wrapped in `Result`, if that is //! appropriate for the type in question.) diff --git a/components/script/dom/mouseevent.rs b/components/script/dom/mouseevent.rs index e3f4cdab91de..2fa79f433868 100644 --- a/components/script/dom/mouseevent.rs +++ b/components/script/dom/mouseevent.rs @@ -8,7 +8,7 @@ use dom::bindings::codegen::Bindings::UIEventBinding::UIEventMethods; use dom::bindings::error::Fallible; use dom::bindings::inheritance::Castable; use dom::bindings::reflector::reflect_dom_object; -use dom::bindings::root::{MutNullableDom, Root, RootedReference}; +use dom::bindings::root::{DomRoot, MutNullableDom, RootedReference}; use dom::bindings::str::DOMString; use dom::event::{Event, EventBubbles, EventCancelable}; use dom::eventtarget::EventTarget; @@ -51,7 +51,7 @@ impl MouseEvent { } } - pub fn new_uninitialized(window: &Window) -> Root { + pub fn new_uninitialized(window: &Window) -> DomRoot { reflect_dom_object(box MouseEvent::new_inherited(), window, MouseEventBinding::Wrap) @@ -72,7 +72,7 @@ impl MouseEvent { shift_key: bool, meta_key: bool, button: i16, - related_target: Option<&EventTarget>) -> Root { + related_target: Option<&EventTarget>) -> DomRoot { let ev = MouseEvent::new_uninitialized(window); ev.InitMouseEvent(type_, bool::from(can_bubble), bool::from(cancelable), view, detail, @@ -84,7 +84,7 @@ impl MouseEvent { pub fn Constructor(window: &Window, type_: DOMString, - init: &MouseEventBinding::MouseEventInit) -> Fallible> { + init: &MouseEventBinding::MouseEventInit) -> Fallible> { let bubbles = EventBubbles::from(init.parent.parent.parent.bubbles); let cancelable = EventCancelable::from(init.parent.parent.parent.cancelable); let event = MouseEvent::new(window, @@ -148,7 +148,7 @@ impl MouseEventMethods for MouseEvent { } // https://w3c.github.io/uievents/#widl-MouseEvent-relatedTarget - fn GetRelatedTarget(&self) -> Option> { + fn GetRelatedTarget(&self) -> Option> { self.related_target.get() } diff --git a/components/script/dom/mutationobserver.rs b/components/script/dom/mutationobserver.rs index 6a411b7833fa..72996a782899 100644 --- a/components/script/dom/mutationobserver.rs +++ b/components/script/dom/mutationobserver.rs @@ -10,7 +10,7 @@ use dom::bindings::codegen::Bindings::MutationObserverBinding::MutationObserverB use dom::bindings::codegen::Bindings::MutationObserverBinding::MutationObserverInit; use dom::bindings::error::{Error, Fallible}; use dom::bindings::reflector::{Reflector, reflect_dom_object}; -use dom::bindings::root::Root; +use dom::bindings::root::DomRoot; use dom::bindings::str::DOMString; use dom::mutationrecord::MutationRecord; use dom::node::Node; @@ -26,7 +26,7 @@ pub struct MutationObserver { reflector_: Reflector, #[ignore_heap_size_of = "can't measure Rc values"] callback: Rc, - record_queue: DomRefCell>>, + record_queue: DomRefCell>>, } pub enum Mutation<'a> { @@ -37,7 +37,7 @@ pub enum Mutation<'a> { #[derive(HeapSizeOf, JSTraceable)] pub struct RegisteredObserver { - observer: Root, + observer: DomRoot, options: ObserverOptions, } @@ -53,7 +53,7 @@ pub struct ObserverOptions { } impl MutationObserver { - fn new(global: &Window, callback: Rc) -> Root { + fn new(global: &Window, callback: Rc) -> DomRoot { let boxed_observer = box MutationObserver::new_inherited(callback); reflect_dom_object(boxed_observer, global, MutationObserverBinding::Wrap) } @@ -66,7 +66,7 @@ impl MutationObserver { } } - pub fn Constructor(global: &Window, callback: Rc) -> Fallible> { + pub fn Constructor(global: &Window, callback: Rc) -> Fallible> { let observer = MutationObserver::new(global, callback); ScriptThread::add_mutation_observer(&*observer); Ok(observer) @@ -93,7 +93,7 @@ impl MutationObserver { // TODO: steps 3-4 (slots) // Step 5 for mo in ¬ify_list { - let queue: Vec> = mo.record_queue.borrow().clone(); + let queue: Vec> = mo.record_queue.borrow().clone(); mo.record_queue.borrow_mut().clear(); // TODO: Step 5.3 Remove all transient registered observers whose observer is mo. if !queue.is_empty() { @@ -106,7 +106,7 @@ impl MutationObserver { /// https://dom.spec.whatwg.org/#queueing-a-mutation-record pub fn queue_a_mutation_record(target: &Node, attr_type: Mutation) { // Step 1 - let mut interestedObservers: Vec<(Root, Option)> = vec![]; + let mut interestedObservers: Vec<(DomRoot, Option)> = vec![]; // Step 2 & 3 for node in target.inclusive_ancestors() { for registered in &*node.registered_mutation_observers() { @@ -141,7 +141,7 @@ impl MutationObserver { if let Some(idx) = idx { interestedObservers[idx].1 = paired_string; } else { - interestedObservers.push((Root::from_ref(&*registered.observer), + interestedObservers.push((DomRoot::from_ref(&*registered.observer), paired_string)); } }, @@ -149,7 +149,7 @@ impl MutationObserver { if !registered.options.child_list { continue; } - interestedObservers.push((Root::from_ref(&*registered.observer), None)); + interestedObservers.push((DomRoot::from_ref(&*registered.observer), None)); } } } @@ -246,7 +246,7 @@ impl MutationObserverMethods for MutationObserver { // Step 8 if add_new_observer { target.registered_mutation_observers().push(RegisteredObserver { - observer: Root::from_ref(self), + observer: DomRoot::from_ref(self), options: ObserverOptions { attributes, attribute_old_value, diff --git a/components/script/dom/mutationrecord.rs b/components/script/dom/mutationrecord.rs index bbb42dd1f282..a3b381821477 100644 --- a/components/script/dom/mutationrecord.rs +++ b/components/script/dom/mutationrecord.rs @@ -5,7 +5,7 @@ use dom::bindings::codegen::Bindings::MutationRecordBinding::MutationRecordBinding; use dom::bindings::codegen::Bindings::MutationRecordBinding::MutationRecordBinding::MutationRecordMethods; use dom::bindings::reflector::{Reflector, reflect_dom_object}; -use dom::bindings::root::{Dom, MutNullableDom, Root}; +use dom::bindings::root::{Dom, DomRoot, MutNullableDom}; use dom::bindings::str::DOMString; use dom::node::{Node, window_from_node}; use dom::nodelist::NodeList; @@ -31,7 +31,7 @@ impl MutationRecord { pub fn attribute_mutated(target: &Node, attribute_name: &LocalName, attribute_namespace: Option<&Namespace>, - old_value: Option) -> Root { + old_value: Option) -> DomRoot { let record = box MutationRecord::new_inherited("attributes", target, Some(DOMString::from(&**attribute_name)), @@ -45,7 +45,7 @@ impl MutationRecord { added_nodes: Option<&[&Node]>, removed_nodes: Option<&[&Node]>, next_sibling: Option<&Node>, - prev_sibling: Option<&Node>) -> Root { + prev_sibling: Option<&Node>) -> DomRoot { let window = window_from_node(target); let added_nodes = added_nodes.map(|list| NodeList::new_simple_list_slice(&window, list)); let removed_nodes = removed_nodes.map(|list| NodeList::new_simple_list_slice(&window, list)); @@ -92,8 +92,8 @@ impl MutationRecordMethods for MutationRecord { } // https://dom.spec.whatwg.org/#dom-mutationrecord-target - fn Target(&self) -> Root { - Root::from_ref(&*self.target) + fn Target(&self) -> DomRoot { + DomRoot::from_ref(&*self.target) } // https://dom.spec.whatwg.org/#dom-mutationrecord-attributename @@ -112,7 +112,7 @@ impl MutationRecordMethods for MutationRecord { } // https://dom.spec.whatwg.org/#dom-mutationrecord-addednodes - fn AddedNodes(&self) -> Root { + fn AddedNodes(&self) -> DomRoot { self.added_nodes.or_init(|| { let window = window_from_node(&*self.target); NodeList::empty(&window) @@ -120,7 +120,7 @@ impl MutationRecordMethods for MutationRecord { } // https://dom.spec.whatwg.org/#dom-mutationrecord-removednodes - fn RemovedNodes(&self) -> Root { + fn RemovedNodes(&self) -> DomRoot { self.removed_nodes.or_init(|| { let window = window_from_node(&*self.target); NodeList::empty(&window) @@ -128,13 +128,13 @@ impl MutationRecordMethods for MutationRecord { } // https://dom.spec.whatwg.org/#dom-mutationrecord-previoussibling - fn GetPreviousSibling(&self) -> Option> { - self.prev_sibling.as_ref().map(|node| Root::from_ref(&**node)) + fn GetPreviousSibling(&self) -> Option> { + self.prev_sibling.as_ref().map(|node| DomRoot::from_ref(&**node)) } // https://dom.spec.whatwg.org/#dom-mutationrecord-previoussibling - fn GetNextSibling(&self) -> Option> { - self.next_sibling.as_ref().map(|node| Root::from_ref(&**node)) + fn GetNextSibling(&self) -> Option> { + self.next_sibling.as_ref().map(|node| DomRoot::from_ref(&**node)) } } diff --git a/components/script/dom/namednodemap.rs b/components/script/dom/namednodemap.rs index 9c2c0c163ad5..023665371cfd 100644 --- a/components/script/dom/namednodemap.rs +++ b/components/script/dom/namednodemap.rs @@ -8,7 +8,7 @@ use dom::bindings::codegen::Bindings::NamedNodeMapBinding; use dom::bindings::codegen::Bindings::NamedNodeMapBinding::NamedNodeMapMethods; use dom::bindings::error::{Error, Fallible}; use dom::bindings::reflector::{Reflector, reflect_dom_object}; -use dom::bindings::root::{Dom, Root}; +use dom::bindings::root::{Dom, DomRoot}; use dom::bindings::str::DOMString; use dom::bindings::xmlname::namespace_from_domstring; use dom::element::Element; @@ -31,7 +31,7 @@ impl NamedNodeMap { } } - pub fn new(window: &Window, elem: &Element) -> Root { + pub fn new(window: &Window, elem: &Element) -> DomRoot { reflect_dom_object(box NamedNodeMap::new_inherited(elem), window, NamedNodeMapBinding::Wrap) } @@ -44,53 +44,53 @@ impl NamedNodeMapMethods for NamedNodeMap { } // https://dom.spec.whatwg.org/#dom-namednodemap-item - fn Item(&self, index: u32) -> Option> { - self.owner.attrs().get(index as usize).map(|js| Root::from_ref(&**js)) + fn Item(&self, index: u32) -> Option> { + self.owner.attrs().get(index as usize).map(|js| DomRoot::from_ref(&**js)) } // https://dom.spec.whatwg.org/#dom-namednodemap-getnameditem - fn GetNamedItem(&self, name: DOMString) -> Option> { + fn GetNamedItem(&self, name: DOMString) -> Option> { self.owner.get_attribute_by_name(name) } // https://dom.spec.whatwg.org/#dom-namednodemap-getnameditemns fn GetNamedItemNS(&self, namespace: Option, local_name: DOMString) - -> Option> { + -> Option> { let ns = namespace_from_domstring(namespace); self.owner.get_attribute(&ns, &LocalName::from(local_name)) } // https://dom.spec.whatwg.org/#dom-namednodemap-setnameditem - fn SetNamedItem(&self, attr: &Attr) -> Fallible>> { + fn SetNamedItem(&self, attr: &Attr) -> Fallible>> { self.owner.SetAttributeNode(attr) } // https://dom.spec.whatwg.org/#dom-namednodemap-setnameditemns - fn SetNamedItemNS(&self, attr: &Attr) -> Fallible>> { + fn SetNamedItemNS(&self, attr: &Attr) -> Fallible>> { self.SetNamedItem(attr) } // https://dom.spec.whatwg.org/#dom-namednodemap-removenameditem - fn RemoveNamedItem(&self, name: DOMString) -> Fallible> { + fn RemoveNamedItem(&self, name: DOMString) -> Fallible> { let name = self.owner.parsed_name(name); self.owner.remove_attribute_by_name(&name).ok_or(Error::NotFound) } // https://dom.spec.whatwg.org/#dom-namednodemap-removenameditemns fn RemoveNamedItemNS(&self, namespace: Option, local_name: DOMString) - -> Fallible> { + -> Fallible> { let ns = namespace_from_domstring(namespace); self.owner.remove_attribute(&ns, &LocalName::from(local_name)) .ok_or(Error::NotFound) } // https://dom.spec.whatwg.org/#dom-namednodemap-item - fn IndexedGetter(&self, index: u32) -> Option> { + fn IndexedGetter(&self, index: u32) -> Option> { self.Item(index) } // check-tidy: no specs after this line - fn NamedGetter(&self, name: DOMString) -> Option> { + fn NamedGetter(&self, name: DOMString) -> Option> { self.GetNamedItem(name) } diff --git a/components/script/dom/navigator.rs b/components/script/dom/navigator.rs index c24b4972e372..5d3e41dc4212 100644 --- a/components/script/dom/navigator.rs +++ b/components/script/dom/navigator.rs @@ -6,7 +6,7 @@ use dom::bindings::codegen::Bindings::NavigatorBinding; use dom::bindings::codegen::Bindings::NavigatorBinding::NavigatorMethods; use dom::bindings::codegen::Bindings::VRBinding::VRBinding::VRMethods; use dom::bindings::reflector::{Reflector, DomObject, reflect_dom_object}; -use dom::bindings::root::{MutNullableDom, Root}; +use dom::bindings::root::{DomRoot, MutNullableDom}; use dom::bindings::str::DOMString; use dom::bluetooth::Bluetooth; use dom::gamepadlist::GamepadList; @@ -47,7 +47,7 @@ impl Navigator { } } - pub fn new(window: &Window) -> Root { + pub fn new(window: &Window) -> DomRoot { reflect_dom_object(box Navigator::new_inherited(), window, NavigatorBinding::Wrap) @@ -91,7 +91,7 @@ impl NavigatorMethods for Navigator { } // https://webbluetoothcg.github.io/web-bluetooth/#dom-navigator-bluetooth - fn Bluetooth(&self) -> Root { + fn Bluetooth(&self) -> DomRoot { self.bluetooth.or_init(|| Bluetooth::new(&self.global())) } @@ -101,12 +101,12 @@ impl NavigatorMethods for Navigator { } // https://html.spec.whatwg.org/multipage/#dom-navigator-plugins - fn Plugins(&self) -> Root { + fn Plugins(&self) -> DomRoot { self.plugins.or_init(|| PluginArray::new(&self.global())) } // https://html.spec.whatwg.org/multipage/#dom-navigator-mimetypes - fn MimeTypes(&self) -> Root { + fn MimeTypes(&self) -> DomRoot { self.mime_types.or_init(|| MimeTypeArray::new(&self.global())) } @@ -116,7 +116,7 @@ impl NavigatorMethods for Navigator { } // https://w3c.github.io/ServiceWorker/#navigator-service-worker-attribute - fn ServiceWorker(&self) -> Root { + fn ServiceWorker(&self) -> DomRoot { self.service_worker.or_init(|| { ServiceWorkerContainer::new(&self.global()) }) @@ -128,7 +128,7 @@ impl NavigatorMethods for Navigator { } // https://www.w3.org/TR/gamepad/#navigator-interface-extension - fn GetGamepads(&self) -> Root { + fn GetGamepads(&self) -> DomRoot { let root = self.gamepads.or_init(|| { GamepadList::new(&self.global(), &[]) }); @@ -139,7 +139,7 @@ impl NavigatorMethods for Navigator { root } // https://w3c.github.io/permissions/#navigator-and-workernavigator-extension - fn Permissions(&self) -> Root { + fn Permissions(&self) -> DomRoot { self.permissions.or_init(|| Permissions::new(&self.global())) } @@ -151,7 +151,7 @@ impl NavigatorMethods for Navigator { } impl Navigator { - pub fn Vr(&self) -> Root { + pub fn Vr(&self) -> DomRoot { self.vr.or_init(|| VR::new(&self.global())) } } diff --git a/components/script/dom/node.rs b/components/script/dom/node.rs index 28f1979a53e5..a620d09433d5 100644 --- a/components/script/dom/node.rs +++ b/components/script/dom/node.rs @@ -23,7 +23,7 @@ use dom::bindings::inheritance::{Castable, CharacterDataTypeId, ElementTypeId}; use dom::bindings::inheritance::{EventTargetTypeId, HTMLElementTypeId, NodeTypeId}; use dom::bindings::inheritance::{SVGElementTypeId, SVGGraphicsElementTypeId}; use dom::bindings::reflector::{DomObject, reflect_dom_object}; -use dom::bindings::root::{Dom, LayoutDom, MutNullableDom, Root, RootedReference}; +use dom::bindings::root::{Dom, DomRoot, LayoutDom, MutNullableDom, RootedReference}; use dom::bindings::str::{DOMString, USVString}; use dom::bindings::xmlname::namespace_from_domstring; use dom::characterdata::{CharacterData, LayoutCharacterDataHelpers}; @@ -327,10 +327,10 @@ impl Node { UntrustedNodeAddress(self.reflector().get_jsobject().get() as *const c_void) } - pub fn as_custom_element(&self) -> Option> { + pub fn as_custom_element(&self) -> Option> { self.downcast::() .and_then(|element| if element.get_custom_element_definition().is_some() { - Some(Root::from_ref(element)) + Some(DomRoot::from_ref(element)) } else { None }) @@ -353,9 +353,9 @@ impl<'a> QuerySelectorIterator { } impl<'a> Iterator for QuerySelectorIterator { - type Item = Root; + type Item = DomRoot; - fn next(&mut self) -> Option> { + fn next(&mut self) -> Option> { let selectors = &self.selectors; self.iterator.by_ref().filter_map(|node| { @@ -365,9 +365,9 @@ impl<'a> Iterator for QuerySelectorIterator { // FIXME(bholley): Consider an nth-index cache here. let mut ctx = MatchingContext::new(MatchingMode::Normal, None, None, node.owner_doc().quirks_mode()); - if let Some(element) = Root::downcast(node) { + if let Some(element) = DomRoot::downcast(node) { if matches_selector_list(selectors, &element, &mut ctx) { - return Some(Root::upcast(element)); + return Some(DomRoot::upcast(element)); } } None @@ -497,7 +497,7 @@ impl Node { // its descendants version, and the document's version. Normally, this will just be // the document's version, but we do have to deal with the case where the node has moved // document, so may have a higher version count than its owning document. - let doc: Root = Root::upcast(self.owner_doc()); + let doc: DomRoot = DomRoot::upcast(self.owner_doc()); let version = cmp::max(self.inclusive_descendants_version(), doc.inclusive_descendants_version()) + 1; for ancestor in self.inclusive_ancestors() { ancestor.inclusive_descendants_version.set(version); @@ -530,16 +530,16 @@ impl Node { TreeIterator::new(self) } - pub fn inclusively_following_siblings(&self) -> impl Iterator> { + pub fn inclusively_following_siblings(&self) -> impl Iterator> { SimpleNodeIterator { - current: Some(Root::from_ref(self)), + current: Some(DomRoot::from_ref(self)), next_node: |n| n.GetNextSibling(), } } - pub fn inclusively_preceding_siblings(&self) -> impl Iterator> { + pub fn inclusively_preceding_siblings(&self) -> impl Iterator> { SimpleNodeIterator { - current: Some(Root::from_ref(self)), + current: Some(DomRoot::from_ref(self)), next_node: |n| n.GetPreviousSibling(), } } @@ -552,14 +552,14 @@ impl Node { parent.ancestors().any(|ancestor| &*ancestor == self) } - pub fn following_siblings(&self) -> impl Iterator> { + pub fn following_siblings(&self) -> impl Iterator> { SimpleNodeIterator { current: self.GetNextSibling(), next_node: |n| n.GetNextSibling(), } } - pub fn preceding_siblings(&self) -> impl Iterator> { + pub fn preceding_siblings(&self) -> impl Iterator> { SimpleNodeIterator { current: self.GetPreviousSibling(), next_node: |n| n.GetPreviousSibling(), @@ -568,19 +568,19 @@ impl Node { pub fn following_nodes(&self, root: &Node) -> FollowingNodeIterator { FollowingNodeIterator { - current: Some(Root::from_ref(self)), - root: Root::from_ref(root), + current: Some(DomRoot::from_ref(self)), + root: DomRoot::from_ref(root), } } pub fn preceding_nodes(&self, root: &Node) -> PrecedingNodeIterator { PrecedingNodeIterator { - current: Some(Root::from_ref(self)), - root: Root::from_ref(root), + current: Some(DomRoot::from_ref(self)), + root: DomRoot::from_ref(root), } } - pub fn descending_last_children(&self) -> impl Iterator> { + pub fn descending_last_children(&self) -> impl Iterator> { SimpleNodeIterator { current: self.GetLastChild(), next_node: |n| n.GetLastChild(), @@ -747,7 +747,7 @@ impl Node { } // https://dom.spec.whatwg.org/#dom-parentnode-queryselector - pub fn query_selector(&self, selectors: DOMString) -> Fallible>> { + pub fn query_selector(&self, selectors: DOMString) -> Fallible>> { // Step 1. match SelectorParser::parse_author_origin_no_namespace(&selectors) { // Step 2. @@ -757,7 +757,7 @@ impl Node { // FIXME(bholley): Consider an nth-index cache here. let mut ctx = MatchingContext::new(MatchingMode::Normal, None, None, self.owner_doc().quirks_mode()); - Ok(self.traverse_preorder().filter_map(Root::downcast).find(|element| { + Ok(self.traverse_preorder().filter_map(DomRoot::downcast).find(|element| { matches_selector_list(&selectors, element, &mut ctx) })) } @@ -786,27 +786,27 @@ impl Node { // https://dom.spec.whatwg.org/#dom-parentnode-queryselectorall #[allow(unsafe_code)] - pub fn query_selector_all(&self, selectors: DOMString) -> Fallible> { + pub fn query_selector_all(&self, selectors: DOMString) -> Fallible> { let window = window_from_node(self); let iter = self.query_selector_iter(selectors)?; Ok(NodeList::new_simple_list(&window, iter)) } - pub fn ancestors(&self) -> impl Iterator> { + pub fn ancestors(&self) -> impl Iterator> { SimpleNodeIterator { current: self.GetParentNode(), next_node: |n| n.GetParentNode(), } } - pub fn inclusive_ancestors(&self) -> impl Iterator> { + pub fn inclusive_ancestors(&self) -> impl Iterator> { SimpleNodeIterator { - current: Some(Root::from_ref(self)), + current: Some(DomRoot::from_ref(self)), next_node: |n| n.GetParentNode(), } } - pub fn owner_doc(&self) -> Root { + pub fn owner_doc(&self) -> DomRoot { self.owner_doc.get().unwrap() } @@ -822,22 +822,22 @@ impl Node { self.is_in_doc() && self.owner_doc().browsing_context().is_some() } - pub fn children(&self) -> impl Iterator> { + pub fn children(&self) -> impl Iterator> { SimpleNodeIterator { current: self.GetFirstChild(), next_node: |n| n.GetNextSibling(), } } - pub fn rev_children(&self) -> impl Iterator> { + pub fn rev_children(&self) -> impl Iterator> { SimpleNodeIterator { current: self.GetLastChild(), next_node: |n| n.GetPreviousSibling(), } } - pub fn child_elements(&self) -> impl Iterator> { - self.children().filter_map(Root::downcast as fn(_) -> _).peekable() + pub fn child_elements(&self) -> impl Iterator> { + self.children().filter_map(DomRoot::downcast as fn(_) -> _).peekable() } pub fn remove_self(&self) { @@ -878,9 +878,9 @@ impl Node { } /// Used by `HTMLTableSectionElement::InsertRow` and `HTMLTableRowElement::InsertCell` - pub fn insert_cell_or_row(&self, index: i32, get_items: F, new_child: G) -> Fallible> - where F: Fn() -> Root, - G: Fn() -> Root, + pub fn insert_cell_or_row(&self, index: i32, get_items: F, new_child: G) -> Fallible> + where F: Fn() -> DomRoot, + G: Fn() -> DomRoot, I: DerivedFrom + DerivedFrom + DomObject, { if index < -1 { @@ -897,7 +897,7 @@ impl Node { } else { let items = get_items(); let node = match items.elements_iter() - .map(Root::upcast::) + .map(DomRoot::upcast::) .map(Some) .chain(iter::once(None)) .nth(index as usize) { @@ -908,12 +908,12 @@ impl Node { } } - Ok(Root::upcast::(tr)) + Ok(DomRoot::upcast::(tr)) } /// Used by `HTMLTableSectionElement::DeleteRow` and `HTMLTableRowElement::DeleteCell` pub fn delete_cell_or_row(&self, index: i32, get_items: F, is_delete_type: G) -> ErrorResult - where F: Fn() -> Root, + where F: Fn() -> DomRoot, G: Fn(&Element) -> bool { let element = match index { @@ -921,7 +921,7 @@ impl Node { -1 => { let last_child = self.upcast::().GetLastChild(); match last_child.and_then(|node| node.inclusively_preceding_siblings() - .filter_map(Root::downcast::) + .filter_map(DomRoot::downcast::) .filter(|elem| is_delete_type(elem)) .next()) { Some(element) => element, @@ -950,7 +950,7 @@ impl Node { } } - pub fn get_cssom_stylesheet(&self) -> Option> { + pub fn get_cssom_stylesheet(&self) -> Option> { if let Some(node) = self.downcast::() { node.get_cssom_stylesheet() } else if let Some(node) = self.downcast::() { @@ -965,8 +965,8 @@ impl Node { /// Iterate through `nodes` until we find a `Node` that is not in `not_in` -fn first_node_not_in(mut nodes: I, not_in: &[NodeOrString]) -> Option> - where I: Iterator> +fn first_node_not_in(mut nodes: I, not_in: &[NodeOrString]) -> Option> + where I: Iterator> { nodes.find(|node| { not_in.iter().all(|n| { @@ -982,7 +982,7 @@ fn first_node_not_in(mut nodes: I, not_in: &[NodeOrString]) -> Option Root { + -> DomRoot { // https://github.com/servo/servo/issues/6383 let candidate: uintptr_t = mem::transmute(candidate.0); // let object: *mut JSObject = jsfriendapi::bindgen::JS_GetAddressableObject(runtime, @@ -992,7 +992,7 @@ pub unsafe fn from_untrusted_node_address(_runtime: *mut JSRuntime, candidate: U panic!("Attempted to create a `Dom` from an invalid pointer!") } let boxed_node = conversions::private_from_object(object) as *const Node; - Root::from_ref(&*boxed_node) + DomRoot::from_ref(&*boxed_node) } #[allow(unsafe_code)] @@ -1199,13 +1199,13 @@ impl LayoutNodeHelpers for LayoutDom { // pub struct FollowingNodeIterator { - current: Option>, - root: Root, + current: Option>, + root: DomRoot, } impl FollowingNodeIterator { /// Skips iterating the children of the current node - pub fn next_skipping_children(&mut self) -> Option> { + pub fn next_skipping_children(&mut self) -> Option> { let current = match self.current.take() { None => return None, Some(current) => current, @@ -1214,7 +1214,7 @@ impl FollowingNodeIterator { self.next_skipping_children_impl(current) } - fn next_skipping_children_impl(&mut self, current: Root) -> Option> { + fn next_skipping_children_impl(&mut self, current: DomRoot) -> Option> { if self.root == current { self.current = None; return None; @@ -1240,10 +1240,10 @@ impl FollowingNodeIterator { } impl Iterator for FollowingNodeIterator { - type Item = Root; + type Item = DomRoot; // https://dom.spec.whatwg.org/#concept-tree-following - fn next(&mut self) -> Option> { + fn next(&mut self) -> Option> { let current = match self.current.take() { None => return None, Some(current) => current, @@ -1259,15 +1259,15 @@ impl Iterator for FollowingNodeIterator { } pub struct PrecedingNodeIterator { - current: Option>, - root: Root, + current: Option>, + root: DomRoot, } impl Iterator for PrecedingNodeIterator { - type Item = Root; + type Item = DomRoot; // https://dom.spec.whatwg.org/#concept-tree-preceding - fn next(&mut self) -> Option> { + fn next(&mut self) -> Option> { let current = match self.current.take() { None => return None, Some(current) => current, @@ -1291,16 +1291,16 @@ impl Iterator for PrecedingNodeIterator { } struct SimpleNodeIterator - where I: Fn(&Node) -> Option> + where I: Fn(&Node) -> Option> { - current: Option>, + current: Option>, next_node: I, } impl Iterator for SimpleNodeIterator - where I: Fn(&Node) -> Option> + where I: Fn(&Node) -> Option> { - type Item = Root; + type Item = DomRoot; fn next(&mut self) -> Option { let current = self.current.take(); @@ -1310,19 +1310,19 @@ impl Iterator for SimpleNodeIterator } pub struct TreeIterator { - current: Option>, + current: Option>, depth: usize, } impl TreeIterator { fn new(root: &Node) -> TreeIterator { TreeIterator { - current: Some(Root::from_ref(root)), + current: Some(DomRoot::from_ref(root)), depth: 0, } } - pub fn next_skipping_children(&mut self) -> Option> { + pub fn next_skipping_children(&mut self) -> Option> { let current = match self.current.take() { None => return None, Some(current) => current, @@ -1331,7 +1331,7 @@ impl TreeIterator { self.next_skipping_children_impl(current) } - fn next_skipping_children_impl(&mut self, current: Root) -> Option> { + fn next_skipping_children_impl(&mut self, current: DomRoot) -> Option> { for ancestor in current.inclusive_ancestors() { if self.depth == 0 { break; @@ -1349,10 +1349,10 @@ impl TreeIterator { } impl Iterator for TreeIterator { - type Item = Root; + type Item = DomRoot; // https://dom.spec.whatwg.org/#concept-tree-order - fn next(&mut self) -> Option> { + fn next(&mut self) -> Option> { let current = match self.current.take() { None => return None, Some(current) => current, @@ -1380,8 +1380,8 @@ impl Node { pub fn reflect_node( node: Box, document: &Document, - wrap_fn: unsafe extern "Rust" fn(*mut JSContext, &GlobalScope, Box) -> Root) - -> Root + wrap_fn: unsafe extern "Rust" fn(*mut JSContext, &GlobalScope, Box) -> DomRoot) + -> DomRoot where N: DerivedFrom + DomObject { let window = document.window(); @@ -1437,7 +1437,7 @@ impl Node { for descendant in node.traverse_preorder().filter_map(|d| d.as_custom_element()) { // Step 3.2. ScriptThread::enqueue_callback_reaction(&*descendant, - CallbackReaction::Adopted(old_doc.clone(), Root::from_ref(document)), None); + CallbackReaction::Adopted(old_doc.clone(), DomRoot::from_ref(document)), None); } for descendant in node.traverse_preorder() { // Step 3.3. @@ -1562,7 +1562,7 @@ impl Node { // https://dom.spec.whatwg.org/#concept-node-pre-insert pub fn pre_insert(node: &Node, parent: &Node, child: Option<&Node>) - -> Fallible> { + -> Fallible> { // Step 1. Node::ensure_pre_insertion_validity(node, parent, child)?; @@ -1584,7 +1584,7 @@ impl Node { Node::insert(node, parent, reference_child, SuppressObserver::Unsuppressed); // Step 6. - Ok(Root::from_ref(node)) + Ok(DomRoot::from_ref(node)) } // https://dom.spec.whatwg.org/#concept-node-insert @@ -1648,7 +1648,7 @@ impl Node { // Step 7.1. parent.add_child(*kid, child); // Step 7.7. - for descendant in kid.traverse_preorder().filter_map(Root::downcast::) { + for descendant in kid.traverse_preorder().filter_map(DomRoot::downcast::) { // Step 7.7.2. if descendant.is_connected() { if descendant.get_custom_element_definition().is_some() { @@ -1719,7 +1719,7 @@ impl Node { } // https://dom.spec.whatwg.org/#concept-node-pre-remove - fn pre_remove(child: &Node, parent: &Node) -> Fallible> { + fn pre_remove(child: &Node, parent: &Node) -> Fallible> { // Step 1. match child.GetParentNode() { Some(ref node) if &**node != parent => return Err(Error::NotFound), @@ -1731,7 +1731,7 @@ impl Node { Node::remove(child, parent, SuppressObserver::Unsuppressed); // Step 3. - Ok(Root::from_ref(child)) + Ok(DomRoot::from_ref(child)) } // https://dom.spec.whatwg.org/#concept-node-remove @@ -1780,27 +1780,27 @@ impl Node { // https://dom.spec.whatwg.org/#concept-node-clone pub fn clone(node: &Node, maybe_doc: Option<&Document>, - clone_children: CloneChildrenFlag) -> Root { + clone_children: CloneChildrenFlag) -> DomRoot { // Step 1. let document = match maybe_doc { - Some(doc) => Root::from_ref(doc), + Some(doc) => DomRoot::from_ref(doc), None => node.owner_doc() }; // Step 2. // XXXabinader: clone() for each node as trait? - let copy: Root = match node.type_id() { + let copy: DomRoot = match node.type_id() { NodeTypeId::DocumentType => { let doctype = node.downcast::().unwrap(); let doctype = DocumentType::new(doctype.name().clone(), Some(doctype.public_id().clone()), Some(doctype.system_id().clone()), &document); - Root::upcast::(doctype) + DomRoot::upcast::(doctype) }, NodeTypeId::DocumentFragment => { let doc_fragment = DocumentFragment::new(&document); - Root::upcast::(doc_fragment) + DomRoot::upcast::(doc_fragment) }, NodeTypeId::CharacterData(_) => { let cdata = node.downcast::().unwrap(); @@ -1823,7 +1823,7 @@ impl Node { None, DocumentActivity::Inactive, DocumentSource::NotFromParser, loader, None, None); - Root::upcast::(document) + DomRoot::upcast::(document) }, NodeTypeId::Element(..) => { let element = node.downcast::().unwrap(); @@ -1837,14 +1837,14 @@ impl Node { &document, ElementCreator::ScriptCreated, CustomElementCreationMode::Asynchronous); - Root::upcast::(element) + DomRoot::upcast::(element) }, }; // Step 3. let document = match copy.downcast::() { - Some(doc) => Root::from_ref(doc), - None => Root::from_ref(&*document), + Some(doc) => DomRoot::from_ref(doc), + None => DomRoot::from_ref(&*document), }; assert!(copy.owner_doc() == document); @@ -1892,7 +1892,7 @@ impl Node { Node::collect_text_contents(self.children()) } - pub fn collect_text_contents>>(iterator: T) -> DOMString { + pub fn collect_text_contents>>(iterator: T) -> DOMString { let mut content = String::new(); for node in iterator { if let Some(ref text) = node.downcast::() { @@ -1976,7 +1976,7 @@ impl NodeMethods for Node { } // https://dom.spec.whatwg.org/#dom-node-ownerdocument - fn GetOwnerDocument(&self) -> Option> { + fn GetOwnerDocument(&self) -> Option> { match self.type_id() { NodeTypeId::CharacterData(..) | NodeTypeId::Element(..) | @@ -1987,18 +1987,18 @@ impl NodeMethods for Node { } // https://dom.spec.whatwg.org/#dom-node-getrootnode - fn GetRootNode(&self) -> Root { + fn GetRootNode(&self) -> DomRoot { self.inclusive_ancestors().last().unwrap() } // https://dom.spec.whatwg.org/#dom-node-parentnode - fn GetParentNode(&self) -> Option> { + fn GetParentNode(&self) -> Option> { self.parent_node.get() } // https://dom.spec.whatwg.org/#dom-node-parentelement - fn GetParentElement(&self) -> Option> { - self.GetParentNode().and_then(Root::downcast) + fn GetParentElement(&self) -> Option> { + self.GetParentNode().and_then(DomRoot::downcast) } // https://dom.spec.whatwg.org/#dom-node-haschildnodes @@ -2007,7 +2007,7 @@ impl NodeMethods for Node { } // https://dom.spec.whatwg.org/#dom-node-childnodes - fn ChildNodes(&self) -> Root { + fn ChildNodes(&self) -> DomRoot { self.child_list.or_init(|| { let doc = self.owner_doc(); let window = doc.window(); @@ -2016,22 +2016,22 @@ impl NodeMethods for Node { } // https://dom.spec.whatwg.org/#dom-node-firstchild - fn GetFirstChild(&self) -> Option> { + fn GetFirstChild(&self) -> Option> { self.first_child.get() } // https://dom.spec.whatwg.org/#dom-node-lastchild - fn GetLastChild(&self) -> Option> { + fn GetLastChild(&self) -> Option> { self.last_child.get() } // https://dom.spec.whatwg.org/#dom-node-previoussibling - fn GetPreviousSibling(&self) -> Option> { + fn GetPreviousSibling(&self) -> Option> { self.prev_sibling.get() } // https://dom.spec.whatwg.org/#dom-node-nextsibling - fn GetNextSibling(&self) -> Option> { + fn GetNextSibling(&self) -> Option> { self.next_sibling.get() } @@ -2076,7 +2076,7 @@ impl NodeMethods for Node { let node = if value.is_empty() { None } else { - Some(Root::upcast(self.owner_doc().CreateTextNode(value))) + Some(DomRoot::upcast(self.owner_doc().CreateTextNode(value))) }; // Step 3. @@ -2092,17 +2092,17 @@ impl NodeMethods for Node { } // https://dom.spec.whatwg.org/#dom-node-insertbefore - fn InsertBefore(&self, node: &Node, child: Option<&Node>) -> Fallible> { + fn InsertBefore(&self, node: &Node, child: Option<&Node>) -> Fallible> { Node::pre_insert(node, self, child) } // https://dom.spec.whatwg.org/#dom-node-appendchild - fn AppendChild(&self, node: &Node) -> Fallible> { + fn AppendChild(&self, node: &Node) -> Fallible> { Node::pre_insert(node, self, None) } // https://dom.spec.whatwg.org/#concept-node-replace - fn ReplaceChild(&self, node: &Node, child: &Node) -> Fallible> { + fn ReplaceChild(&self, node: &Node, child: &Node) -> Fallible> { // Step 1. match self.type_id() { NodeTypeId::Document(_) | @@ -2240,12 +2240,12 @@ impl NodeMethods for Node { MutationObserver::queue_a_mutation_record(&self, mutation); // Step 15. - Ok(Root::from_ref(child)) + Ok(DomRoot::from_ref(child)) } // https://dom.spec.whatwg.org/#dom-node-removechild fn RemoveChild(&self, node: &Node) - -> Fallible> { + -> Fallible> { Node::pre_remove(node, self) } @@ -2276,7 +2276,7 @@ impl NodeMethods for Node { } // https://dom.spec.whatwg.org/#dom-node-clonenode - fn CloneNode(&self, deep: bool) -> Root { + fn CloneNode(&self, deep: bool) -> DomRoot { Node::clone(self, None, if deep { CloneChildrenFlag::CloneChildren } else { @@ -2499,13 +2499,13 @@ impl NodeMethods for Node { } } -pub fn document_from_node + DomObject>(derived: &T) -> Root { +pub fn document_from_node + DomObject>(derived: &T) -> DomRoot { derived.upcast().owner_doc() } -pub fn window_from_node + DomObject>(derived: &T) -> Root { +pub fn window_from_node + DomObject>(derived: &T) -> DomRoot { let document = document_from_node(derived); - Root::from_ref(document.window()) + DomRoot::from_ref(document.window()) } impl VirtualMethods for Node { @@ -2626,7 +2626,7 @@ impl<'a> ChildrenMutation<'a> { /// NOTE: This does not check whether the inserted/removed nodes were elements, so in some /// cases it will return a false positive. This doesn't matter for correctness, because at /// worst the returned element will be restyled unnecessarily. - pub fn modified_edge_element(&self) -> Option> { + pub fn modified_edge_element(&self) -> Option> { match *self { // Add/remove at start of container: Return the first following element. ChildrenMutation::Prepend { next, .. } | @@ -2807,7 +2807,7 @@ impl VecPreOrderInsertionHelper for Vec> let elem_node = elem.upcast::(); let mut head: usize = 0; for node in tree_root.traverse_preorder() { - let head_node = Root::upcast::(Root::from_ref(&*self[head])); + let head_node = DomRoot::upcast::(DomRoot::from_ref(&*self[head])); if head_node == node { head += 1; } diff --git a/components/script/dom/nodeiterator.rs b/components/script/dom/nodeiterator.rs index ec18066a9789..3ee09742e67c 100644 --- a/components/script/dom/nodeiterator.rs +++ b/components/script/dom/nodeiterator.rs @@ -10,7 +10,7 @@ use dom::bindings::codegen::Bindings::NodeIteratorBinding; use dom::bindings::codegen::Bindings::NodeIteratorBinding::NodeIteratorMethods; use dom::bindings::error::Fallible; use dom::bindings::reflector::{Reflector, reflect_dom_object}; -use dom::bindings::root::{Dom, MutDom, Root}; +use dom::bindings::root::{Dom, DomRoot, MutDom}; use dom::document::Document; use dom::node::Node; use dom_struct::dom_struct; @@ -46,7 +46,7 @@ impl NodeIterator { pub fn new_with_filter(document: &Document, root_node: &Node, what_to_show: u32, - filter: Filter) -> Root { + filter: Filter) -> DomRoot { reflect_dom_object(box NodeIterator::new_inherited(root_node, what_to_show, filter), document.window(), NodeIteratorBinding::Wrap) @@ -55,7 +55,7 @@ impl NodeIterator { pub fn new(document: &Document, root_node: &Node, what_to_show: u32, - node_filter: Option>) -> Root { + node_filter: Option>) -> DomRoot { let filter = match node_filter { None => Filter::None, Some(jsfilter) => Filter::Callback(jsfilter) @@ -66,8 +66,8 @@ impl NodeIterator { impl NodeIteratorMethods for NodeIterator { // https://dom.spec.whatwg.org/#dom-nodeiterator-root - fn Root(&self) -> Root { - Root::from_ref(&*self.root_node) + fn Root(&self) -> DomRoot { + DomRoot::from_ref(&*self.root_node) } // https://dom.spec.whatwg.org/#dom-nodeiterator-whattoshow @@ -84,7 +84,7 @@ impl NodeIteratorMethods for NodeIterator { } // https://dom.spec.whatwg.org/#dom-nodeiterator-referencenode - fn ReferenceNode(&self) -> Root { + fn ReferenceNode(&self) -> DomRoot { self.reference_node.get() } @@ -94,7 +94,7 @@ impl NodeIteratorMethods for NodeIterator { } // https://dom.spec.whatwg.org/#dom-nodeiterator-nextnode - fn NextNode(&self) -> Fallible>> { + fn NextNode(&self) -> Fallible>> { // https://dom.spec.whatwg.org/#concept-NodeIterator-traverse // Step 1. let node = self.reference_node.get(); @@ -138,7 +138,7 @@ impl NodeIteratorMethods for NodeIterator { } // https://dom.spec.whatwg.org/#dom-nodeiterator-previousnode - fn PreviousNode(&self) -> Fallible>> { + fn PreviousNode(&self) -> Fallible>> { // https://dom.spec.whatwg.org/#concept-NodeIterator-traverse // Step 1. let node = self.reference_node.get(); diff --git a/components/script/dom/nodelist.rs b/components/script/dom/nodelist.rs index 191cc1f30cda..d6c0a394c935 100644 --- a/components/script/dom/nodelist.rs +++ b/components/script/dom/nodelist.rs @@ -6,7 +6,7 @@ use dom::bindings::codegen::Bindings::NodeBinding::NodeMethods; use dom::bindings::codegen::Bindings::NodeListBinding; use dom::bindings::codegen::Bindings::NodeListBinding::NodeListMethods; use dom::bindings::reflector::{Reflector, reflect_dom_object}; -use dom::bindings::root::{Dom, MutNullableDom, Root, RootedReference}; +use dom::bindings::root::{Dom, DomRoot, MutNullableDom, RootedReference}; use dom::node::{ChildrenMutation, Node}; use dom::window::Window; use dom_struct::dom_struct; @@ -36,26 +36,26 @@ impl NodeList { } #[allow(unrooted_must_root)] - pub fn new(window: &Window, list_type: NodeListType) -> Root { + pub fn new(window: &Window, list_type: NodeListType) -> DomRoot { reflect_dom_object(box NodeList::new_inherited(list_type), window, NodeListBinding::Wrap) } - pub fn new_simple_list(window: &Window, iter: T) -> Root - where T: Iterator> { + pub fn new_simple_list(window: &Window, iter: T) -> DomRoot + where T: Iterator> { NodeList::new(window, NodeListType::Simple(iter.map(|r| Dom::from_ref(&*r)).collect())) } - pub fn new_simple_list_slice(window: &Window, slice: &[&Node]) -> Root { + pub fn new_simple_list_slice(window: &Window, slice: &[&Node]) -> DomRoot { NodeList::new(window, NodeListType::Simple(slice.iter().map(|r| Dom::from_ref(*r)).collect())) } - pub fn new_child_list(window: &Window, node: &Node) -> Root { + pub fn new_child_list(window: &Window, node: &Node) -> DomRoot { NodeList::new(window, NodeListType::Children(ChildrenList::new(node))) } - pub fn empty(window: &Window) -> Root { + pub fn empty(window: &Window) -> DomRoot { NodeList::new(window, NodeListType::Simple(vec![])) } } @@ -70,17 +70,17 @@ impl NodeListMethods for NodeList { } // https://dom.spec.whatwg.org/#dom-nodelist-item - fn Item(&self, index: u32) -> Option> { + fn Item(&self, index: u32) -> Option> { match self.list_type { NodeListType::Simple(ref elems) => { - elems.get(index as usize).map(|node| Root::from_ref(&**node)) + elems.get(index as usize).map(|node| DomRoot::from_ref(&**node)) }, NodeListType::Children(ref list) => list.item(index), } } // https://dom.spec.whatwg.org/#dom-nodelist-item - fn IndexedGetter(&self, index: u32) -> Option> { + fn IndexedGetter(&self, index: u32) -> Option> { self.Item(index) } } @@ -103,7 +103,7 @@ impl NodeList { } } - pub fn iter<'a>(&'a self) -> impl Iterator> + 'a { + pub fn iter<'a>(&'a self) -> impl Iterator> + 'a { let len = self.Length(); (0..len).flat_map(move |i| self.Item(i)) } @@ -132,7 +132,7 @@ impl ChildrenList { self.node.children_count() } - pub fn item(&self, index: u32) -> Option> { + pub fn item(&self, index: u32) -> Option> { // This always start traversing the children from the closest element // among parent's first and last children and the last visited one. let len = self.len() as u32; diff --git a/components/script/dom/pagetransitionevent.rs b/components/script/dom/pagetransitionevent.rs index 4ee04dde09d5..936c262eb52a 100644 --- a/components/script/dom/pagetransitionevent.rs +++ b/components/script/dom/pagetransitionevent.rs @@ -8,7 +8,7 @@ use dom::bindings::codegen::Bindings::PageTransitionEventBinding::PageTransition use dom::bindings::error::Fallible; use dom::bindings::inheritance::Castable; use dom::bindings::reflector::reflect_dom_object; -use dom::bindings::root::Root; +use dom::bindings::root::DomRoot; use dom::bindings::str::DOMString; use dom::event::Event; use dom::window::Window; @@ -31,7 +31,7 @@ impl PageTransitionEvent { } } - pub fn new_uninitialized(window: &Window) -> Root { + pub fn new_uninitialized(window: &Window) -> DomRoot { reflect_dom_object(box PageTransitionEvent::new_inherited(), window, PageTransitionEventBinding::Wrap) @@ -42,7 +42,7 @@ impl PageTransitionEvent { bubbles: bool, cancelable: bool, persisted: bool) - -> Root { + -> DomRoot { let ev = PageTransitionEvent::new_uninitialized(window); ev.persisted.set(persisted); { @@ -55,7 +55,7 @@ impl PageTransitionEvent { pub fn Constructor(window: &Window, type_: DOMString, init: &PageTransitionEventBinding::PageTransitionEventInit) - -> Fallible> { + -> Fallible> { Ok(PageTransitionEvent::new(window, Atom::from(type_), init.parent.bubbles, diff --git a/components/script/dom/paintrenderingcontext2d.rs b/components/script/dom/paintrenderingcontext2d.rs index 261e9b953224..b5c47b2c08fe 100644 --- a/components/script/dom/paintrenderingcontext2d.rs +++ b/components/script/dom/paintrenderingcontext2d.rs @@ -18,7 +18,7 @@ use dom::bindings::error::Fallible; use dom::bindings::inheritance::Castable; use dom::bindings::num::Finite; use dom::bindings::reflector::reflect_dom_object; -use dom::bindings::root::Root; +use dom::bindings::root::DomRoot; use dom::bindings::str::DOMString; use dom::canvasgradient::CanvasGradient; use dom::canvaspattern::CanvasPattern; @@ -52,7 +52,7 @@ impl PaintRenderingContext2D { } } - pub fn new(global: &PaintWorkletGlobalScope) -> Root { + pub fn new(global: &PaintWorkletGlobalScope) -> DomRoot { reflect_dom_object(box PaintRenderingContext2D::new_inherited(global), global, PaintRenderingContext2DBinding::Wrap) @@ -304,7 +304,7 @@ impl PaintRenderingContext2DMethods for PaintRenderingContext2D { y0: Finite, x1: Finite, y1: Finite) - -> Root { + -> DomRoot { self.context.CreateLinearGradient(x0, y0, x1, y1) } @@ -316,7 +316,7 @@ impl PaintRenderingContext2DMethods for PaintRenderingContext2D { x1: Finite, y1: Finite, r1: Finite) - -> Fallible> { + -> Fallible> { self.context.CreateRadialGradient(x0, y0, r0, x1, y1, r1) } @@ -324,7 +324,7 @@ impl PaintRenderingContext2DMethods for PaintRenderingContext2D { fn CreatePattern(&self, image: HTMLImageElementOrHTMLCanvasElementOrCanvasRenderingContext2DOrCSSStyleValue, repetition: DOMString) - -> Fallible> { + -> Fallible> { self.context.CreatePattern(image, repetition) } diff --git a/components/script/dom/paintsize.rs b/components/script/dom/paintsize.rs index 5943b97d6f09..72ebc9884683 100644 --- a/components/script/dom/paintsize.rs +++ b/components/script/dom/paintsize.rs @@ -7,7 +7,7 @@ use dom::bindings::codegen::Bindings::PaintSizeBinding::PaintSizeMethods; use dom::bindings::num::Finite; use dom::bindings::reflector::Reflector; use dom::bindings::reflector::reflect_dom_object; -use dom::bindings::root::Root; +use dom::bindings::root::DomRoot; use dom::paintworkletglobalscope::PaintWorkletGlobalScope; use dom_struct::dom_struct; use euclid::TypedSize2D; @@ -29,7 +29,7 @@ impl PaintSize { } } - pub fn new(global: &PaintWorkletGlobalScope, size: TypedSize2D) -> Root { + pub fn new(global: &PaintWorkletGlobalScope, size: TypedSize2D) -> DomRoot { reflect_dom_object(box PaintSize::new_inherited(size), global, PaintSizeBinding::Wrap) } } diff --git a/components/script/dom/paintworkletglobalscope.rs b/components/script/dom/paintworkletglobalscope.rs index 24bd7e7d9404..322b6e5a5d86 100644 --- a/components/script/dom/paintworkletglobalscope.rs +++ b/components/script/dom/paintworkletglobalscope.rs @@ -13,7 +13,7 @@ use dom::bindings::error::Error; use dom::bindings::error::Fallible; use dom::bindings::inheritance::Castable; use dom::bindings::reflector::DomObject; -use dom::bindings::root::{Dom, Root}; +use dom::bindings::root::{Dom, DomRoot}; use dom::bindings::str::DOMString; use dom::cssstylevalue::CSSStyleValue; use dom::paintrenderingcontext2d::PaintRenderingContext2D; @@ -95,7 +95,7 @@ impl PaintWorkletGlobalScope { base_url: ServoUrl, executor: WorkletExecutor, init: &WorkletGlobalScopeInit) - -> Root { + -> DomRoot { debug!("Creating paint worklet global scope for pipeline {}.", pipeline_id); let global = box PaintWorkletGlobalScope { worklet_global: WorkletGlobalScope::new_inherited(pipeline_id, base_url, executor, init), @@ -222,7 +222,7 @@ impl PaintWorkletGlobalScope { } class_constructor.set(definition.class_constructor.get()); paint_function.set(definition.paint_function.get()); - Root::from_ref(&*definition.context) + DomRoot::from_ref(&*definition.context) } }; diff --git a/components/script/dom/performance.rs b/components/script/dom/performance.rs index 5df6f1bc9a8c..0aabbb6fc35b 100644 --- a/components/script/dom/performance.rs +++ b/components/script/dom/performance.rs @@ -10,7 +10,7 @@ use dom::bindings::error::{Error, Fallible}; use dom::bindings::inheritance::Castable; use dom::bindings::num::Finite; use dom::bindings::reflector::{DomObject, Reflector, reflect_dom_object}; -use dom::bindings::root::{Dom, Root}; +use dom::bindings::root::{Dom, DomRoot}; use dom::bindings::str::DOMString; use dom::globalscope::GlobalScope; use dom::performanceentry::PerformanceEntry; @@ -63,11 +63,11 @@ impl PerformanceEntryList { } pub fn get_entries_by_name_and_type(&self, name: Option, entry_type: Option) - -> Vec> { + -> Vec> { let mut res = self.entries.iter().filter(|e| name.as_ref().map_or(true, |name_| *e.name() == *name_) && entry_type.as_ref().map_or(true, |type_| *e.entry_type() == *type_) - ).map(|e| e.clone()).collect::>>(); + ).map(|e| e.clone()).collect::>>(); res.sort_by(|a, b| a.start_time().partial_cmp(&b.start_time()).unwrap_or(Ordering::Equal)); res } @@ -93,8 +93,8 @@ impl PerformanceEntryList { } impl IntoIterator for PerformanceEntryList { - type Item = Root; - type IntoIter = ::std::vec::IntoIter>; + type Item = DomRoot; + type IntoIter = ::std::vec::IntoIter>; fn into_iter(self) -> Self::IntoIter { self.entries.into_iter() @@ -103,7 +103,7 @@ impl IntoIterator for PerformanceEntryList { #[derive(HeapSizeOf, JSTraceable)] struct PerformanceObserver { - observer: Root, + observer: DomRoot, entry_types: Vec, } @@ -139,7 +139,7 @@ impl Performance { pub fn new(global: &GlobalScope, navigation_start: u64, - navigation_start_precise: f64) -> Root { + navigation_start_precise: f64) -> DomRoot { reflect_dom_object(box Performance::new_inherited(global, navigation_start, navigation_start_precise), @@ -169,7 +169,7 @@ impl Performance { Some(p) => observers[p].entry_types = entry_types, // Otherwise, we create and insert the new PerformanceObserver. None => observers.push(PerformanceObserver { - observer: Root::from_ref(observer), + observer: DomRoot::from_ref(observer), entry_types }) }; @@ -214,7 +214,7 @@ impl Performance { // If the "add to performance entry buffer flag" is set, add the // new entry to the buffer. if add_to_performance_entries_buffer { - self.entries.borrow_mut().entries.push(Root::from_ref(entry)); + self.entries.borrow_mut().entries.push(DomRoot::from_ref(entry)); } // Step 5. @@ -242,7 +242,7 @@ impl Performance { // We have to operate over a copy of the performance observers to avoid // the risk of an observer's callback modifying the list of registered // observers. - let observers: Vec> = + let observers: Vec> = self.observers.borrow().iter() .map(|o| DOMPerformanceObserver::new(&self.global(), o.observer.callback(), @@ -266,9 +266,9 @@ impl Performance { impl PerformanceMethods for Performance { // https://dvcs.w3.org/hg/webperf/raw-file/tip/specs/NavigationTiming/Overview.html#performance-timing-attribute - fn Timing(&self) -> Root { + fn Timing(&self) -> DomRoot { match self.timing { - Some(ref timing) => Root::from_ref(&*timing), + Some(ref timing) => DomRoot::from_ref(&*timing), None => unreachable!("Are we trying to expose Performance.timing in workers?"), } } @@ -279,18 +279,18 @@ impl PerformanceMethods for Performance { } // https://www.w3.org/TR/performance-timeline-2/#dom-performance-getentries - fn GetEntries(&self) -> Vec> { + fn GetEntries(&self) -> Vec> { self.entries.borrow().get_entries_by_name_and_type(None, None) } // https://www.w3.org/TR/performance-timeline-2/#dom-performance-getentriesbytype - fn GetEntriesByType(&self, entry_type: DOMString) -> Vec> { + fn GetEntriesByType(&self, entry_type: DOMString) -> Vec> { self.entries.borrow().get_entries_by_name_and_type(None, Some(entry_type)) } // https://www.w3.org/TR/performance-timeline-2/#dom-performance-getentriesbyname fn GetEntriesByName(&self, name: DOMString, entry_type: Option) - -> Vec> { + -> Vec> { self.entries.borrow().get_entries_by_name_and_type(Some(name), entry_type) } diff --git a/components/script/dom/performanceentry.rs b/components/script/dom/performanceentry.rs index 12d3934cceaf..01b8eb6ee956 100644 --- a/components/script/dom/performanceentry.rs +++ b/components/script/dom/performanceentry.rs @@ -6,7 +6,7 @@ use dom::bindings::codegen::Bindings::PerformanceEntryBinding; use dom::bindings::codegen::Bindings::PerformanceEntryBinding::PerformanceEntryMethods; use dom::bindings::num::Finite; use dom::bindings::reflector::{Reflector, reflect_dom_object}; -use dom::bindings::root::Root; +use dom::bindings::root::DomRoot; use dom::bindings::str::DOMString; use dom::globalscope::GlobalScope; use dom_struct::dom_struct; @@ -39,7 +39,7 @@ impl PerformanceEntry { name: DOMString, entry_type: DOMString, start_time: f64, - duration: f64) -> Root { + duration: f64) -> DomRoot { let entry = PerformanceEntry::new_inherited(name, entry_type, start_time, duration); reflect_dom_object(box entry, global, PerformanceEntryBinding::Wrap) } diff --git a/components/script/dom/performanceobserver.rs b/components/script/dom/performanceobserver.rs index 86b45f67a405..4393eff6d0f6 100644 --- a/components/script/dom/performanceobserver.rs +++ b/components/script/dom/performanceobserver.rs @@ -11,7 +11,7 @@ use dom::bindings::codegen::Bindings::PerformanceObserverBinding::PerformanceObs use dom::bindings::codegen::Bindings::PerformanceObserverBinding::PerformanceObserverMethods; use dom::bindings::error::{Error, Fallible}; use dom::bindings::reflector::{DomObject, Reflector, reflect_dom_object}; -use dom::bindings::root::Root; +use dom::bindings::root::DomRoot; use dom::bindings::str::DOMString; use dom::globalscope::GlobalScope; use dom::performance::PerformanceEntryList; @@ -52,19 +52,19 @@ impl PerformanceObserver { pub fn new(global: &GlobalScope, callback: Rc, entries: DOMPerformanceEntryList) - -> Root { + -> DomRoot { let observer = PerformanceObserver::new_inherited(callback, DomRefCell::new(entries)); reflect_dom_object(box observer, global, PerformanceObserverBinding::Wrap) } pub fn Constructor(global: &GlobalScope, callback: Rc) - -> Fallible> { + -> Fallible> { Ok(PerformanceObserver::new(global, callback, Vec::new())) } /// Buffer a new performance entry. pub fn queue_entry(&self, entry: &PerformanceEntry) { - self.entries.borrow_mut().push(Root::from_ref(entry)); + self.entries.borrow_mut().push(DomRoot::from_ref(entry)); } /// Trigger performance observer callback with the list of performance entries diff --git a/components/script/dom/performanceobserverentrylist.rs b/components/script/dom/performanceobserverentrylist.rs index 558ad749e5d9..70f329952d85 100644 --- a/components/script/dom/performanceobserverentrylist.rs +++ b/components/script/dom/performanceobserverentrylist.rs @@ -6,7 +6,7 @@ use dom::bindings::cell::DomRefCell; use dom::bindings::codegen::Bindings::PerformanceObserverEntryListBinding; use dom::bindings::codegen::Bindings::PerformanceObserverEntryListBinding::PerformanceObserverEntryListMethods; use dom::bindings::reflector::{Reflector, reflect_dom_object}; -use dom::bindings::root::Root; +use dom::bindings::root::DomRoot; use dom::bindings::str::DOMString; use dom::globalscope::GlobalScope; use dom::performance::PerformanceEntryList; @@ -29,7 +29,7 @@ impl PerformanceObserverEntryList { #[allow(unrooted_must_root)] pub fn new(global: &GlobalScope, entries: PerformanceEntryList) - -> Root { + -> DomRoot { let observer_entry_list = PerformanceObserverEntryList::new_inherited(entries); reflect_dom_object(box observer_entry_list, global, PerformanceObserverEntryListBinding::Wrap) } @@ -37,18 +37,18 @@ impl PerformanceObserverEntryList { impl PerformanceObserverEntryListMethods for PerformanceObserverEntryList { // https://w3c.github.io/performance-timeline/#dom-performanceobserver - fn GetEntries(&self) -> Vec> { + fn GetEntries(&self) -> Vec> { self.entries.borrow().get_entries_by_name_and_type(None, None) } // https://w3c.github.io/performance-timeline/#dom-performanceobserver - fn GetEntriesByType(&self, entry_type: DOMString) -> Vec> { + fn GetEntriesByType(&self, entry_type: DOMString) -> Vec> { self.entries.borrow().get_entries_by_name_and_type(None, Some(entry_type)) } // https://w3c.github.io/performance-timeline/#dom-performanceobserver fn GetEntriesByName(&self, name: DOMString, entry_type: Option) - -> Vec> { + -> Vec> { self.entries.borrow().get_entries_by_name_and_type(Some(name), entry_type) } } diff --git a/components/script/dom/performancepainttiming.rs b/components/script/dom/performancepainttiming.rs index 505444c33db9..b798d93a1408 100644 --- a/components/script/dom/performancepainttiming.rs +++ b/components/script/dom/performancepainttiming.rs @@ -4,7 +4,7 @@ use dom::bindings::codegen::Bindings::PerformancePaintTimingBinding; use dom::bindings::reflector::reflect_dom_object; -use dom::bindings::root::Root; +use dom::bindings::root::DomRoot; use dom::bindings::str::DOMString; use dom::globalscope::GlobalScope; use dom::performanceentry::PerformanceEntry; @@ -34,7 +34,7 @@ impl PerformancePaintTiming { #[allow(unrooted_must_root)] pub fn new(global: &GlobalScope, metric_type: PaintMetricType, - start_time: f64) -> Root { + start_time: f64) -> DomRoot { let entry = PerformancePaintTiming::new_inherited(metric_type, start_time); reflect_dom_object(box entry, global, PerformancePaintTimingBinding::Wrap) } diff --git a/components/script/dom/performancetiming.rs b/components/script/dom/performancetiming.rs index c4dff76e2181..d0833d76f64e 100644 --- a/components/script/dom/performancetiming.rs +++ b/components/script/dom/performancetiming.rs @@ -6,7 +6,7 @@ use dom::bindings::codegen::Bindings::PerformanceTimingBinding; use dom::bindings::codegen::Bindings::PerformanceTimingBinding::PerformanceTimingMethods; use dom::bindings::codegen::Bindings::WindowBinding::WindowMethods; use dom::bindings::reflector::{Reflector, reflect_dom_object}; -use dom::bindings::root::{Dom, Root}; +use dom::bindings::root::{Dom, DomRoot}; use dom::document::Document; use dom::window::Window; use dom_struct::dom_struct; @@ -36,7 +36,7 @@ impl PerformanceTiming { pub fn new(window: &Window, navigation_start: u64, navigation_start_precise: f64) - -> Root { + -> DomRoot { let timing = PerformanceTiming::new_inherited(navigation_start, navigation_start_precise, &window.Document()); diff --git a/components/script/dom/permissions.rs b/components/script/dom/permissions.rs index 1ff8fc301b7a..74fc675008ed 100644 --- a/components/script/dom/permissions.rs +++ b/components/script/dom/permissions.rs @@ -7,7 +7,7 @@ use dom::bindings::codegen::Bindings::PermissionStatusBinding::PermissionStatusM use dom::bindings::codegen::Bindings::PermissionsBinding::{self, PermissionsMethods}; use dom::bindings::error::Error; use dom::bindings::reflector::{DomObject, Reflector, reflect_dom_object}; -use dom::bindings::root::Root; +use dom::bindings::root::DomRoot; use dom::bluetooth::Bluetooth; use dom::bluetoothpermissionresult::BluetoothPermissionResult; use dom::globalscope::GlobalScope; @@ -63,7 +63,7 @@ impl Permissions { } } - pub fn new(global: &GlobalScope) -> Root { + pub fn new(global: &GlobalScope) -> DomRoot { reflect_dom_object(box Permissions::new_inherited(), global, PermissionsBinding::Wrap) @@ -265,7 +265,7 @@ pub fn get_descriptor_permission_state(permission_name: PermissionName, -> PermissionState { // Step 1. let settings = match env_settings_obj { - Some(env_settings_obj) => Root::from_ref(env_settings_obj), + Some(env_settings_obj) => DomRoot::from_ref(env_settings_obj), None => GlobalScope::current().expect("No current global object"), }; diff --git a/components/script/dom/permissionstatus.rs b/components/script/dom/permissionstatus.rs index 505f4ad346ba..13efaf65a0a6 100644 --- a/components/script/dom/permissionstatus.rs +++ b/components/script/dom/permissionstatus.rs @@ -6,7 +6,7 @@ use dom::bindings::codegen::Bindings::PermissionStatusBinding::{self, Permission use dom::bindings::codegen::Bindings::PermissionStatusBinding::PermissionState; use dom::bindings::codegen::Bindings::PermissionStatusBinding::PermissionStatusMethods; use dom::bindings::reflector::reflect_dom_object; -use dom::bindings::root::Root; +use dom::bindings::root::DomRoot; use dom::eventtarget::EventTarget; use dom::globalscope::GlobalScope; use dom_struct::dom_struct; @@ -30,7 +30,7 @@ impl PermissionStatus { } } - pub fn new(global: &GlobalScope, query: &PermissionDescriptor) -> Root { + pub fn new(global: &GlobalScope, query: &PermissionDescriptor) -> DomRoot { reflect_dom_object(box PermissionStatus::new_inherited(query.name), global, PermissionStatusBinding::Wrap) diff --git a/components/script/dom/plugin.rs b/components/script/dom/plugin.rs index d16aba43e909..ebdd54782802 100644 --- a/components/script/dom/plugin.rs +++ b/components/script/dom/plugin.rs @@ -4,7 +4,7 @@ use dom::bindings::codegen::Bindings::PluginBinding::PluginMethods; use dom::bindings::reflector::Reflector; -use dom::bindings::root::Root; +use dom::bindings::root::DomRoot; use dom::bindings::str::DOMString; use dom::mimetype::MimeType; use dom_struct::dom_struct; @@ -36,22 +36,22 @@ impl PluginMethods for Plugin { } // https://html.spec.whatwg.org/multipage/#dom-plugin-item - fn Item(&self, _index: u32) -> Option> { + fn Item(&self, _index: u32) -> Option> { unreachable!() } // https://html.spec.whatwg.org/multipage/#dom-plugin-nameditem - fn NamedItem(&self, _name: DOMString) -> Option> { + fn NamedItem(&self, _name: DOMString) -> Option> { unreachable!() } // https://html.spec.whatwg.org/multipage/#dom-plugin-item - fn IndexedGetter(&self, _index: u32) -> Option> { + fn IndexedGetter(&self, _index: u32) -> Option> { unreachable!() } // check-tidy: no specs after this line - fn NamedGetter(&self, _name: DOMString) -> Option> { + fn NamedGetter(&self, _name: DOMString) -> Option> { unreachable!() } diff --git a/components/script/dom/pluginarray.rs b/components/script/dom/pluginarray.rs index 2ddd0449b6cf..c77b763eb85e 100644 --- a/components/script/dom/pluginarray.rs +++ b/components/script/dom/pluginarray.rs @@ -5,7 +5,7 @@ use dom::bindings::codegen::Bindings::PluginArrayBinding; use dom::bindings::codegen::Bindings::PluginArrayBinding::PluginArrayMethods; use dom::bindings::reflector::{Reflector, reflect_dom_object}; -use dom::bindings::root::Root; +use dom::bindings::root::DomRoot; use dom::bindings::str::DOMString; use dom::globalscope::GlobalScope; use dom::plugin::Plugin; @@ -23,7 +23,7 @@ impl PluginArray { } } - pub fn new(global: &GlobalScope) -> Root { + pub fn new(global: &GlobalScope) -> DomRoot { reflect_dom_object(box PluginArray::new_inherited(), global, PluginArrayBinding::Wrap) @@ -41,22 +41,22 @@ impl PluginArrayMethods for PluginArray { } // https://html.spec.whatwg.org/multipage/#dom-pluginarray-item - fn Item(&self, _index: u32) -> Option> { + fn Item(&self, _index: u32) -> Option> { None } // https://html.spec.whatwg.org/multipage/#dom-pluginarray-nameditem - fn NamedItem(&self, _name: DOMString) -> Option> { + fn NamedItem(&self, _name: DOMString) -> Option> { None } // https://html.spec.whatwg.org/multipage/#dom-pluginarray-item - fn IndexedGetter(&self, _index: u32) -> Option> { + fn IndexedGetter(&self, _index: u32) -> Option> { None } // check-tidy: no specs after this line - fn NamedGetter(&self, _name: DOMString) -> Option> { + fn NamedGetter(&self, _name: DOMString) -> Option> { None } diff --git a/components/script/dom/popstateevent.rs b/components/script/dom/popstateevent.rs index e07c1faa71f9..0a962dfe5be5 100644 --- a/components/script/dom/popstateevent.rs +++ b/components/script/dom/popstateevent.rs @@ -8,7 +8,7 @@ use dom::bindings::codegen::Bindings::PopStateEventBinding::PopStateEventMethods use dom::bindings::error::Fallible; use dom::bindings::inheritance::Castable; use dom::bindings::reflector::reflect_dom_object; -use dom::bindings::root::Root; +use dom::bindings::root::DomRoot; use dom::bindings::str::DOMString; use dom::bindings::trace::RootedTraceableBox; use dom::event::Event; @@ -34,7 +34,7 @@ impl PopStateEvent { } } - pub fn new_uninitialized(window: &Window) -> Root { + pub fn new_uninitialized(window: &Window) -> DomRoot { reflect_dom_object(box PopStateEvent::new_inherited(), window, PopStateEventBinding::Wrap) @@ -45,7 +45,7 @@ impl PopStateEvent { bubbles: bool, cancelable: bool, state: HandleValue) - -> Root { + -> DomRoot { let ev = PopStateEvent::new_uninitialized(window); ev.state.set(state.get()); { @@ -58,7 +58,7 @@ impl PopStateEvent { pub fn Constructor(window: &Window, type_: DOMString, init: RootedTraceableBox) - -> Fallible> { + -> Fallible> { Ok(PopStateEvent::new(window, Atom::from(type_), init.parent.bubbles, diff --git a/components/script/dom/processinginstruction.rs b/components/script/dom/processinginstruction.rs index c70e191976e2..1cdb5eb1c4ca 100644 --- a/components/script/dom/processinginstruction.rs +++ b/components/script/dom/processinginstruction.rs @@ -4,7 +4,7 @@ use dom::bindings::codegen::Bindings::ProcessingInstructionBinding; use dom::bindings::codegen::Bindings::ProcessingInstructionBinding::ProcessingInstructionMethods; -use dom::bindings::root::Root; +use dom::bindings::root::DomRoot; use dom::bindings::str::DOMString; use dom::characterdata::CharacterData; use dom::document::Document; @@ -26,7 +26,7 @@ impl ProcessingInstruction { } } - pub fn new(target: DOMString, data: DOMString, document: &Document) -> Root { + pub fn new(target: DOMString, data: DOMString, document: &Document) -> DomRoot { Node::reflect_node(box ProcessingInstruction::new_inherited(target, data, document), document, ProcessingInstructionBinding::Wrap) } diff --git a/components/script/dom/progressevent.rs b/components/script/dom/progressevent.rs index 72898430f6ba..1ad4acacc47b 100644 --- a/components/script/dom/progressevent.rs +++ b/components/script/dom/progressevent.rs @@ -8,7 +8,7 @@ use dom::bindings::codegen::Bindings::ProgressEventBinding::ProgressEventMethods use dom::bindings::error::Fallible; use dom::bindings::inheritance::Castable; use dom::bindings::reflector::reflect_dom_object; -use dom::bindings::root::Root; +use dom::bindings::root::DomRoot; use dom::bindings::str::DOMString; use dom::event::{Event, EventBubbles, EventCancelable}; use dom::globalscope::GlobalScope; @@ -32,14 +32,14 @@ impl ProgressEvent { total: total } } - pub fn new_uninitialized(global: &GlobalScope) -> Root { + pub fn new_uninitialized(global: &GlobalScope) -> DomRoot { reflect_dom_object(box ProgressEvent::new_inherited(false, 0, 0), global, ProgressEventBinding::Wrap) } pub fn new(global: &GlobalScope, type_: Atom, can_bubble: EventBubbles, cancelable: EventCancelable, - length_computable: bool, loaded: u64, total: u64) -> Root { + length_computable: bool, loaded: u64, total: u64) -> DomRoot { let ev = reflect_dom_object(box ProgressEvent::new_inherited(length_computable, loaded, total), global, ProgressEventBinding::Wrap); @@ -52,7 +52,7 @@ impl ProgressEvent { pub fn Constructor(global: &GlobalScope, type_: DOMString, init: &ProgressEventBinding::ProgressEventInit) - -> Fallible> { + -> Fallible> { let bubbles = EventBubbles::from(init.parent.bubbles); let cancelable = EventCancelable::from(init.parent.cancelable); let ev = ProgressEvent::new(global, Atom::from(type_), bubbles, cancelable, diff --git a/components/script/dom/promisenativehandler.rs b/components/script/dom/promisenativehandler.rs index 756b9b840228..56c65c9a8011 100644 --- a/components/script/dom/promisenativehandler.rs +++ b/components/script/dom/promisenativehandler.rs @@ -4,7 +4,7 @@ use dom::bindings::codegen::Bindings::PromiseNativeHandlerBinding; use dom::bindings::reflector::{Reflector, reflect_dom_object}; -use dom::bindings::root::Root; +use dom::bindings::root::DomRoot; use dom::bindings::trace::JSTraceable; use dom::globalscope::GlobalScope; use dom_struct::dom_struct; @@ -26,7 +26,7 @@ impl PromiseNativeHandler { pub fn new(global: &GlobalScope, resolve: Option>, reject: Option>) - -> Root { + -> DomRoot { reflect_dom_object(box PromiseNativeHandler { reflector: Reflector::new(), resolve: resolve, diff --git a/components/script/dom/radionodelist.rs b/components/script/dom/radionodelist.rs index cd892108ee30..d9c3a010c34b 100644 --- a/components/script/dom/radionodelist.rs +++ b/components/script/dom/radionodelist.rs @@ -8,7 +8,7 @@ use dom::bindings::codegen::Bindings::RadioNodeListBinding; use dom::bindings::codegen::Bindings::RadioNodeListBinding::RadioNodeListMethods; use dom::bindings::inheritance::Castable; use dom::bindings::reflector::reflect_dom_object; -use dom::bindings::root::{Dom, Root}; +use dom::bindings::root::{Dom, DomRoot}; use dom::bindings::str::DOMString; use dom::htmlinputelement::HTMLInputElement; use dom::node::Node; @@ -30,14 +30,14 @@ impl RadioNodeList { } #[allow(unrooted_must_root)] - pub fn new(window: &Window, list_type: NodeListType) -> Root { + pub fn new(window: &Window, list_type: NodeListType) -> DomRoot { reflect_dom_object(box RadioNodeList::new_inherited(list_type), window, RadioNodeListBinding::Wrap) } - pub fn new_simple_list(window: &Window, iter: T) -> Root - where T: Iterator> { + pub fn new_simple_list(window: &Window, iter: T) -> DomRoot + where T: Iterator> { RadioNodeList::new(window, NodeListType::Simple(iter.map(|r| Dom::from_ref(&*r)).collect())) } @@ -101,7 +101,7 @@ impl RadioNodeListMethods for RadioNodeList { // https://github.com/servo/servo/issues/5875 // // https://dom.spec.whatwg.org/#dom-nodelist-item - fn IndexedGetter(&self, index: u32) -> Option> { + fn IndexedGetter(&self, index: u32) -> Option> { self.node_list.IndexedGetter(index) } } diff --git a/components/script/dom/range.rs b/components/script/dom/range.rs index 79091beff557..b6a05b31881c 100644 --- a/components/script/dom/range.rs +++ b/components/script/dom/range.rs @@ -14,7 +14,7 @@ use dom::bindings::error::{Error, ErrorResult, Fallible}; use dom::bindings::inheritance::{CharacterDataTypeId, NodeTypeId}; use dom::bindings::inheritance::Castable; use dom::bindings::reflector::{Reflector, reflect_dom_object}; -use dom::bindings::root::{Dom, MutDom, Root, RootedReference}; +use dom::bindings::root::{Dom, DomRoot, MutDom, RootedReference}; use dom::bindings::str::DOMString; use dom::bindings::trace::JSTraceable; use dom::bindings::weakref::{WeakRef, WeakRefVec}; @@ -49,7 +49,7 @@ impl Range { } } - pub fn new_with_doc(document: &Document) -> Root { + pub fn new_with_doc(document: &Document) -> DomRoot { let root = document.upcast(); Range::new(document, root, 0, root, 0) } @@ -57,7 +57,7 @@ impl Range { pub fn new(document: &Document, start_container: &Node, start_offset: u32, end_container: &Node, end_offset: u32) - -> Root { + -> DomRoot { let range = reflect_dom_object(box Range::new_inherited(start_container, start_offset, end_container, end_offset), document.window(), @@ -70,7 +70,7 @@ impl Range { } // https://dom.spec.whatwg.org/#dom-range - pub fn Constructor(window: &Window) -> Fallible> { + pub fn Constructor(window: &Window) -> Fallible> { let document = window.Document(); Ok(Range::new_with_doc(&document)) } @@ -91,9 +91,9 @@ impl Range { } // https://dom.spec.whatwg.org/#concept-range-clone - fn contained_children(&self) -> Fallible<(Option>, - Option>, - Vec>)> { + fn contained_children(&self) -> Fallible<(Option>, + Option>, + Vec>)> { let start_node = self.StartContainer(); let end_node = self.EndContainer(); // Steps 5-6. @@ -120,7 +120,7 @@ impl Range { }; // Step 11. - let contained_children: Vec> = + let contained_children: Vec> = common_ancestor.children().filter(|n| self.contains(n)).collect(); // Step 12. @@ -191,7 +191,7 @@ impl Range { impl RangeMethods for Range { // https://dom.spec.whatwg.org/#dom-range-startcontainer - fn StartContainer(&self) -> Root { + fn StartContainer(&self) -> DomRoot { self.start.node.get() } @@ -201,7 +201,7 @@ impl RangeMethods for Range { } // https://dom.spec.whatwg.org/#dom-range-endcontainer - fn EndContainer(&self) -> Root { + fn EndContainer(&self) -> DomRoot { self.end.node.get() } @@ -216,7 +216,7 @@ impl RangeMethods for Range { } // https://dom.spec.whatwg.org/#dom-range-commonancestorcontainer - fn CommonAncestorContainer(&self) -> Root { + fn CommonAncestorContainer(&self) -> DomRoot { let end_container = self.EndContainer(); // Step 1. for container in self.StartContainer().inclusive_ancestors() { @@ -366,7 +366,7 @@ impl RangeMethods for Range { } // https://dom.spec.whatwg.org/#dom-range-clonerange - fn CloneRange(&self) -> Root { + fn CloneRange(&self) -> DomRoot { let start_node = self.StartContainer(); let owner_doc = start_node.owner_doc(); Range::new(&owner_doc, &start_node, self.StartOffset(), @@ -425,7 +425,7 @@ impl RangeMethods for Range { // https://dom.spec.whatwg.org/#dom-range-clonecontents // https://dom.spec.whatwg.org/#concept-range-clone - fn CloneContents(&self) -> Fallible> { + fn CloneContents(&self) -> Fallible> { // Step 3. let start_node = self.StartContainer(); let start_offset = self.StartOffset(); @@ -524,7 +524,7 @@ impl RangeMethods for Range { // https://dom.spec.whatwg.org/#dom-range-extractcontents // https://dom.spec.whatwg.org/#concept-range-extract - fn ExtractContents(&self) -> Fallible> { + fn ExtractContents(&self) -> Fallible> { // Step 3. let start_node = self.StartContainer(); let start_offset = self.StartOffset(); @@ -563,13 +563,13 @@ impl RangeMethods for Range { let (new_node, new_offset) = if start_node.is_inclusive_ancestor_of(&end_node) { // Step 13. - (Root::from_ref(&*start_node), start_offset) + (DomRoot::from_ref(&*start_node), start_offset) } else { // Step 14.1-2. let reference_node = start_node.ancestors() .take_while(|n| !n.is_inclusive_ancestor_of(&end_node)) .last() - .unwrap_or(Root::from_ref(&start_node)); + .unwrap_or(DomRoot::from_ref(&start_node)); // Step 14.3. (reference_node.GetParentNode().unwrap(), reference_node.index() + 1) }; @@ -682,11 +682,11 @@ impl RangeMethods for Range { None => return Err(Error::HierarchyRequest) }; // Step 5. - (Some(Root::from_ref(&*start_node)), parent) + (Some(DomRoot::from_ref(&*start_node)), parent) } else { // Steps 4-5. let child = start_node.ChildNodes().Item(start_offset); - (child, Root::from_ref(&*start_node)) + (child, DomRoot::from_ref(&*start_node)) }; // Step 6. @@ -700,7 +700,7 @@ impl RangeMethods for Range { match start_node.downcast::() { Some(text) => { split_text = text.SplitText(start_offset)?; - let new_reference = Root::upcast::(split_text); + let new_reference = DomRoot::upcast::(split_text); assert!(new_reference.GetParentNode().r() == Some(&parent)); Some(new_reference) }, @@ -779,11 +779,11 @@ impl RangeMethods for Range { let (new_node, new_offset) = if start_node.is_inclusive_ancestor_of(&end_node) { // Step 5. - (Root::from_ref(&*start_node), start_offset) + (DomRoot::from_ref(&*start_node), start_offset) } else { // Step 6. - fn compute_reference(start_node: &Node, end_node: &Node) -> (Root, u32) { - let mut reference_node = Root::from_ref(start_node); + fn compute_reference(start_node: &Node, end_node: &Node) -> (DomRoot, u32) { + let mut reference_node = DomRoot::from_ref(start_node); while let Some(parent) = reference_node.GetParentNode() { if parent.is_inclusive_ancestor_of(end_node) { return (parent, reference_node.index() + 1) @@ -879,7 +879,7 @@ impl RangeMethods for Range { // Step 4. let ancestor = self.CommonAncestorContainer(); let mut iter = start_node.following_nodes(&ancestor) - .filter_map(Root::downcast::); + .filter_map(DomRoot::downcast::); while let Some(child) = iter.next() { if self.contains(child.upcast()) { @@ -898,13 +898,13 @@ impl RangeMethods for Range { } // https://dvcs.w3.org/hg/innerhtml/raw-file/tip/index.html#extensions-to-the-range-interface - fn CreateContextualFragment(&self, fragment: DOMString) -> Fallible> { + fn CreateContextualFragment(&self, fragment: DOMString) -> Fallible> { // Step 1. let node = self.StartContainer(); let owner_doc = node.owner_doc(); let element = match node.type_id() { NodeTypeId::Document(_) | NodeTypeId::DocumentFragment => None, - NodeTypeId::Element(_) => Some(Root::downcast::(node).unwrap()), + NodeTypeId::Element(_) => Some(DomRoot::downcast::(node).unwrap()), NodeTypeId::CharacterData(CharacterDataTypeId::Comment) | NodeTypeId::CharacterData(CharacterDataTypeId::Text) => node.GetParentElement(), NodeTypeId::CharacterData(CharacterDataTypeId::ProcessingInstruction) | diff --git a/components/script/dom/request.rs b/components/script/dom/request.rs index 6f7f5518c57a..68cb961c085c 100644 --- a/components/script/dom/request.rs +++ b/components/script/dom/request.rs @@ -18,7 +18,7 @@ use dom::bindings::codegen::Bindings::RequestBinding::RequestRedirect; use dom::bindings::codegen::Bindings::RequestBinding::RequestType; use dom::bindings::error::{Error, Fallible}; use dom::bindings::reflector::{DomObject, Reflector, reflect_dom_object}; -use dom::bindings::root::{MutNullableDom, Root}; +use dom::bindings::root::{DomRoot, MutNullableDom}; use dom::bindings::str::{ByteString, DOMString, USVString}; use dom::bindings::trace::RootedTraceableBox; use dom::globalscope::GlobalScope; @@ -67,7 +67,7 @@ impl Request { } pub fn new(global: &GlobalScope, - url: ServoUrl) -> Root { + url: ServoUrl) -> DomRoot { reflect_dom_object(box Request::new_inherited(global, url), global, RequestBinding::Wrap) @@ -77,7 +77,7 @@ impl Request { pub fn Constructor(global: &GlobalScope, input: RequestInfo, init: RootedTraceableBox) - -> Fallible> { + -> Fallible> { // Step 1 let temporary_request: NetTraitsRequest; @@ -293,7 +293,7 @@ impl Request { if let Some(possible_header) = init.headers.as_ref() { match possible_header { &HeadersInit::Headers(ref init_headers) => { - headers_copy = Root::from_ref(&*init_headers); + headers_copy = DomRoot::from_ref(&*init_headers); } &HeadersInit::ByteStringSequenceSequence(ref init_sequence) => { headers_copy.fill(Some( @@ -310,7 +310,7 @@ impl Request { // We cannot empty `r.Headers().header_list` because // we would undo the Step 27 above. One alternative is to set // `headers_copy` as a deep copy of `r.Headers()`. However, - // `r.Headers()` is a `Root`, and therefore it is difficult + // `r.Headers()` is a `DomRoot`, and therefore it is difficult // to obtain a mutable reference to `r.Headers()`. Without the // mutable reference, we cannot mutate `r.Headers()` to be the // deep copied headers in Step 27. @@ -409,14 +409,14 @@ impl Request { impl Request { fn from_net_request(global: &GlobalScope, - net_request: NetTraitsRequest) -> Root { + net_request: NetTraitsRequest) -> DomRoot { let r = Request::new(global, net_request.current_url()); *r.request.borrow_mut() = net_request; r } - fn clone_from(r: &Request) -> Fallible> { + fn clone_from(r: &Request) -> Fallible> { let req = r.request.borrow(); let url = req.url(); let body_used = r.body_used.get(); @@ -527,7 +527,7 @@ impl RequestMethods for Request { } // https://fetch.spec.whatwg.org/#dom-request-headers - fn Headers(&self) -> Root { + fn Headers(&self) -> DomRoot { self.headers.or_init(|| Headers::new(&self.global())) } @@ -594,7 +594,7 @@ impl RequestMethods for Request { } // https://fetch.spec.whatwg.org/#dom-request-clone - fn Clone(&self) -> Fallible> { + fn Clone(&self) -> Fallible> { // Step 1 if request_is_locked(self) { return Err(Error::Type("Request is locked".to_string())); diff --git a/components/script/dom/response.rs b/components/script/dom/response.rs index 269803feaa21..a874aac77e68 100644 --- a/components/script/dom/response.rs +++ b/components/script/dom/response.rs @@ -11,7 +11,7 @@ use dom::bindings::codegen::Bindings::ResponseBinding::{ResponseMethods, Respons use dom::bindings::codegen::Bindings::XMLHttpRequestBinding::BodyInit; use dom::bindings::error::{Error, Fallible}; use dom::bindings::reflector::{DomObject, Reflector, reflect_dom_object}; -use dom::bindings::root::{MutNullableDom, Root}; +use dom::bindings::root::{DomRoot, MutNullableDom}; use dom::bindings::str::{ByteString, USVString}; use dom::globalscope::GlobalScope; use dom::headers::{Headers, Guard}; @@ -67,12 +67,12 @@ impl Response { } // https://fetch.spec.whatwg.org/#dom-response - pub fn new(global: &GlobalScope) -> Root { + pub fn new(global: &GlobalScope) -> DomRoot { reflect_dom_object(box Response::new_inherited(), global, ResponseBinding::Wrap) } pub fn Constructor(global: &GlobalScope, body: Option, init: &ResponseBinding::ResponseInit) - -> Fallible> { + -> Fallible> { // Step 1 if init.status < 200 || init.status > 599 { return Err(Error::Range( @@ -139,7 +139,7 @@ impl Response { } // https://fetch.spec.whatwg.org/#dom-response-error - pub fn Error(global: &GlobalScope) -> Root { + pub fn Error(global: &GlobalScope) -> DomRoot { let r = Response::new(global); *r.response_type.borrow_mut() = DOMResponseType::Error; r.Headers().set_guard(Guard::Immutable); @@ -148,7 +148,7 @@ impl Response { } // https://fetch.spec.whatwg.org/#dom-response-redirect - pub fn Redirect(global: &GlobalScope, url: USVString, status: u16) -> Fallible> { + pub fn Redirect(global: &GlobalScope, url: USVString, status: u16) -> Fallible> { // Step 1 let base_url = global.api_base_url(); let parsed_url = base_url.join(&url.0); @@ -291,12 +291,12 @@ impl ResponseMethods for Response { } // https://fetch.spec.whatwg.org/#dom-response-headers - fn Headers(&self) -> Root { + fn Headers(&self) -> DomRoot { self.headers_reflector.or_init(|| Headers::for_response(&self.global())) } // https://fetch.spec.whatwg.org/#dom-response-clone - fn Clone(&self) -> Fallible> { + fn Clone(&self) -> Fallible> { // Step 1 if self.is_locked() || self.body_used.get() { return Err(Error::Type("cannot clone a disturbed response".to_string())); diff --git a/components/script/dom/screen.rs b/components/script/dom/screen.rs index e1ff7589dbd1..88a9025f76f2 100644 --- a/components/script/dom/screen.rs +++ b/components/script/dom/screen.rs @@ -5,7 +5,7 @@ use dom::bindings::codegen::Bindings::ScreenBinding; use dom::bindings::codegen::Bindings::ScreenBinding::ScreenMethods; use dom::bindings::reflector::{Reflector, reflect_dom_object}; -use dom::bindings::root::Root; +use dom::bindings::root::DomRoot; use dom::window::Window; use dom_struct::dom_struct; @@ -21,7 +21,7 @@ impl Screen { } } - pub fn new(window: &Window) -> Root { + pub fn new(window: &Window) -> DomRoot { reflect_dom_object(box Screen::new_inherited(), window, ScreenBinding::Wrap) diff --git a/components/script/dom/serviceworker.rs b/components/script/dom/serviceworker.rs index 4078daabf4f6..95c37d27c8e9 100644 --- a/components/script/dom/serviceworker.rs +++ b/components/script/dom/serviceworker.rs @@ -9,7 +9,7 @@ use dom::bindings::error::{ErrorResult, Error}; use dom::bindings::inheritance::Castable; use dom::bindings::refcounted::Trusted; use dom::bindings::reflector::{DomObject, reflect_dom_object}; -use dom::bindings::root::Root; +use dom::bindings::root::DomRoot; use dom::bindings::str::USVString; use dom::bindings::structuredclone::StructuredCloneData; use dom::eventtarget::EventTarget; @@ -48,7 +48,7 @@ impl ServiceWorker { pub fn install_serviceworker(global: &GlobalScope, script_url: ServoUrl, scope_url: ServoUrl, - skip_waiting: bool) -> Root { + skip_waiting: bool) -> DomRoot { reflect_dom_object(box ServiceWorker::new_inherited(script_url.as_str(), skip_waiting, scope_url), global, Wrap) diff --git a/components/script/dom/serviceworkercontainer.rs b/components/script/dom/serviceworkercontainer.rs index e4cb7c3a255e..9c853be24032 100644 --- a/components/script/dom/serviceworkercontainer.rs +++ b/components/script/dom/serviceworkercontainer.rs @@ -6,7 +6,7 @@ use dom::bindings::codegen::Bindings::ServiceWorkerContainerBinding::{ServiceWor use dom::bindings::codegen::Bindings::ServiceWorkerContainerBinding::RegistrationOptions; use dom::bindings::error::Error; use dom::bindings::reflector::{DomObject, reflect_dom_object}; -use dom::bindings::root::{Dom, MutNullableDom, Root}; +use dom::bindings::root::{Dom, DomRoot, MutNullableDom}; use dom::bindings::str::USVString; use dom::client::Client; use dom::eventtarget::EventTarget; @@ -37,7 +37,7 @@ impl ServiceWorkerContainer { } #[allow(unrooted_must_root)] - pub fn new(global: &GlobalScope) -> Root { + pub fn new(global: &GlobalScope) -> DomRoot { let client = Client::new(&global.as_window()); let container = ServiceWorkerContainer::new_inherited(&*client); reflect_dom_object(box container, global, Wrap) @@ -46,7 +46,7 @@ impl ServiceWorkerContainer { impl ServiceWorkerContainerMethods for ServiceWorkerContainer { // https://w3c.github.io/ServiceWorker/#service-worker-container-controller-attribute - fn GetController(&self) -> Option> { + fn GetController(&self) -> Option> { self.client.get_controller() } diff --git a/components/script/dom/serviceworkerglobalscope.rs b/components/script/dom/serviceworkerglobalscope.rs index b7b44328bc75..5e4ad439c904 100644 --- a/components/script/dom/serviceworkerglobalscope.rs +++ b/components/script/dom/serviceworkerglobalscope.rs @@ -9,7 +9,7 @@ use dom::bindings::codegen::Bindings::ServiceWorkerGlobalScopeBinding; use dom::bindings::codegen::Bindings::ServiceWorkerGlobalScopeBinding::ServiceWorkerGlobalScopeMethods; use dom::bindings::inheritance::Castable; use dom::bindings::reflector::DomObject; -use dom::bindings::root::{Root, RootCollection}; +use dom::bindings::root::{DomRoot, RootCollection}; use dom::bindings::str::DOMString; use dom::event::Event; use dom::eventtarget::EventTarget; @@ -120,7 +120,7 @@ impl ServiceWorkerGlobalScope { timer_event_port: Receiver<()>, swmanager_sender: IpcSender, scope_url: ServoUrl) - -> Root { + -> DomRoot { let cx = runtime.cx(); let scope = box ServiceWorkerGlobalScope::new_inherited(init, worker_url, @@ -322,7 +322,7 @@ impl ServiceWorkerGlobalScope { #[allow(unsafe_code)] unsafe extern "C" fn interrupt_callback(cx: *mut JSContext) -> bool { let worker = - Root::downcast::(GlobalScope::from_context(cx)) + DomRoot::downcast::(GlobalScope::from_context(cx)) .expect("global is not a worker scope"); assert!(worker.is::()); diff --git a/components/script/dom/serviceworkerregistration.rs b/components/script/dom/serviceworkerregistration.rs index 7a824509b623..aab043909437 100644 --- a/components/script/dom/serviceworkerregistration.rs +++ b/components/script/dom/serviceworkerregistration.rs @@ -5,7 +5,7 @@ use dom::bindings::codegen::Bindings::ServiceWorkerBinding::ServiceWorkerState; use dom::bindings::codegen::Bindings::ServiceWorkerRegistrationBinding::{ServiceWorkerRegistrationMethods, Wrap}; use dom::bindings::reflector::reflect_dom_object; -use dom::bindings::root::{Dom, Root}; +use dom::bindings::root::{Dom, DomRoot}; use dom::bindings::str::USVString; use dom::eventtarget::EventTarget; use dom::globalscope::GlobalScope; @@ -41,7 +41,7 @@ impl ServiceWorkerRegistration { #[allow(unrooted_must_root)] pub fn new(global: &GlobalScope, script_url: &ServoUrl, - scope: ServoUrl) -> Root { + scope: ServoUrl) -> DomRoot { let active_worker = ServiceWorker::install_serviceworker(global, script_url.clone(), scope.clone(), true); active_worker.set_transition_state(ServiceWorkerState::Installed); reflect_dom_object(box ServiceWorkerRegistration::new_inherited(&*active_worker, scope), global, Wrap) @@ -79,13 +79,13 @@ impl ServiceWorkerRegistration { } // https://w3c.github.io/ServiceWorker/#get-newest-worker-algorithm - pub fn get_newest_worker(&self) -> Option> { + pub fn get_newest_worker(&self) -> Option> { if self.installing.as_ref().is_some() { - self.installing.as_ref().map(|sw| Root::from_ref(&**sw)) + self.installing.as_ref().map(|sw| DomRoot::from_ref(&**sw)) } else if self.waiting.as_ref().is_some() { - self.waiting.as_ref().map(|sw| Root::from_ref(&**sw)) + self.waiting.as_ref().map(|sw| DomRoot::from_ref(&**sw)) } else { - self.active.as_ref().map(|sw| Root::from_ref(&**sw)) + self.active.as_ref().map(|sw| DomRoot::from_ref(&**sw)) } } } @@ -105,18 +105,18 @@ pub fn longest_prefix_match(stored_scope: &ServoUrl, potential_match: &ServoUrl) impl ServiceWorkerRegistrationMethods for ServiceWorkerRegistration { // https://w3c.github.io/ServiceWorker/#service-worker-registration-installing-attribute - fn GetInstalling(&self) -> Option> { - self.installing.as_ref().map(|sw| Root::from_ref(&**sw)) + fn GetInstalling(&self) -> Option> { + self.installing.as_ref().map(|sw| DomRoot::from_ref(&**sw)) } // https://w3c.github.io/ServiceWorker/#service-worker-registration-active-attribute - fn GetActive(&self) -> Option> { - self.active.as_ref().map(|sw| Root::from_ref(&**sw)) + fn GetActive(&self) -> Option> { + self.active.as_ref().map(|sw| DomRoot::from_ref(&**sw)) } // https://w3c.github.io/ServiceWorker/#service-worker-registration-waiting-attribute - fn GetWaiting(&self) -> Option> { - self.waiting.as_ref().map(|sw| Root::from_ref(&**sw)) + fn GetWaiting(&self) -> Option> { + self.waiting.as_ref().map(|sw| DomRoot::from_ref(&**sw)) } // https://w3c.github.io/ServiceWorker/#service-worker-registration-scope-attribute diff --git a/components/script/dom/servoparser/async_html.rs b/components/script/dom/servoparser/async_html.rs index 19c163616cfd..05df90c5c84a 100644 --- a/components/script/dom/servoparser/async_html.rs +++ b/components/script/dom/servoparser/async_html.rs @@ -7,7 +7,7 @@ use dom::bindings::codegen::Bindings::HTMLTemplateElementBinding::HTMLTemplateElementMethods; use dom::bindings::codegen::Bindings::NodeBinding::NodeMethods; use dom::bindings::inheritance::Castable; -use dom::bindings::root::{Dom, Root}; +use dom::bindings::root::{Dom, DomRoot}; use dom::bindings::str::DOMString; use dom::comment::Comment; use dom::document::Document; @@ -230,7 +230,7 @@ impl Tokenizer { tokenizer } - pub fn feed(&mut self, input: &mut BufferQueue) -> Result<(), Root> { + pub fn feed(&mut self, input: &mut BufferQueue) -> Result<(), DomRoot> { let mut send_tendrils = VecDeque::new(); while let Some(str) = input.pop_front() { send_tendrils.push_back(SendTendril::from(str)); @@ -252,7 +252,7 @@ impl Tokenizer { let buffer_queue = create_buffer_queue(updated_input); *input = buffer_queue; let script = self.get_node(&script.id); - return Err(Root::from_ref(script.downcast().unwrap())); + return Err(DomRoot::from_ref(script.downcast().unwrap())); } ToTokenizerMsg::End => unreachable!(), }; @@ -326,11 +326,11 @@ impl Tokenizer { } fn process_operation(&mut self, op: ParseOperation) { - let document = Root::from_ref(&**self.get_node(&0)); + let document = DomRoot::from_ref(&**self.get_node(&0)); let document = document.downcast::().expect("Document node should be downcasted!"); match op { ParseOperation::GetTemplateContents { target, contents } => { - let target = Root::from_ref(&**self.get_node(&target)); + let target = DomRoot::from_ref(&**self.get_node(&target)); let template = target.downcast::().expect( "Tried to extract contents from non-template element while parsing"); self.insert_node(contents, Dom::from_ref(template.Content().upcast())); @@ -407,7 +407,7 @@ impl Tokenizer { return; } let form = self.get_node(&form); - let form = Root::downcast::(Root::from_ref(&**form)) + let form = DomRoot::downcast::(DomRoot::from_ref(&**form)) .expect("Owner must be a form element"); let node = self.get_node(&target); diff --git a/components/script/dom/servoparser/html.rs b/components/script/dom/servoparser/html.rs index 54635c15bb02..86c2b5519403 100644 --- a/components/script/dom/servoparser/html.rs +++ b/components/script/dom/servoparser/html.rs @@ -6,7 +6,7 @@ use dom::bindings::codegen::Bindings::HTMLTemplateElementBinding::HTMLTemplateElementMethods; use dom::bindings::inheritance::{Castable, CharacterDataTypeId, NodeTypeId}; -use dom::bindings::root::{Dom, Root}; +use dom::bindings::root::{Dom, DomRoot}; use dom::bindings::trace::JSTraceable; use dom::characterdata::CharacterData; use dom::document::Document; @@ -75,10 +75,10 @@ impl Tokenizer { } } - pub fn feed(&mut self, input: &mut BufferQueue) -> Result<(), Root> { + pub fn feed(&mut self, input: &mut BufferQueue) -> Result<(), DomRoot> { match self.inner.feed(input) { TokenizerResult::Done => Ok(()), - TokenizerResult::Script(script) => Err(Root::from_ref(script.downcast().unwrap())), + TokenizerResult::Script(script) => Err(DomRoot::from_ref(script.downcast().unwrap())), } } @@ -140,16 +140,16 @@ fn end_element(node: &Element, serializer: &mut S) -> io::Result< enum SerializationCommand { - OpenElement(Root), - CloseElement(Root), - SerializeNonelement(Root), + OpenElement(DomRoot), + CloseElement(DomRoot), + SerializeNonelement(DomRoot), } struct SerializationIterator { stack: Vec, } -fn rev_children_iter(n: &Node) -> impl Iterator>{ +fn rev_children_iter(n: &Node) -> impl Iterator>{ match n.downcast::() { Some(t) => t.Content().upcast::().rev_children(), None => n.rev_children(), @@ -173,8 +173,8 @@ impl SerializationIterator { fn push_node(&mut self, n: &Node) { match n.downcast::() { - Some(e) => self.stack.push(SerializationCommand::OpenElement(Root::from_ref(e))), - None => self.stack.push(SerializationCommand::SerializeNonelement(Root::from_ref(n))), + Some(e) => self.stack.push(SerializationCommand::OpenElement(DomRoot::from_ref(e))), + None => self.stack.push(SerializationCommand::SerializeNonelement(DomRoot::from_ref(n))), } } } diff --git a/components/script/dom/servoparser/mod.rs b/components/script/dom/servoparser/mod.rs index 3bc3a98babab..b458bc047be3 100644 --- a/components/script/dom/servoparser/mod.rs +++ b/components/script/dom/servoparser/mod.rs @@ -12,7 +12,7 @@ use dom::bindings::codegen::Bindings::ServoParserBinding; use dom::bindings::inheritance::Castable; use dom::bindings::refcounted::Trusted; use dom::bindings::reflector::{Reflector, reflect_dom_object}; -use dom::bindings::root::{Dom, MutNullableDom, Root, RootedReference}; +use dom::bindings::root::{Dom, DomRoot, MutNullableDom, RootedReference}; use dom::bindings::str::DOMString; use dom::characterdata::CharacterData; use dom::comment::Comment; @@ -119,7 +119,7 @@ impl ServoParser { } // https://html.spec.whatwg.org/multipage/#parsing-html-fragments - pub fn parse_html_fragment(context: &Element, input: DOMString) -> impl Iterator> { + pub fn parse_html_fragment(context: &Element, input: DOMString) -> impl Iterator> { let context_node = context.upcast::(); let context_document = context_node.owner_doc(); let window = context_document.window(); @@ -337,7 +337,7 @@ impl ServoParser { tokenizer: Tokenizer, last_chunk_state: LastChunkState, kind: ParserKind) - -> Root { + -> DomRoot { reflect_dom_object(box ServoParser::new_inherited(document, tokenizer, last_chunk_state, kind), document.window(), ServoParserBinding::Wrap) @@ -422,7 +422,7 @@ impl ServoParser { } fn tokenize(&self, mut feed: F) - where F: FnMut(&mut Tokenizer) -> Result<(), Root>, + where F: FnMut(&mut Tokenizer) -> Result<(), DomRoot>, { loop { assert!(!self.suspended.get()); @@ -469,17 +469,17 @@ impl ServoParser { } struct FragmentParsingResult - where I: Iterator> + where I: Iterator> { inner: I, } impl Iterator for FragmentParsingResult - where I: Iterator> + where I: Iterator> { - type Item = Root; + type Item = DomRoot; - fn next(&mut self) -> Option> { + fn next(&mut self) -> Option> { let next = match self.inner.next() { Some(next) => next, None => return None, @@ -508,7 +508,7 @@ enum Tokenizer { } impl Tokenizer { - fn feed(&mut self, input: &mut BufferQueue) -> Result<(), Root> { + fn feed(&mut self, input: &mut BufferQueue) -> Result<(), DomRoot> { match *self { Tokenizer::Html(ref mut tokenizer) => tokenizer.feed(input), Tokenizer::AsyncHtml(ref mut tokenizer) => tokenizer.feed(input), @@ -624,10 +624,10 @@ impl FetchResponseListener for ParserContext { parser.parse_sync(); let doc = &parser.document; - let doc_body = Root::upcast::(doc.GetBody().unwrap()); + let doc_body = DomRoot::upcast::(doc.GetBody().unwrap()); let img = HTMLImageElement::new(local_name!("img"), None, doc); img.SetSrc(DOMString::from(self.url.to_string())); - doc_body.AppendChild(&Root::upcast::(img)).expect("Appending failed"); + doc_body.AppendChild(&DomRoot::upcast::(img)).expect("Appending failed"); }, Some(ContentType(Mime(TopLevel::Text, SubLevel::Plain, _))) => { @@ -730,7 +730,7 @@ fn insert(parent: &Node, reference_child: Option<&Node>, child: NodeOrText); + .and_then(DomRoot::downcast::); if let Some(text) = text { text.upcast::().append_data(&t); @@ -834,7 +834,7 @@ impl TreeSink for Sink { } let node = target; - let form = Root::downcast::(Root::from_ref(&**form)) + let form = DomRoot::downcast::(DomRoot::from_ref(&**form)) .expect("Owner must be a form element"); let elem = node.downcast::(); @@ -945,7 +945,7 @@ impl TreeSink for Sink { } fn pop(&mut self, node: &Dom) { - let node = Root::from_ref(&**node); + let node = DomRoot::from_ref(&**node); vtable_for(&node).pop(); } } diff --git a/components/script/dom/servoparser/xml.rs b/components/script/dom/servoparser/xml.rs index 12c9131daa5b..fe74d6273490 100644 --- a/components/script/dom/servoparser/xml.rs +++ b/components/script/dom/servoparser/xml.rs @@ -4,7 +4,7 @@ #![allow(unrooted_must_root)] -use dom::bindings::root::{Dom, Root}; +use dom::bindings::root::{Dom, DomRoot}; use dom::bindings::trace::JSTraceable; use dom::document::Document; use dom::htmlscriptelement::HTMLScriptElement; @@ -40,7 +40,7 @@ impl Tokenizer { } } - pub fn feed(&mut self, input: &mut BufferQueue) -> Result<(), Root> { + pub fn feed(&mut self, input: &mut BufferQueue) -> Result<(), DomRoot> { if !input.is_empty() { while let Some(chunk) = input.pop_front() { self.inner.feed(chunk); diff --git a/components/script/dom/storage.rs b/components/script/dom/storage.rs index ba4ac955e6dc..56d5e8328709 100644 --- a/components/script/dom/storage.rs +++ b/components/script/dom/storage.rs @@ -8,7 +8,7 @@ use dom::bindings::error::{Error, ErrorResult}; use dom::bindings::inheritance::Castable; use dom::bindings::refcounted::Trusted; use dom::bindings::reflector::{DomObject, Reflector, reflect_dom_object}; -use dom::bindings::root::Root; +use dom::bindings::root::DomRoot; use dom::bindings::str::DOMString; use dom::event::{Event, EventBubbles, EventCancelable}; use dom::storageevent::StorageEvent; @@ -35,7 +35,7 @@ impl Storage { } } - pub fn new(global: &Window, storage_type: StorageType) -> Root { + pub fn new(global: &Window, storage_type: StorageType) -> DomRoot { reflect_dom_object(box Storage::new_inherited(storage_type), global, StorageBinding::Wrap) } diff --git a/components/script/dom/storageevent.rs b/components/script/dom/storageevent.rs index f5f8bc5577f5..382cdc612b4a 100644 --- a/components/script/dom/storageevent.rs +++ b/components/script/dom/storageevent.rs @@ -8,7 +8,7 @@ use dom::bindings::codegen::Bindings::StorageEventBinding::StorageEventMethods; use dom::bindings::error::Fallible; use dom::bindings::inheritance::Castable; use dom::bindings::reflector::reflect_dom_object; -use dom::bindings::root::{MutNullableDom, Root, RootedReference}; +use dom::bindings::root::{DomRoot, MutNullableDom, RootedReference}; use dom::bindings::str::DOMString; use dom::event::{Event, EventBubbles, EventCancelable}; use dom::storage::Storage; @@ -44,7 +44,7 @@ impl StorageEvent { } pub fn new_uninitialized(window: &Window, - url: DOMString) -> Root { + url: DOMString) -> DomRoot { reflect_dom_object(box StorageEvent::new_inherited(None, None, None, url, None), window, StorageEventBinding::Wrap) @@ -58,7 +58,7 @@ impl StorageEvent { oldValue: Option, newValue: Option, url: DOMString, - storageArea: Option<&Storage>) -> Root { + storageArea: Option<&Storage>) -> DomRoot { let ev = reflect_dom_object(box StorageEvent::new_inherited(key, oldValue, newValue, url, storageArea), global, @@ -72,7 +72,7 @@ impl StorageEvent { pub fn Constructor(global: &Window, type_: DOMString, - init: &StorageEventBinding::StorageEventInit) -> Fallible> { + init: &StorageEventBinding::StorageEventInit) -> Fallible> { let key = init.key.clone(); let oldValue = init.oldValue.clone(); let newValue = init.newValue.clone(); @@ -110,7 +110,7 @@ impl StorageEventMethods for StorageEvent { } // https://html.spec.whatwg.org/multipage/#dom-storageevent-storagearea - fn GetStorageArea(&self) -> Option> { + fn GetStorageArea(&self) -> Option> { self.storage_area.get() } diff --git a/components/script/dom/stylepropertymapreadonly.rs b/components/script/dom/stylepropertymapreadonly.rs index 624664df75f3..4002a68c0d49 100644 --- a/components/script/dom/stylepropertymapreadonly.rs +++ b/components/script/dom/stylepropertymapreadonly.rs @@ -6,7 +6,7 @@ use dom::bindings::codegen::Bindings::StylePropertyMapReadOnlyBinding::StyleProp use dom::bindings::codegen::Bindings::StylePropertyMapReadOnlyBinding::Wrap; use dom::bindings::reflector::Reflector; use dom::bindings::reflector::reflect_dom_object; -use dom::bindings::root::{Dom, Root}; +use dom::bindings::root::{Dom, DomRoot}; use dom::bindings::str::DOMString; use dom::cssstylevalue::CSSStyleValue; use dom::globalscope::GlobalScope; @@ -33,7 +33,7 @@ impl StylePropertyMapReadOnly { } } - pub fn from_iter(global: &GlobalScope, entries: Entries) -> Root where + pub fn from_iter(global: &GlobalScope, entries: Entries) -> DomRoot where Entries: IntoIterator, { let mut keys = Vec::new(); @@ -54,9 +54,9 @@ impl StylePropertyMapReadOnly { impl StylePropertyMapReadOnlyMethods for StylePropertyMapReadOnly { /// https://drafts.css-houdini.org/css-typed-om-1/#dom-stylepropertymapreadonly-get - fn Get(&self, property: DOMString) -> Option> { + fn Get(&self, property: DOMString) -> Option> { // TODO: avoid constructing an Atom - self.entries.get(&Atom::from(property)).map(|value| Root::from_ref(&**value)) + self.entries.get(&Atom::from(property)).map(|value| DomRoot::from_ref(&**value)) } /// https://drafts.css-houdini.org/css-typed-om-1/#dom-stylepropertymapreadonly-has diff --git a/components/script/dom/stylesheet.rs b/components/script/dom/stylesheet.rs index 731431ca94fd..6315fe19ccd0 100644 --- a/components/script/dom/stylesheet.rs +++ b/components/script/dom/stylesheet.rs @@ -6,7 +6,7 @@ use dom::bindings::codegen::Bindings::StyleSheetBinding; use dom::bindings::codegen::Bindings::StyleSheetBinding::StyleSheetMethods; use dom::bindings::inheritance::Castable; use dom::bindings::reflector::{Reflector, reflect_dom_object}; -use dom::bindings::root::Root; +use dom::bindings::root::DomRoot; use dom::bindings::str::DOMString; use dom::cssstylesheet::CSSStyleSheet; use dom::window::Window; @@ -36,7 +36,7 @@ impl StyleSheet { #[allow(unrooted_must_root)] pub fn new(window: &Window, type_: DOMString, href: Option, - title: Option) -> Root { + title: Option) -> DomRoot { reflect_dom_object(box StyleSheet::new_inherited(type_, href, title), window, StyleSheetBinding::Wrap) diff --git a/components/script/dom/stylesheetlist.rs b/components/script/dom/stylesheetlist.rs index 7a479fe4c17f..15c524e83a3a 100644 --- a/components/script/dom/stylesheetlist.rs +++ b/components/script/dom/stylesheetlist.rs @@ -5,7 +5,7 @@ use dom::bindings::codegen::Bindings::StyleSheetListBinding; use dom::bindings::codegen::Bindings::StyleSheetListBinding::StyleSheetListMethods; use dom::bindings::reflector::{Reflector, reflect_dom_object}; -use dom::bindings::root::{Dom, Root}; +use dom::bindings::root::{Dom, DomRoot}; use dom::document::Document; use dom::stylesheet::StyleSheet; use dom::window::Window; @@ -27,7 +27,7 @@ impl StyleSheetList { } #[allow(unrooted_must_root)] - pub fn new(window: &Window, document: Dom) -> Root { + pub fn new(window: &Window, document: Dom) -> DomRoot { reflect_dom_object(box StyleSheetList::new_inherited(document), window, StyleSheetListBinding::Wrap) } @@ -40,14 +40,14 @@ impl StyleSheetListMethods for StyleSheetList { } // https://drafts.csswg.org/cssom/#dom-stylesheetlist-item - fn Item(&self, index: u32) -> Option> { + fn Item(&self, index: u32) -> Option> { // XXXManishearth this doesn't handle the origin clean flag and is a // cors vulnerability - self.document.stylesheet_at(index as usize).map(Root::upcast) + self.document.stylesheet_at(index as usize).map(DomRoot::upcast) } // check-tidy: no specs after this line - fn IndexedGetter(&self, index: u32) -> Option> { + fn IndexedGetter(&self, index: u32) -> Option> { self.Item(index) } } diff --git a/components/script/dom/svgsvgelement.rs b/components/script/dom/svgsvgelement.rs index e223d7f0b796..b7ee599b1025 100644 --- a/components/script/dom/svgsvgelement.rs +++ b/components/script/dom/svgsvgelement.rs @@ -5,7 +5,7 @@ use dom::attr::Attr; use dom::bindings::codegen::Bindings::SVGSVGElementBinding; use dom::bindings::inheritance::Castable; -use dom::bindings::root::{LayoutDom, Root}; +use dom::bindings::root::{DomRoot, LayoutDom}; use dom::bindings::str::DOMString; use dom::document::Document; use dom::element::{AttributeMutation, Element, RawLayoutElementHelpers}; @@ -38,7 +38,7 @@ impl SVGSVGElement { #[allow(unrooted_must_root)] pub fn new(local_name: LocalName, prefix: Option, - document: &Document) -> Root { + document: &Document) -> DomRoot { Node::reflect_node(box SVGSVGElement::new_inherited(local_name, prefix, document), document, SVGSVGElementBinding::Wrap) diff --git a/components/script/dom/testbinding.rs b/components/script/dom/testbinding.rs index 23309f28dd57..3f76dab22471 100644 --- a/components/script/dom/testbinding.rs +++ b/components/script/dom/testbinding.rs @@ -25,7 +25,7 @@ use dom::bindings::mozmap::MozMap; use dom::bindings::num::Finite; use dom::bindings::refcounted::TrustedPromise; use dom::bindings::reflector::{DomObject, Reflector, reflect_dom_object}; -use dom::bindings::root::Root; +use dom::bindings::root::DomRoot; use dom::bindings::str::{ByteString, DOMString, USVString}; use dom::bindings::trace::RootedTraceableBox; use dom::bindings::weakref::MutableWeakRef; @@ -59,22 +59,22 @@ impl TestBinding { } } - pub fn new(global: &GlobalScope) -> Root { + pub fn new(global: &GlobalScope) -> DomRoot { reflect_dom_object(box TestBinding::new_inherited(), global, TestBindingBinding::Wrap) } - pub fn Constructor(global: &GlobalScope) -> Fallible> { + pub fn Constructor(global: &GlobalScope) -> Fallible> { Ok(TestBinding::new(global)) } #[allow(unused_variables)] - pub fn Constructor_(global: &GlobalScope, nums: Vec) -> Fallible> { + pub fn Constructor_(global: &GlobalScope, nums: Vec) -> Fallible> { Ok(TestBinding::new(global)) } #[allow(unused_variables)] - pub fn Constructor__(global: &GlobalScope, num: f64) -> Fallible> { + pub fn Constructor__(global: &GlobalScope, num: f64) -> Fallible> { Ok(TestBinding::new(global)) } } @@ -114,7 +114,7 @@ impl TestBindingMethods for TestBinding { fn SetByteStringAttribute(&self, _: ByteString) {} fn EnumAttribute(&self) -> TestEnum { TestEnum::_empty } fn SetEnumAttribute(&self, _: TestEnum) {} - fn InterfaceAttribute(&self) -> Root { + fn InterfaceAttribute(&self) -> DomRoot { Blob::new(&self.global(), BlobImpl::new_from_bytes(vec![]), "".to_owned()) } fn SetInterfaceAttribute(&self, _: &Blob) {} @@ -202,18 +202,18 @@ impl TestBindingMethods for TestBinding { fn GetUsvstringAttributeNullable(&self) -> Option { Some(USVString("".to_owned())) } fn SetUsvstringAttributeNullable(&self, _: Option) {} fn SetBinaryRenamedAttribute(&self, _: DOMString) {} - fn ForwardedAttribute(&self) -> Root { Root::from_ref(self) } + fn ForwardedAttribute(&self) -> DomRoot { DomRoot::from_ref(self) } fn BinaryRenamedAttribute(&self) -> DOMString { DOMString::new() } fn SetBinaryRenamedAttribute2(&self, _: DOMString) {} fn BinaryRenamedAttribute2(&self) -> DOMString { DOMString::new() } fn Attr_to_automatically_rename(&self) -> DOMString { DOMString::new() } fn SetAttr_to_automatically_rename(&self, _: DOMString) {} fn GetEnumAttributeNullable(&self) -> Option { Some(TestEnum::_empty) } - fn GetInterfaceAttributeNullable(&self) -> Option> { + fn GetInterfaceAttributeNullable(&self) -> Option> { Some(Blob::new(&self.global(), BlobImpl::new_from_bytes(vec![]), "".to_owned())) } fn SetInterfaceAttributeNullable(&self, _: Option<&Blob>) {} - fn GetInterfaceAttributeWeak(&self) -> Option> { + fn GetInterfaceAttributeWeak(&self) -> Option> { self.url.root() } fn SetInterfaceAttributeWeak(&self, url: Option<&URL>) { @@ -266,7 +266,7 @@ impl TestBindingMethods for TestBinding { fn ReceiveUsvstring(&self) -> USVString { USVString("".to_owned()) } fn ReceiveByteString(&self) -> ByteString { ByteString::new(vec!()) } fn ReceiveEnum(&self) -> TestEnum { TestEnum::_empty } - fn ReceiveInterface(&self) -> Root { + fn ReceiveInterface(&self) -> DomRoot { Blob::new(&self.global(), BlobImpl::new_from_bytes(vec![]), "".to_owned()) } #[allow(unsafe_code)] @@ -291,7 +291,7 @@ impl TestBindingMethods for TestBinding { ByteStringSequenceOrLongOrString::ByteStringSequence(vec!(ByteString::new(vec!()))) } fn ReceiveSequence(&self) -> Vec { vec![1] } - fn ReceiveInterfaceSequence(&self) -> Vec> { + fn ReceiveInterfaceSequence(&self) -> Vec> { vec![Blob::new(&self.global(), BlobImpl::new_from_bytes(vec![]), "".to_owned())] } @@ -312,7 +312,7 @@ impl TestBindingMethods for TestBinding { fn ReceiveNullableUsvstring(&self) -> Option { Some(USVString("".to_owned())) } fn ReceiveNullableByteString(&self) -> Option { Some(ByteString::new(vec!())) } fn ReceiveNullableEnum(&self) -> Option { Some(TestEnum::_empty) } - fn ReceiveNullableInterface(&self) -> Option> { + fn ReceiveNullableInterface(&self) -> Option> { Some(Blob::new(&self.global(), BlobImpl::new_from_bytes(vec![]), "".to_owned())) } #[allow(unsafe_code)] @@ -449,7 +449,7 @@ impl TestBindingMethods for TestBinding { fn PassCallbackInterface(&self, _: Rc) {} fn PassSequence(&self, _: Vec) {} fn PassStringSequence(&self, _: Vec) {} - fn PassInterfaceSequence(&self, _: Vec>) {} + fn PassInterfaceSequence(&self, _: Vec>) {} fn PassNullableBoolean(&self, _: Option) {} fn PassNullableByte(&self, _: Option) {} @@ -651,14 +651,14 @@ impl TestBindingMethods for TestBinding { fn PassMozMapOfNullableInts(&self, _: MozMap>) {} fn PassOptionalMozMapOfNullableInts(&self, _: Option>>) {} fn PassOptionalNullableMozMapOfNullableInts(&self, _: Option> >>) {} - fn PassCastableObjectMozMap(&self, _: MozMap>) {} - fn PassNullableCastableObjectMozMap(&self, _: MozMap>>) {} - fn PassCastableObjectNullableMozMap(&self, _: Option>>) {} - fn PassNullableCastableObjectNullableMozMap(&self, _: Option>>>) {} + fn PassCastableObjectMozMap(&self, _: MozMap>) {} + fn PassNullableCastableObjectMozMap(&self, _: MozMap>>) {} + fn PassCastableObjectNullableMozMap(&self, _: Option>>) {} + fn PassNullableCastableObjectNullableMozMap(&self, _: Option>>>) {} fn PassOptionalMozMap(&self, _: Option>) {} fn PassOptionalNullableMozMap(&self, _: Option>>) {} fn PassOptionalNullableMozMapWithDefaultValue(&self, _: Option>) {} - fn PassOptionalObjectMozMap(&self, _: Option>>) {} + fn PassOptionalObjectMozMap(&self, _: Option>>) {} fn PassStringMozMap(&self, _: MozMap) {} fn PassByteStringMozMap(&self, _: MozMap) {} fn PassMozMapOfMozMaps(&self, _: MozMap>) {} @@ -776,10 +776,10 @@ impl TestBindingMethods for TestBinding { fn Panic(&self) { panic!("explicit panic from script") } - fn EntryGlobal(&self) -> Root { + fn EntryGlobal(&self) -> DomRoot { GlobalScope::entry() } - fn IncumbentGlobal(&self) -> Root { + fn IncumbentGlobal(&self) -> DomRoot { GlobalScope::incumbent().unwrap() } } diff --git a/components/script/dom/testbindingiterable.rs b/components/script/dom/testbindingiterable.rs index a412c5e288d4..9f9354b88157 100644 --- a/components/script/dom/testbindingiterable.rs +++ b/components/script/dom/testbindingiterable.rs @@ -8,7 +8,7 @@ use dom::bindings::cell::DomRefCell; use dom::bindings::codegen::Bindings::TestBindingIterableBinding::{self, TestBindingIterableMethods}; use dom::bindings::error::Fallible; use dom::bindings::reflector::{Reflector, reflect_dom_object}; -use dom::bindings::root::Root; +use dom::bindings::root::DomRoot; use dom::bindings::str::DOMString; use dom::globalscope::GlobalScope; use dom_struct::dom_struct; @@ -20,14 +20,14 @@ pub struct TestBindingIterable { } impl TestBindingIterable { - fn new(global: &GlobalScope) -> Root { + fn new(global: &GlobalScope) -> DomRoot { reflect_dom_object(box TestBindingIterable { reflector: Reflector::new(), vals: DomRefCell::new(vec![]), }, global, TestBindingIterableBinding::Wrap) } - pub fn Constructor(global: &GlobalScope) -> Fallible> { + pub fn Constructor(global: &GlobalScope) -> Fallible> { Ok(TestBindingIterable::new(global)) } } diff --git a/components/script/dom/testbindingpairiterable.rs b/components/script/dom/testbindingpairiterable.rs index 106fb5e850b7..5fae49893aa6 100644 --- a/components/script/dom/testbindingpairiterable.rs +++ b/components/script/dom/testbindingpairiterable.rs @@ -10,7 +10,7 @@ use dom::bindings::codegen::Bindings::TestBindingPairIterableBinding::TestBindin use dom::bindings::error::Fallible; use dom::bindings::iterable::Iterable; use dom::bindings::reflector::{Reflector, reflect_dom_object}; -use dom::bindings::root::Root; +use dom::bindings::root::DomRoot; use dom::bindings::str::DOMString; use dom::globalscope::GlobalScope; use dom_struct::dom_struct; @@ -36,14 +36,14 @@ impl Iterable for TestBindingPairIterable { } impl TestBindingPairIterable { - fn new(global: &GlobalScope) -> Root { + fn new(global: &GlobalScope) -> DomRoot { reflect_dom_object(box TestBindingPairIterable { reflector: Reflector::new(), map: DomRefCell::new(vec![]), }, global, TestBindingPairIterableBinding::TestBindingPairIterableWrap) } - pub fn Constructor(global: &GlobalScope) -> Fallible> { + pub fn Constructor(global: &GlobalScope) -> Fallible> { Ok(TestBindingPairIterable::new(global)) } } diff --git a/components/script/dom/testrunner.rs b/components/script/dom/testrunner.rs index 1036f7ea0653..972bc7297234 100644 --- a/components/script/dom/testrunner.rs +++ b/components/script/dom/testrunner.rs @@ -7,7 +7,7 @@ use dom::bindings::codegen::Bindings::TestRunnerBinding; use dom::bindings::codegen::Bindings::TestRunnerBinding::TestRunnerMethods; use dom::bindings::error::{Error, ErrorResult}; use dom::bindings::reflector::{DomObject, Reflector, reflect_dom_object}; -use dom::bindings::root::Root; +use dom::bindings::root::DomRoot; use dom::bindings::str::DOMString; use dom::globalscope::GlobalScope; use dom_struct::dom_struct; @@ -26,7 +26,7 @@ impl TestRunner { } } - pub fn new(global: &GlobalScope) -> Root { + pub fn new(global: &GlobalScope) -> DomRoot { reflect_dom_object(box TestRunner::new_inherited(), global, TestRunnerBinding::Wrap) diff --git a/components/script/dom/testworklet.rs b/components/script/dom/testworklet.rs index 31d1e3853c1b..04ed5ffc3c43 100644 --- a/components/script/dom/testworklet.rs +++ b/components/script/dom/testworklet.rs @@ -11,7 +11,7 @@ use dom::bindings::codegen::Bindings::WorkletBinding::WorkletOptions; use dom::bindings::error::Fallible; use dom::bindings::reflector::Reflector; use dom::bindings::reflector::reflect_dom_object; -use dom::bindings::root::{Dom, Root}; +use dom::bindings::root::{Dom, DomRoot}; use dom::bindings::str::DOMString; use dom::bindings::str::USVString; use dom::promise::Promise; @@ -36,12 +36,12 @@ impl TestWorklet { } } - fn new(window: &Window) -> Root { + fn new(window: &Window) -> DomRoot { let worklet = Worklet::new(window, WorkletGlobalScopeType::Test); reflect_dom_object(box TestWorklet::new_inherited(&*worklet), window, Wrap) } - pub fn Constructor(window: &Window) -> Fallible> { + pub fn Constructor(window: &Window) -> Fallible> { Ok(TestWorklet::new(window)) } } diff --git a/components/script/dom/testworkletglobalscope.rs b/components/script/dom/testworkletglobalscope.rs index ed29e8a4f30c..54b2c299df78 100644 --- a/components/script/dom/testworkletglobalscope.rs +++ b/components/script/dom/testworkletglobalscope.rs @@ -5,7 +5,7 @@ use dom::bindings::cell::DomRefCell; use dom::bindings::codegen::Bindings::TestWorkletGlobalScopeBinding; use dom::bindings::codegen::Bindings::TestWorkletGlobalScopeBinding::TestWorkletGlobalScopeMethods; -use dom::bindings::root::Root; +use dom::bindings::root::DomRoot; use dom::bindings::str::DOMString; use dom::worklet::WorkletExecutor; use dom::workletglobalscope::WorkletGlobalScope; @@ -34,7 +34,7 @@ impl TestWorkletGlobalScope { base_url: ServoUrl, executor: WorkletExecutor, init: &WorkletGlobalScopeInit) - -> Root + -> DomRoot { debug!("Creating test worklet global scope for pipeline {}.", pipeline_id); let global = box TestWorkletGlobalScope { diff --git a/components/script/dom/text.rs b/components/script/dom/text.rs index 800b9288c143..2e37edc1a8dd 100644 --- a/components/script/dom/text.rs +++ b/components/script/dom/text.rs @@ -9,7 +9,7 @@ use dom::bindings::codegen::Bindings::TextBinding::{self, TextMethods}; use dom::bindings::codegen::Bindings::WindowBinding::WindowMethods; use dom::bindings::error::{Error, Fallible}; use dom::bindings::inheritance::Castable; -use dom::bindings::root::{Root, RootedReference}; +use dom::bindings::root::{DomRoot, RootedReference}; use dom::bindings::str::DOMString; use dom::characterdata::CharacterData; use dom::document::Document; @@ -30,12 +30,12 @@ impl Text { } } - pub fn new(text: DOMString, document: &Document) -> Root { + pub fn new(text: DOMString, document: &Document) -> DomRoot { Node::reflect_node(box Text::new_inherited(text, document), document, TextBinding::Wrap) } - pub fn Constructor(window: &Window, text: DOMString) -> Fallible> { + pub fn Constructor(window: &Window, text: DOMString) -> Fallible> { let document = window.Document(); Ok(Text::new(text, &document)) } @@ -44,7 +44,7 @@ impl Text { impl TextMethods for Text { // https://dom.spec.whatwg.org/#dom-text-splittext // https://dom.spec.whatwg.org/#concept-text-split - fn SplitText(&self, offset: u32) -> Fallible> { + fn SplitText(&self, offset: u32) -> Fallible> { let cdata = self.upcast::(); // Step 1. let length = cdata.Length(); diff --git a/components/script/dom/textdecoder.rs b/components/script/dom/textdecoder.rs index 48dc364c489e..56e32ed5245f 100644 --- a/components/script/dom/textdecoder.rs +++ b/components/script/dom/textdecoder.rs @@ -6,7 +6,7 @@ use dom::bindings::codegen::Bindings::TextDecoderBinding; use dom::bindings::codegen::Bindings::TextDecoderBinding::TextDecoderMethods; use dom::bindings::error::{Error, Fallible}; use dom::bindings::reflector::{Reflector, reflect_dom_object}; -use dom::bindings::root::Root; +use dom::bindings::root::DomRoot; use dom::bindings::str::{DOMString, USVString}; use dom::globalscope::GlobalScope; use dom_struct::dom_struct; @@ -32,11 +32,11 @@ impl TextDecoder { } } - fn make_range_error() -> Fallible> { + fn make_range_error() -> Fallible> { Err(Error::Range("The given encoding is not supported.".to_owned())) } - pub fn new(global: &GlobalScope, encoding: EncodingRef, fatal: bool) -> Root { + pub fn new(global: &GlobalScope, encoding: EncodingRef, fatal: bool) -> DomRoot { reflect_dom_object(box TextDecoder::new_inherited(encoding, fatal), global, TextDecoderBinding::Wrap) @@ -46,7 +46,7 @@ impl TextDecoder { pub fn Constructor(global: &GlobalScope, label: DOMString, options: &TextDecoderBinding::TextDecoderOptions) - -> Fallible> { + -> Fallible> { let encoding = match encoding_from_whatwg_label(&label) { None => return TextDecoder::make_range_error(), Some(enc) => enc diff --git a/components/script/dom/textencoder.rs b/components/script/dom/textencoder.rs index cb557861d1cf..765024522388 100644 --- a/components/script/dom/textencoder.rs +++ b/components/script/dom/textencoder.rs @@ -7,7 +7,7 @@ use dom::bindings::codegen::Bindings::TextEncoderBinding; use dom::bindings::codegen::Bindings::TextEncoderBinding::TextEncoderMethods; use dom::bindings::error::Fallible; use dom::bindings::reflector::{Reflector, reflect_dom_object}; -use dom::bindings::root::Root; +use dom::bindings::root::DomRoot; use dom::bindings::str::{DOMString, USVString}; use dom::globalscope::GlobalScope; use dom_struct::dom_struct; @@ -27,14 +27,14 @@ impl TextEncoder { } } - pub fn new(global: &GlobalScope) -> Root { + pub fn new(global: &GlobalScope) -> DomRoot { reflect_dom_object(box TextEncoder::new_inherited(), global, TextEncoderBinding::Wrap) } // https://encoding.spec.whatwg.org/#dom-textencoder - pub fn Constructor(global: &GlobalScope) -> Fallible> { + pub fn Constructor(global: &GlobalScope) -> Fallible> { Ok(TextEncoder::new(global)) } } diff --git a/components/script/dom/touch.rs b/components/script/dom/touch.rs index d526e607d8d1..e12fce6379c4 100644 --- a/components/script/dom/touch.rs +++ b/components/script/dom/touch.rs @@ -6,7 +6,7 @@ use dom::bindings::codegen::Bindings::TouchBinding; use dom::bindings::codegen::Bindings::TouchBinding::TouchMethods; use dom::bindings::num::Finite; use dom::bindings::reflector::{Reflector, reflect_dom_object}; -use dom::bindings::root::{MutDom, Root}; +use dom::bindings::root::{DomRoot, MutDom}; use dom::eventtarget::EventTarget; use dom::window::Window; use dom_struct::dom_struct; @@ -45,7 +45,7 @@ impl Touch { pub fn new(window: &Window, identifier: i32, target: &EventTarget, screen_x: Finite, screen_y: Finite, client_x: Finite, client_y: Finite, - page_x: Finite, page_y: Finite) -> Root { + page_x: Finite, page_y: Finite) -> DomRoot { reflect_dom_object(box Touch::new_inherited(identifier, target, screen_x, screen_y, client_x, client_y, @@ -62,7 +62,7 @@ impl TouchMethods for Touch { } /// https://w3c.github.io/touch-events/#widl-Touch-target - fn Target(&self) -> Root { + fn Target(&self) -> DomRoot { self.target.get() } diff --git a/components/script/dom/touchevent.rs b/components/script/dom/touchevent.rs index 92ff9bf04242..6a33b7f244ee 100644 --- a/components/script/dom/touchevent.rs +++ b/components/script/dom/touchevent.rs @@ -7,7 +7,7 @@ use dom::bindings::codegen::Bindings::TouchEventBinding::TouchEventMethods; use dom::bindings::codegen::Bindings::UIEventBinding::UIEventMethods; use dom::bindings::inheritance::Castable; use dom::bindings::reflector::reflect_dom_object; -use dom::bindings::root::{MutDom, Root}; +use dom::bindings::root::{DomRoot, MutDom}; use dom::bindings::str::DOMString; use dom::event::{EventBubbles, EventCancelable}; use dom::touchlist::TouchList; @@ -47,7 +47,7 @@ impl TouchEvent { pub fn new_uninitialized(window: &Window, touches: &TouchList, changed_touches: &TouchList, - target_touches: &TouchList) -> Root { + target_touches: &TouchList) -> DomRoot { reflect_dom_object(box TouchEvent::new_inherited(touches, changed_touches, target_touches), window, TouchEventBinding::Wrap) @@ -65,7 +65,7 @@ impl TouchEvent { ctrl_key: bool, alt_key: bool, shift_key: bool, - meta_key: bool) -> Root { + meta_key: bool) -> DomRoot { let ev = TouchEvent::new_uninitialized(window, touches, changed_touches, target_touches); ev.upcast::().InitUIEvent(type_, bool::from(can_bubble), @@ -101,17 +101,17 @@ impl<'a> TouchEventMethods for &'a TouchEvent { } /// https://w3c.github.io/touch-events/#widl-TouchEventInit-touches - fn Touches(&self) -> Root { + fn Touches(&self) -> DomRoot { self.touches.get() } /// https://w3c.github.io/touch-events/#widl-TouchEvent-targetTouches - fn TargetTouches(&self) -> Root { + fn TargetTouches(&self) -> DomRoot { self.target_touches.get() } /// https://w3c.github.io/touch-events/#widl-TouchEvent-changedTouches - fn ChangedTouches(&self) -> Root { + fn ChangedTouches(&self) -> DomRoot { self.changed_touches.get() } diff --git a/components/script/dom/touchlist.rs b/components/script/dom/touchlist.rs index c07b583619e6..8881bec0faac 100644 --- a/components/script/dom/touchlist.rs +++ b/components/script/dom/touchlist.rs @@ -5,7 +5,7 @@ use dom::bindings::codegen::Bindings::TouchListBinding; use dom::bindings::codegen::Bindings::TouchListBinding::TouchListMethods; use dom::bindings::reflector::{Reflector, reflect_dom_object}; -use dom::bindings::root::{Dom, Root}; +use dom::bindings::root::{Dom, DomRoot}; use dom::touch::Touch; use dom::window::Window; use dom_struct::dom_struct; @@ -24,7 +24,7 @@ impl TouchList { } } - pub fn new(window: &Window, touches: &[&Touch]) -> Root { + pub fn new(window: &Window, touches: &[&Touch]) -> DomRoot { reflect_dom_object(box TouchList::new_inherited(touches), window, TouchListBinding::Wrap) } @@ -37,12 +37,12 @@ impl TouchListMethods for TouchList { } /// https://w3c.github.io/touch-events/#widl-TouchList-item-getter-Touch-unsigned-long-index - fn Item(&self, index: u32) -> Option> { - self.touches.get(index as usize).map(|js| Root::from_ref(&**js)) + fn Item(&self, index: u32) -> Option> { + self.touches.get(index as usize).map(|js| DomRoot::from_ref(&**js)) } /// https://w3c.github.io/touch-events/#widl-TouchList-item-getter-Touch-unsigned-long-index - fn IndexedGetter(&self, index: u32) -> Option> { + fn IndexedGetter(&self, index: u32) -> Option> { self.Item(index) } } diff --git a/components/script/dom/transitionevent.rs b/components/script/dom/transitionevent.rs index 30870fba978d..7a3caea99ad6 100644 --- a/components/script/dom/transitionevent.rs +++ b/components/script/dom/transitionevent.rs @@ -9,7 +9,7 @@ use dom::bindings::error::Fallible; use dom::bindings::inheritance::Castable; use dom::bindings::num::Finite; use dom::bindings::reflector::reflect_dom_object; -use dom::bindings::root::Root; +use dom::bindings::root::DomRoot; use dom::bindings::str::DOMString; use dom::event::Event; use dom::window::Window; @@ -36,7 +36,7 @@ impl TransitionEvent { pub fn new(window: &Window, type_: Atom, - init: &TransitionEventInit) -> Root { + init: &TransitionEventInit) -> DomRoot { let ev = reflect_dom_object(box TransitionEvent::new_inherited(init), window, TransitionEventBinding::Wrap); @@ -49,7 +49,7 @@ impl TransitionEvent { pub fn Constructor(window: &Window, type_: DOMString, - init: &TransitionEventInit) -> Fallible> { + init: &TransitionEventInit) -> Fallible> { Ok(TransitionEvent::new(window, Atom::from(type_), init)) } } diff --git a/components/script/dom/treewalker.rs b/components/script/dom/treewalker.rs index 61a085aaa53e..b4cead438ffd 100644 --- a/components/script/dom/treewalker.rs +++ b/components/script/dom/treewalker.rs @@ -10,7 +10,7 @@ use dom::bindings::codegen::Bindings::TreeWalkerBinding; use dom::bindings::codegen::Bindings::TreeWalkerBinding::TreeWalkerMethods; use dom::bindings::error::Fallible; use dom::bindings::reflector::{Reflector, reflect_dom_object}; -use dom::bindings::root::{Dom, MutDom, Root}; +use dom::bindings::root::{Dom, DomRoot, MutDom}; use dom::document::Document; use dom::node::Node; use dom_struct::dom_struct; @@ -43,7 +43,7 @@ impl TreeWalker { pub fn new_with_filter(document: &Document, root_node: &Node, what_to_show: u32, - filter: Filter) -> Root { + filter: Filter) -> DomRoot { reflect_dom_object(box TreeWalker::new_inherited(root_node, what_to_show, filter), document.window(), TreeWalkerBinding::Wrap) @@ -52,7 +52,7 @@ impl TreeWalker { pub fn new(document: &Document, root_node: &Node, what_to_show: u32, - node_filter: Option>) -> Root { + node_filter: Option>) -> DomRoot { let filter = match node_filter { None => Filter::None, Some(jsfilter) => Filter::Dom(jsfilter) @@ -63,8 +63,8 @@ impl TreeWalker { impl TreeWalkerMethods for TreeWalker { // https://dom.spec.whatwg.org/#dom-treewalker-root - fn Root(&self) -> Root { - Root::from_ref(&*self.root_node) + fn Root(&self) -> DomRoot { + DomRoot::from_ref(&*self.root_node) } // https://dom.spec.whatwg.org/#dom-treewalker-whattoshow @@ -82,7 +82,7 @@ impl TreeWalkerMethods for TreeWalker { } // https://dom.spec.whatwg.org/#dom-treewalker-currentnode - fn CurrentNode(&self) -> Root { + fn CurrentNode(&self) -> DomRoot { self.current_node.get() } @@ -92,7 +92,7 @@ impl TreeWalkerMethods for TreeWalker { } // https://dom.spec.whatwg.org/#dom-treewalker-parentnode - fn ParentNode(&self) -> Fallible>> { + fn ParentNode(&self) -> Fallible>> { // "1. Let node be the value of the currentNode attribute." let mut node = self.current_node.get(); // "2. While node is not null and is not root, run these substeps:" @@ -116,35 +116,35 @@ impl TreeWalkerMethods for TreeWalker { } // https://dom.spec.whatwg.org/#dom-treewalker-firstchild - fn FirstChild(&self) -> Fallible>> { + fn FirstChild(&self) -> Fallible>> { // "The firstChild() method must traverse children of type first." self.traverse_children(|node| node.GetFirstChild(), |node| node.GetNextSibling()) } // https://dom.spec.whatwg.org/#dom-treewalker-lastchild - fn LastChild(&self) -> Fallible>> { + fn LastChild(&self) -> Fallible>> { // "The lastChild() method must traverse children of type last." self.traverse_children(|node| node.GetLastChild(), |node| node.GetPreviousSibling()) } // https://dom.spec.whatwg.org/#dom-treewalker-previoussibling - fn PreviousSibling(&self) -> Fallible>> { + fn PreviousSibling(&self) -> Fallible>> { // "The nextSibling() method must traverse siblings of type next." self.traverse_siblings(|node| node.GetLastChild(), |node| node.GetPreviousSibling()) } // https://dom.spec.whatwg.org/#dom-treewalker-nextsibling - fn NextSibling(&self) -> Fallible>> { + fn NextSibling(&self) -> Fallible>> { // "The previousSibling() method must traverse siblings of type previous." self.traverse_siblings(|node| node.GetFirstChild(), |node| node.GetNextSibling()) } // https://dom.spec.whatwg.org/#dom-treewalker-previousnode - fn PreviousNode(&self) -> Fallible>> { + fn PreviousNode(&self) -> Fallible>> { // "1. Let node be the value of the currentNode attribute." let mut node = self.current_node.get(); // "2. While node is not root, run these substeps:" @@ -201,7 +201,7 @@ impl TreeWalkerMethods for TreeWalker { } // https://dom.spec.whatwg.org/#dom-treewalker-nextnode - fn NextNode(&self) -> Fallible>> { + fn NextNode(&self) -> Fallible>> { // "1. Let node be the value of the currentNode attribute." let mut node = self.current_node.get(); // "2. Let result be FILTER_ACCEPT." @@ -256,9 +256,9 @@ impl TreeWalker { fn traverse_children(&self, next_child: F, next_sibling: G) - -> Fallible>> - where F: Fn(&Node) -> Option>, - G: Fn(&Node) -> Option> + -> Fallible>> + where F: Fn(&Node) -> Option>, + G: Fn(&Node) -> Option> { // "To **traverse children** of type *type*, run these steps:" // "1. Let node be the value of the currentNode attribute." @@ -280,7 +280,7 @@ impl TreeWalker { // attribute to node and return node." NodeFilterConstants::FILTER_ACCEPT => { self.current_node.set(&node); - return Ok(Some(Root::from_ref(&node))) + return Ok(Some(DomRoot::from_ref(&node))) }, // "3. If result is FILTER_SKIP, run these subsubsteps:" NodeFilterConstants::FILTER_SKIP => { @@ -328,9 +328,9 @@ impl TreeWalker { fn traverse_siblings(&self, next_child: F, next_sibling: G) - -> Fallible>> - where F: Fn(&Node) -> Option>, - G: Fn(&Node) -> Option> + -> Fallible>> + where F: Fn(&Node) -> Option>, + G: Fn(&Node) -> Option> { // "To **traverse siblings** of type *type* run these steps:" // "1. Let node be the value of the currentNode attribute." @@ -388,12 +388,12 @@ impl TreeWalker { // https://dom.spec.whatwg.org/#concept-tree-following fn first_following_node_not_following_root(&self, node: &Node) - -> Option> { + -> Option> { // "An object A is following an object B if A and B are in the same tree // and A comes after B in tree order." match node.GetNextSibling() { None => { - let mut candidate = Root::from_ref(node); + let mut candidate = DomRoot::from_ref(node); while !self.is_root_node(&candidate) && candidate.GetNextSibling().is_none() { match candidate.GetParentNode() { None => @@ -444,9 +444,9 @@ impl TreeWalker { } impl<'a> Iterator for &'a TreeWalker { - type Item = Root; + type Item = DomRoot; - fn next(&mut self) -> Option> { + fn next(&mut self) -> Option> { match self.NextNode() { Ok(node) => node, Err(_) => diff --git a/components/script/dom/uievent.rs b/components/script/dom/uievent.rs index d799b979245a..6d54a48a0cd3 100644 --- a/components/script/dom/uievent.rs +++ b/components/script/dom/uievent.rs @@ -8,7 +8,7 @@ use dom::bindings::codegen::Bindings::UIEventBinding::UIEventMethods; use dom::bindings::error::Fallible; use dom::bindings::inheritance::Castable; use dom::bindings::reflector::reflect_dom_object; -use dom::bindings::root::{MutNullableDom, Root, RootedReference}; +use dom::bindings::root::{DomRoot, MutNullableDom, RootedReference}; use dom::bindings::str::DOMString; use dom::event::{Event, EventBubbles, EventCancelable}; use dom::window::Window; @@ -34,7 +34,7 @@ impl UIEvent { } } - pub fn new_uninitialized(window: &Window) -> Root { + pub fn new_uninitialized(window: &Window) -> DomRoot { reflect_dom_object(box UIEvent::new_inherited(), window, UIEventBinding::Wrap) @@ -45,7 +45,7 @@ impl UIEvent { can_bubble: EventBubbles, cancelable: EventCancelable, view: Option<&Window>, - detail: i32) -> Root { + detail: i32) -> DomRoot { let ev = UIEvent::new_uninitialized(window); ev.InitUIEvent(type_, bool::from(can_bubble), bool::from(cancelable), view, detail); ev @@ -53,7 +53,7 @@ impl UIEvent { pub fn Constructor(window: &Window, type_: DOMString, - init: &UIEventBinding::UIEventInit) -> Fallible> { + init: &UIEventBinding::UIEventInit) -> Fallible> { let bubbles = EventBubbles::from(init.parent.bubbles); let cancelable = EventCancelable::from(init.parent.cancelable); let event = UIEvent::new(window, @@ -66,7 +66,7 @@ impl UIEvent { impl UIEventMethods for UIEvent { // https://w3c.github.io/uievents/#widl-UIEvent-view - fn GetView(&self) -> Option> { + fn GetView(&self) -> Option> { self.view.get() } diff --git a/components/script/dom/url.rs b/components/script/dom/url.rs index 73832c4e5a47..9134f0cc104d 100644 --- a/components/script/dom/url.rs +++ b/components/script/dom/url.rs @@ -6,7 +6,7 @@ use dom::bindings::cell::DomRefCell; use dom::bindings::codegen::Bindings::URLBinding::{self, URLMethods}; use dom::bindings::error::{Error, ErrorResult, Fallible}; use dom::bindings::reflector::{DomObject, Reflector, reflect_dom_object}; -use dom::bindings::root::{MutNullableDom, Root}; +use dom::bindings::root::{DomRoot, MutNullableDom}; use dom::bindings::str::{DOMString, USVString}; use dom::blob::Blob; use dom::globalscope::GlobalScope; @@ -42,7 +42,7 @@ impl URL { } } - pub fn new(global: &GlobalScope, url: ServoUrl) -> Root { + pub fn new(global: &GlobalScope, url: ServoUrl) -> DomRoot { reflect_dom_object(box URL::new_inherited(url), global, URLBinding::Wrap) } @@ -61,7 +61,7 @@ impl URL { // https://url.spec.whatwg.org/#constructors pub fn Constructor(global: &GlobalScope, url: USVString, base: Option) - -> Fallible> { + -> Fallible> { let parsed_base = match base { None => { // Step 1. @@ -254,7 +254,7 @@ impl URLMethods for URL { } // https://url.spec.whatwg.org/#dom-url-searchparams - fn SearchParams(&self) -> Root { + fn SearchParams(&self) -> DomRoot { self.search_params.or_init(|| { URLSearchParams::new(&self.global(), Some(self)) }) diff --git a/components/script/dom/urlsearchparams.rs b/components/script/dom/urlsearchparams.rs index 6ac19c05db7c..c5eef3d7837c 100644 --- a/components/script/dom/urlsearchparams.rs +++ b/components/script/dom/urlsearchparams.rs @@ -9,7 +9,7 @@ use dom::bindings::codegen::UnionTypes::USVStringOrURLSearchParams; use dom::bindings::error::Fallible; use dom::bindings::iterable::Iterable; use dom::bindings::reflector::{Reflector, reflect_dom_object}; -use dom::bindings::root::Root; +use dom::bindings::root::DomRoot; use dom::bindings::str::{DOMString, USVString}; use dom::bindings::weakref::MutableWeakRef; use dom::globalscope::GlobalScope; @@ -37,14 +37,14 @@ impl URLSearchParams { } } - pub fn new(global: &GlobalScope, url: Option<&URL>) -> Root { + pub fn new(global: &GlobalScope, url: Option<&URL>) -> DomRoot { reflect_dom_object(box URLSearchParams::new_inherited(url), global, URLSearchParamsWrap) } // https://url.spec.whatwg.org/#dom-urlsearchparams-urlsearchparams pub fn Constructor(global: &GlobalScope, init: Option) -> - Fallible> { + Fallible> { // Step 1. let query = URLSearchParams::new(global, None); match init { diff --git a/components/script/dom/validitystate.rs b/components/script/dom/validitystate.rs index 80dead5c66f5..d99eba8c1095 100755 --- a/components/script/dom/validitystate.rs +++ b/components/script/dom/validitystate.rs @@ -5,7 +5,7 @@ use dom::bindings::codegen::Bindings::ValidityStateBinding; use dom::bindings::codegen::Bindings::ValidityStateBinding::ValidityStateMethods; use dom::bindings::reflector::{Reflector, reflect_dom_object}; -use dom::bindings::root::{Dom, Root}; +use dom::bindings::root::{Dom, DomRoot}; use dom::element::Element; use dom::window::Window; use dom_struct::dom_struct; @@ -60,7 +60,7 @@ impl ValidityState { } } - pub fn new(window: &Window, element: &Element) -> Root { + pub fn new(window: &Window, element: &Element) -> DomRoot { reflect_dom_object(box ValidityState::new_inherited(element), window, ValidityStateBinding::Wrap) diff --git a/components/script/dom/vr.rs b/components/script/dom/vr.rs index ea77bde63f84..d4b0429ebacc 100644 --- a/components/script/dom/vr.rs +++ b/components/script/dom/vr.rs @@ -9,7 +9,7 @@ use dom::bindings::codegen::Bindings::VRDisplayBinding::VRDisplayMethods; use dom::bindings::error::Error; use dom::bindings::inheritance::Castable; use dom::bindings::reflector::{DomObject, Reflector, reflect_dom_object}; -use dom::bindings::root::{Dom, Root}; +use dom::bindings::root::{Dom, DomRoot}; use dom::event::Event; use dom::eventtarget::EventTarget; use dom::gamepad::Gamepad; @@ -41,7 +41,7 @@ impl VR { } } - pub fn new(global: &GlobalScope) -> Root { + pub fn new(global: &GlobalScope) -> DomRoot { let root = reflect_dom_object(box VR::new_inherited(), global, VRBinding::Wrap); @@ -83,9 +83,9 @@ impl VRMethods for VR { return promise; } - // convert from Dom to Root - let displays: Vec> = self.displays.borrow().iter() - .map(|d| Root::from_ref(&**d)) + // convert from Dom to DomRoot + let displays: Vec> = self.displays.borrow().iter() + .map(|d| DomRoot::from_ref(&**d)) .collect(); promise.resolve_native(&displays); @@ -99,11 +99,11 @@ impl VR { self.global().as_window().webvr_thread() } - fn find_display(&self, display_id: u32) -> Option> { + fn find_display(&self, display_id: u32) -> Option> { self.displays.borrow() .iter() .find(|d| d.DisplayId() == display_id) - .map(|d| Root::from_ref(&**d)) + .map(|d| DomRoot::from_ref(&**d)) } fn register(&self) { @@ -120,7 +120,7 @@ impl VR { } } - fn sync_display(&self, display: &WebVRDisplayData) -> Root { + fn sync_display(&self, display: &WebVRDisplayData) -> DomRoot { if let Some(existing) = self.find_display(display.display_id) { existing.update_display(&display); existing @@ -206,11 +206,11 @@ impl VR { // Gamepad impl VR { - fn find_gamepad(&self, gamepad_id: u32) -> Option> { + fn find_gamepad(&self, gamepad_id: u32) -> Option> { self.gamepads.borrow() .iter() .find(|g| g.gamepad_id() == gamepad_id) - .map(|g| Root::from_ref(&**g)) + .map(|g| DomRoot::from_ref(&**g)) } fn sync_gamepad(&self, data: Option, state: &WebVRGamepadState) { @@ -234,7 +234,7 @@ impl VR { // The current approach allows the to sample gamepad state multiple times per frame. This // guarantees that the gamepads always have a valid state and can be very useful for // motion capture or drawing applications. - pub fn get_gamepads(&self) -> Vec> { + pub fn get_gamepads(&self) -> Vec> { if let Some(wevbr_sender) = self.webvr_thread() { let (sender, receiver) = ipc::channel().unwrap(); let synced_ids = self.gamepads.borrow().iter().map(|g| g.gamepad_id()).collect(); @@ -252,7 +252,7 @@ impl VR { // We can add other not VR related gamepad providers here self.gamepads.borrow().iter() - .map(|g| Root::from_ref(&**g)) + .map(|g| DomRoot::from_ref(&**g)) .collect() } } diff --git a/components/script/dom/vrdisplay.rs b/components/script/dom/vrdisplay.rs index 81399b894e9e..d8457d468008 100644 --- a/components/script/dom/vrdisplay.rs +++ b/components/script/dom/vrdisplay.rs @@ -18,7 +18,7 @@ use dom::bindings::inheritance::Castable; use dom::bindings::num::Finite; use dom::bindings::refcounted::Trusted; use dom::bindings::reflector::{DomObject, reflect_dom_object}; -use dom::bindings::root::{MutDom, MutNullableDom, Root}; +use dom::bindings::root::{DomRoot, MutDom, MutNullableDom}; use dom::bindings::str::DOMString; use dom::event::Event; use dom::eventtarget::EventTarget; @@ -121,7 +121,7 @@ impl VRDisplay { } } - pub fn new(global: &GlobalScope, display: WebVRDisplayData) -> Root { + pub fn new(global: &GlobalScope, display: WebVRDisplayData) -> DomRoot { reflect_dom_object(box VRDisplay::new_inherited(&global, display), global, VRDisplayBinding::Wrap) @@ -148,20 +148,20 @@ impl VRDisplayMethods for VRDisplay { } // https://w3c.github.io/webvr/#dom-vrdisplay-capabilities - fn Capabilities(&self) -> Root { - Root::from_ref(&*self.capabilities.get()) + fn Capabilities(&self) -> DomRoot { + DomRoot::from_ref(&*self.capabilities.get()) } // https://w3c.github.io/webvr/#dom-vrdisplay-stageparameters - fn GetStageParameters(&self) -> Option> { - self.stage_params.get().map(|s| Root::from_ref(&*s)) + fn GetStageParameters(&self) -> Option> { + self.stage_params.get().map(|s| DomRoot::from_ref(&*s)) } // https://w3c.github.io/webvr/#dom-vrdisplay-geteyeparameters - fn GetEyeParameters(&self, eye: VREye) -> Root { + fn GetEyeParameters(&self, eye: VREye) -> DomRoot { match eye { - VREye::Left => Root::from_ref(&*self.left_eye_params.get()), - VREye::Right => Root::from_ref(&*self.right_eye_params.get()) + VREye::Left => DomRoot::from_ref(&*self.left_eye_params.get()), + VREye::Right => DomRoot::from_ref(&*self.right_eye_params.get()) } } @@ -211,7 +211,7 @@ impl VRDisplayMethods for VRDisplay { } // https://w3c.github.io/webvr/#dom-vrdisplay-getpose - fn GetPose(&self) -> Root { + fn GetPose(&self) -> DomRoot { VRPose::new(&self.global(), &self.frame_data.borrow().pose) } @@ -478,7 +478,7 @@ impl VRDisplay { } fn notify_event(&self, event: &WebVRDisplayEvent) { - let root = Root::from_ref(&*self); + let root = DomRoot::from_ref(&*self); let event = VRDisplayEvent::new_from_webvr(&self.global(), &root, &event); event.upcast::().fire(self.global().upcast::()); } @@ -630,7 +630,7 @@ fn parse_bounds(src: &Option>>, dst: &mut [f32; 4]) -> Result<() fn validate_layer(cx: *mut JSContext, layer: &VRLayer) - -> Result<(WebVRLayer, Root), &'static str> { + -> Result<(WebVRLayer, DomRoot), &'static str> { let ctx = layer.source.as_ref().map(|ref s| s.get_or_init_webgl_context(cx, None)).unwrap_or(None); if let Some(ctx) = ctx { let mut data = WebVRLayer::default(); diff --git a/components/script/dom/vrdisplaycapabilities.rs b/components/script/dom/vrdisplaycapabilities.rs index 340a29428208..bf16b0cbf4f1 100644 --- a/components/script/dom/vrdisplaycapabilities.rs +++ b/components/script/dom/vrdisplaycapabilities.rs @@ -6,7 +6,7 @@ use dom::bindings::cell::DomRefCell; use dom::bindings::codegen::Bindings::VRDisplayCapabilitiesBinding; use dom::bindings::codegen::Bindings::VRDisplayCapabilitiesBinding::VRDisplayCapabilitiesMethods; use dom::bindings::reflector::{Reflector, reflect_dom_object}; -use dom::bindings::root::Root; +use dom::bindings::root::DomRoot; use dom::globalscope::GlobalScope; use dom_struct::dom_struct; use webvr_traits::WebVRDisplayCapabilities; @@ -28,7 +28,7 @@ impl VRDisplayCapabilities { } } - pub fn new(capabilities: WebVRDisplayCapabilities, global: &GlobalScope) -> Root { + pub fn new(capabilities: WebVRDisplayCapabilities, global: &GlobalScope) -> DomRoot { reflect_dom_object(box VRDisplayCapabilities::new_inherited(capabilities), global, VRDisplayCapabilitiesBinding::Wrap) diff --git a/components/script/dom/vrdisplayevent.rs b/components/script/dom/vrdisplayevent.rs index b7c2a940f6d0..26072b499c5c 100644 --- a/components/script/dom/vrdisplayevent.rs +++ b/components/script/dom/vrdisplayevent.rs @@ -9,7 +9,7 @@ use dom::bindings::codegen::Bindings::VRDisplayEventBinding::VRDisplayEventReaso use dom::bindings::error::Fallible; use dom::bindings::inheritance::Castable; use dom::bindings::reflector::{DomObject, reflect_dom_object}; -use dom::bindings::root::{Dom, Root}; +use dom::bindings::root::{Dom, DomRoot}; use dom::bindings::str::DOMString; use dom::event::Event; use dom::globalscope::GlobalScope; @@ -43,7 +43,7 @@ impl VRDisplayEvent { cancelable: bool, display: &VRDisplay, reason: Option) - -> Root { + -> DomRoot { let ev = reflect_dom_object(box VRDisplayEvent::new_inherited(&display, reason), global, VRDisplayEventBinding::Wrap); @@ -57,7 +57,7 @@ impl VRDisplayEvent { pub fn new_from_webvr(global: &GlobalScope, display: &VRDisplay, event: &WebVRDisplayEvent) - -> Root { + -> DomRoot { let (name, reason) = match *event { WebVRDisplayEvent::Connect(_) => ("vrdisplayconnect", None), WebVRDisplayEvent::Disconnect(_) => ("vrdisplaydisconnect", None), @@ -94,7 +94,7 @@ impl VRDisplayEvent { pub fn Constructor(window: &Window, type_: DOMString, init: &VRDisplayEventBinding::VRDisplayEventInit) - -> Fallible> { + -> Fallible> { Ok(VRDisplayEvent::new(&window.global(), Atom::from(type_), init.parent.bubbles, @@ -106,8 +106,8 @@ impl VRDisplayEvent { impl VRDisplayEventMethods for VRDisplayEvent { // https://w3c.github.io/webvr/#dom-vrdisplayevent-display - fn Display(&self) -> Root { - Root::from_ref(&*self.display) + fn Display(&self) -> DomRoot { + DomRoot::from_ref(&*self.display) } // https://w3c.github.io/webvr/#enumdef-vrdisplayeventreason diff --git a/components/script/dom/vreyeparameters.rs b/components/script/dom/vreyeparameters.rs index 337f70d2b464..5db556cdf073 100644 --- a/components/script/dom/vreyeparameters.rs +++ b/components/script/dom/vreyeparameters.rs @@ -7,7 +7,7 @@ use dom::bindings::cell::DomRefCell; use dom::bindings::codegen::Bindings::VREyeParametersBinding; use dom::bindings::codegen::Bindings::VREyeParametersBinding::VREyeParametersMethods; use dom::bindings::reflector::{Reflector, reflect_dom_object}; -use dom::bindings::root::{Dom, Root}; +use dom::bindings::root::{Dom, DomRoot}; use dom::globalscope::GlobalScope; use dom::vrfieldofview::VRFieldOfView; use dom_struct::dom_struct; @@ -39,7 +39,7 @@ impl VREyeParameters { } #[allow(unsafe_code)] - pub fn new(parameters: WebVREyeParameters, global: &GlobalScope) -> Root { + pub fn new(parameters: WebVREyeParameters, global: &GlobalScope) -> DomRoot { let fov = VRFieldOfView::new(&global, parameters.field_of_view.clone()); let cx = global.get_cx(); @@ -65,8 +65,8 @@ impl VREyeParametersMethods for VREyeParameters { } // https://w3c.github.io/webvr/#dom-vreyeparameters-fieldofview - fn FieldOfView(&self) -> Root { - Root::from_ref(&*self.fov) + fn FieldOfView(&self) -> DomRoot { + DomRoot::from_ref(&*self.fov) } // https://w3c.github.io/webvr/#dom-vreyeparameters-renderwidth diff --git a/components/script/dom/vrfieldofview.rs b/components/script/dom/vrfieldofview.rs index 93f72bc77b5c..389c2edeef46 100644 --- a/components/script/dom/vrfieldofview.rs +++ b/components/script/dom/vrfieldofview.rs @@ -7,7 +7,7 @@ use dom::bindings::codegen::Bindings::VRFieldOfViewBinding; use dom::bindings::codegen::Bindings::VRFieldOfViewBinding::VRFieldOfViewMethods; use dom::bindings::num::Finite; use dom::bindings::reflector::{Reflector, reflect_dom_object}; -use dom::bindings::root::Root; +use dom::bindings::root::DomRoot; use dom::globalscope::GlobalScope; use dom_struct::dom_struct; use webvr_traits::WebVRFieldOfView; @@ -29,7 +29,7 @@ impl VRFieldOfView { } } - pub fn new(global: &GlobalScope, fov: WebVRFieldOfView) -> Root { + pub fn new(global: &GlobalScope, fov: WebVRFieldOfView) -> DomRoot { reflect_dom_object(box VRFieldOfView::new_inherited(fov), global, VRFieldOfViewBinding::Wrap) diff --git a/components/script/dom/vrframedata.rs b/components/script/dom/vrframedata.rs index c7ccf84f10e6..4ed95a2a4b40 100644 --- a/components/script/dom/vrframedata.rs +++ b/components/script/dom/vrframedata.rs @@ -8,7 +8,7 @@ use dom::bindings::codegen::Bindings::VRFrameDataBinding::VRFrameDataMethods; use dom::bindings::error::Fallible; use dom::bindings::num::Finite; use dom::bindings::reflector::{DomObject, Reflector, reflect_dom_object}; -use dom::bindings::root::{Dom, Root}; +use dom::bindings::root::{Dom, DomRoot}; use dom::globalscope::GlobalScope; use dom::vrpose::VRPose; use dom::window::Window; @@ -46,7 +46,7 @@ impl VRFrameData { } #[allow(unsafe_code)] - fn new(global: &GlobalScope) -> Root { + fn new(global: &GlobalScope) -> DomRoot { let matrix = [1.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, @@ -65,7 +65,7 @@ impl VRFrameData { root } - pub fn Constructor(window: &Window) -> Fallible> { + pub fn Constructor(window: &Window) -> Fallible> { Ok(VRFrameData::new(&window.global())) } } @@ -141,7 +141,7 @@ impl VRFrameDataMethods for VRFrameData { } // https://w3c.github.io/webvr/#dom-vrframedata-pose - fn Pose(&self) -> Root { - Root::from_ref(&*self.pose) + fn Pose(&self) -> DomRoot { + DomRoot::from_ref(&*self.pose) } } diff --git a/components/script/dom/vrpose.rs b/components/script/dom/vrpose.rs index fb41149cd830..d80a4c5a0498 100644 --- a/components/script/dom/vrpose.rs +++ b/components/script/dom/vrpose.rs @@ -6,7 +6,7 @@ use core::nonzero::NonZero; use dom::bindings::codegen::Bindings::VRPoseBinding; use dom::bindings::codegen::Bindings::VRPoseBinding::VRPoseMethods; use dom::bindings::reflector::{DomObject, Reflector, reflect_dom_object}; -use dom::bindings::root::Root; +use dom::bindings::root::DomRoot; use dom::globalscope::GlobalScope; use dom_struct::dom_struct; use js::jsapi::{Heap, JSContext, JSObject}; @@ -76,7 +76,7 @@ impl VRPose { } } - pub fn new(global: &GlobalScope, pose: &webvr::VRPose) -> Root { + pub fn new(global: &GlobalScope, pose: &webvr::VRPose) -> DomRoot { let root = reflect_dom_object(box VRPose::new_inherited(), global, VRPoseBinding::Wrap); diff --git a/components/script/dom/vrstageparameters.rs b/components/script/dom/vrstageparameters.rs index c2731d1193bc..d7287249a89c 100644 --- a/components/script/dom/vrstageparameters.rs +++ b/components/script/dom/vrstageparameters.rs @@ -8,7 +8,7 @@ use dom::bindings::codegen::Bindings::VRStageParametersBinding; use dom::bindings::codegen::Bindings::VRStageParametersBinding::VRStageParametersMethods; use dom::bindings::num::Finite; use dom::bindings::reflector::{DomObject, Reflector, reflect_dom_object}; -use dom::bindings::root::Root; +use dom::bindings::root::DomRoot; use dom::globalscope::GlobalScope; use dom_struct::dom_struct; use js::jsapi::{Heap, JSContext, JSObject}; @@ -36,7 +36,7 @@ impl VRStageParameters { } #[allow(unsafe_code)] - pub fn new(parameters: WebVRStageParameters, global: &GlobalScope) -> Root { + pub fn new(parameters: WebVRStageParameters, global: &GlobalScope) -> DomRoot { let cx = global.get_cx(); rooted!(in (cx) let mut array = ptr::null_mut()); unsafe { diff --git a/components/script/dom/webgl_extensions/ext/oesstandardderivatives.rs b/components/script/dom/webgl_extensions/ext/oesstandardderivatives.rs index 1d2ccb34d9ff..3740db147513 100644 --- a/components/script/dom/webgl_extensions/ext/oesstandardderivatives.rs +++ b/components/script/dom/webgl_extensions/ext/oesstandardderivatives.rs @@ -5,7 +5,7 @@ use dom::bindings::codegen::Bindings::OESStandardDerivativesBinding; use dom::bindings::codegen::Bindings::OESStandardDerivativesBinding::OESStandardDerivativesConstants; use dom::bindings::reflector::{DomObject, Reflector, reflect_dom_object}; -use dom::bindings::root::Root; +use dom::bindings::root::DomRoot; use dom::webglrenderingcontext::WebGLRenderingContext; use dom_struct::dom_struct; use super::{WebGLExtension, WebGLExtensions}; @@ -25,7 +25,7 @@ impl OESStandardDerivatives { impl WebGLExtension for OESStandardDerivatives { type Extension = OESStandardDerivatives; - fn new(ctx: &WebGLRenderingContext) -> Root { + fn new(ctx: &WebGLRenderingContext) -> DomRoot { reflect_dom_object(box OESStandardDerivatives::new_inherited(), &*ctx.global(), OESStandardDerivativesBinding::Wrap) diff --git a/components/script/dom/webgl_extensions/ext/oestexturefloat.rs b/components/script/dom/webgl_extensions/ext/oestexturefloat.rs index c048b2d7f847..967df546cc9c 100644 --- a/components/script/dom/webgl_extensions/ext/oestexturefloat.rs +++ b/components/script/dom/webgl_extensions/ext/oestexturefloat.rs @@ -4,7 +4,7 @@ use dom::bindings::codegen::Bindings::OESTextureFloatBinding; use dom::bindings::reflector::{DomObject, Reflector, reflect_dom_object}; -use dom::bindings::root::Root; +use dom::bindings::root::DomRoot; use dom::webglrenderingcontext::WebGLRenderingContext; use dom_struct::dom_struct; use super::{constants as webgl, ext_constants as gl, WebGLExtension, WebGLExtensions}; @@ -24,7 +24,7 @@ impl OESTextureFloat { impl WebGLExtension for OESTextureFloat { type Extension = OESTextureFloat; - fn new(ctx: &WebGLRenderingContext) -> Root { + fn new(ctx: &WebGLRenderingContext) -> DomRoot { reflect_dom_object(box OESTextureFloat::new_inherited(), &*ctx.global(), OESTextureFloatBinding::Wrap) diff --git a/components/script/dom/webgl_extensions/ext/oestexturefloatlinear.rs b/components/script/dom/webgl_extensions/ext/oestexturefloatlinear.rs index 12d04195a593..2a730f2e85fd 100644 --- a/components/script/dom/webgl_extensions/ext/oestexturefloatlinear.rs +++ b/components/script/dom/webgl_extensions/ext/oestexturefloatlinear.rs @@ -4,7 +4,7 @@ use dom::bindings::codegen::Bindings::OESTextureFloatLinearBinding; use dom::bindings::reflector::{DomObject, Reflector, reflect_dom_object}; -use dom::bindings::root::Root; +use dom::bindings::root::DomRoot; use dom::webglrenderingcontext::WebGLRenderingContext; use dom_struct::dom_struct; use super::{constants as webgl, WebGLExtension, WebGLExtensions}; @@ -24,7 +24,7 @@ impl OESTextureFloatLinear { impl WebGLExtension for OESTextureFloatLinear { type Extension = OESTextureFloatLinear; - fn new(ctx: &WebGLRenderingContext) -> Root { + fn new(ctx: &WebGLRenderingContext) -> DomRoot { reflect_dom_object(box OESTextureFloatLinear::new_inherited(), &*ctx.global(), OESTextureFloatLinearBinding::Wrap) diff --git a/components/script/dom/webgl_extensions/ext/oestexturehalffloat.rs b/components/script/dom/webgl_extensions/ext/oestexturehalffloat.rs index 15a9fad531e1..f5db59e097df 100644 --- a/components/script/dom/webgl_extensions/ext/oestexturehalffloat.rs +++ b/components/script/dom/webgl_extensions/ext/oestexturehalffloat.rs @@ -4,7 +4,7 @@ use dom::bindings::codegen::Bindings::OESTextureHalfFloatBinding::{self, OESTextureHalfFloatConstants}; use dom::bindings::reflector::{DomObject, Reflector, reflect_dom_object}; -use dom::bindings::root::Root; +use dom::bindings::root::DomRoot; use dom::webglrenderingcontext::WebGLRenderingContext; use dom_struct::dom_struct; use super::{constants as webgl, ext_constants as gl, WebGLExtension, WebGLExtensions}; @@ -24,7 +24,7 @@ impl OESTextureHalfFloat { impl WebGLExtension for OESTextureHalfFloat { type Extension = OESTextureHalfFloat; - fn new(ctx: &WebGLRenderingContext) -> Root { + fn new(ctx: &WebGLRenderingContext) -> DomRoot { reflect_dom_object(box OESTextureHalfFloat::new_inherited(), &*ctx.global(), OESTextureHalfFloatBinding::Wrap) diff --git a/components/script/dom/webgl_extensions/ext/oestexturehalffloatlinear.rs b/components/script/dom/webgl_extensions/ext/oestexturehalffloatlinear.rs index afaeedd5a0c0..52f15ada5c2d 100644 --- a/components/script/dom/webgl_extensions/ext/oestexturehalffloatlinear.rs +++ b/components/script/dom/webgl_extensions/ext/oestexturehalffloatlinear.rs @@ -5,7 +5,7 @@ use dom::bindings::codegen::Bindings::OESTextureHalfFloatBinding::OESTextureHalfFloatConstants; use dom::bindings::codegen::Bindings::OESTextureHalfFloatLinearBinding; use dom::bindings::reflector::{DomObject, Reflector, reflect_dom_object}; -use dom::bindings::root::Root; +use dom::bindings::root::DomRoot; use dom::webglrenderingcontext::WebGLRenderingContext; use dom_struct::dom_struct; use super::{WebGLExtension, WebGLExtensions}; @@ -25,7 +25,7 @@ impl OESTextureHalfFloatLinear { impl WebGLExtension for OESTextureHalfFloatLinear { type Extension = OESTextureHalfFloatLinear; - fn new(ctx: &WebGLRenderingContext) -> Root { + fn new(ctx: &WebGLRenderingContext) -> DomRoot { reflect_dom_object(box OESTextureHalfFloatLinear::new_inherited(), &*ctx.global(), OESTextureHalfFloatLinearBinding::Wrap) diff --git a/components/script/dom/webgl_extensions/ext/oesvertexarrayobject.rs b/components/script/dom/webgl_extensions/ext/oesvertexarrayobject.rs index 00c9d1abdda0..cf2f3ab0f506 100644 --- a/components/script/dom/webgl_extensions/ext/oesvertexarrayobject.rs +++ b/components/script/dom/webgl_extensions/ext/oesvertexarrayobject.rs @@ -6,7 +6,7 @@ use canvas_traits::webgl::{webgl_channel, WebGLCommand, WebGLError}; use dom::bindings::codegen::Bindings::OESVertexArrayObjectBinding::{self, OESVertexArrayObjectMethods}; use dom::bindings::codegen::Bindings::OESVertexArrayObjectBinding::OESVertexArrayObjectConstants; use dom::bindings::reflector::{DomObject, Reflector, reflect_dom_object}; -use dom::bindings::root::{Dom, MutNullableDom, Root}; +use dom::bindings::root::{Dom, DomRoot, MutNullableDom}; use dom::webglrenderingcontext::WebGLRenderingContext; use dom::webglvertexarrayobjectoes::WebGLVertexArrayObjectOES; use dom_struct::dom_struct; @@ -46,7 +46,7 @@ impl OESVertexArrayObject { impl OESVertexArrayObjectMethods for OESVertexArrayObject { // https://www.khronos.org/registry/webgl/extensions/OES_vertex_array_object/ - fn CreateVertexArrayOES(&self) -> Option> { + fn CreateVertexArrayOES(&self) -> Option> { let (sender, receiver) = webgl_channel().unwrap(); self.ctx.send_command(WebGLCommand::CreateVertexArray(sender)); @@ -132,7 +132,7 @@ impl OESVertexArrayObjectMethods for OESVertexArrayObject { impl WebGLExtension for OESVertexArrayObject { type Extension = OESVertexArrayObject; - fn new(ctx: &WebGLRenderingContext) -> Root { + fn new(ctx: &WebGLRenderingContext) -> DomRoot { reflect_dom_object(box OESVertexArrayObject::new_inherited(ctx), &*ctx.global(), OESVertexArrayObjectBinding::Wrap) diff --git a/components/script/dom/webgl_extensions/ext/webglvertexarrayobjectoes.rs b/components/script/dom/webgl_extensions/ext/webglvertexarrayobjectoes.rs index cdbe9f2e2e81..8433b3453281 100644 --- a/components/script/dom/webgl_extensions/ext/webglvertexarrayobjectoes.rs +++ b/components/script/dom/webgl_extensions/ext/webglvertexarrayobjectoes.rs @@ -8,7 +8,7 @@ use core::iter::FromIterator; use dom::bindings::cell::DomRefCell; use dom::bindings::codegen::Bindings::WebGLVertexArrayObjectOESBinding; use dom::bindings::reflector::reflect_dom_object; -use dom::bindings::root::{Dom, MutNullableDom, Root}; +use dom::bindings::root::{Dom, DomRoot, MutNullableDom}; use dom::globalscope::GlobalScope; use dom::webglbuffer::WebGLBuffer; use dom::webglobject::WebGLObject; @@ -38,7 +38,7 @@ impl WebGLVertexArrayObjectOES { } } - pub fn new(global: &GlobalScope, id: WebGLVertexArrayId) -> Root { + pub fn new(global: &GlobalScope, id: WebGLVertexArrayId) -> DomRoot { reflect_dom_object(box WebGLVertexArrayObjectOES::new_inherited(id), global, WebGLVertexArrayObjectOESBinding::Wrap) @@ -68,15 +68,15 @@ impl WebGLVertexArrayObjectOES { self.bound_attrib_buffers.borrow() } - pub fn bound_attrib_buffers(&self) -> Vec> { - self.bound_attrib_buffers.borrow().iter().map(|(_, b)| Root::from_ref(&**b)).collect() + pub fn bound_attrib_buffers(&self) -> Vec> { + self.bound_attrib_buffers.borrow().iter().map(|(_, b)| DomRoot::from_ref(&**b)).collect() } pub fn set_bound_attrib_buffers<'a, T>(&self, iter: T) where T: Iterator { *self.bound_attrib_buffers.borrow_mut() = HashMap::from_iter(iter.map(|(k,v)| (k, Dom::from_ref(v)))); } - pub fn bound_buffer_element_array(&self) -> Option> { + pub fn bound_buffer_element_array(&self) -> Option> { self.bound_buffer_element_array.get() } diff --git a/components/script/dom/webgl_extensions/extension.rs b/components/script/dom/webgl_extensions/extension.rs index 7cb4e5b4d257..6b4a28153472 100644 --- a/components/script/dom/webgl_extensions/extension.rs +++ b/components/script/dom/webgl_extensions/extension.rs @@ -3,7 +3,7 @@ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ use dom::bindings::reflector::DomObject; -use dom::bindings::root::Root; +use dom::bindings::root::DomRoot; use dom::bindings::trace::JSTraceable; use dom::webglrenderingcontext::WebGLRenderingContext; use super::WebGLExtensions; @@ -13,7 +13,7 @@ pub trait WebGLExtension: Sized where Self::Extension: DomObject + JSTraceable { type Extension; /// Creates the DOM object of the WebGL extension. - fn new(ctx: &WebGLRenderingContext) -> Root; + fn new(ctx: &WebGLRenderingContext) -> DomRoot; /// Checks if the extension is supported. fn is_supported(ext: &WebGLExtensions) -> bool; diff --git a/components/script/dom/webgl_extensions/extensions.rs b/components/script/dom/webgl_extensions/extensions.rs index ebadaf9a6128..8f340b7835d8 100644 --- a/components/script/dom/webgl_extensions/extensions.rs +++ b/components/script/dom/webgl_extensions/extensions.rs @@ -9,7 +9,7 @@ use dom::bindings::cell::DomRefCell; use dom::bindings::codegen::Bindings::OESStandardDerivativesBinding::OESStandardDerivativesConstants; use dom::bindings::codegen::Bindings::OESTextureHalfFloatBinding::OESTextureHalfFloatConstants; use dom::bindings::codegen::Bindings::WebGLRenderingContextBinding::WebGLRenderingContextConstants as constants; -use dom::bindings::root::Root; +use dom::bindings::root::DomRoot; use dom::bindings::trace::JSTraceable; use dom::webglrenderingcontext::WebGLRenderingContext; use fnv::{FnvHashMap, FnvHashSet}; @@ -128,7 +128,7 @@ impl WebGLExtensions { self.extensions.borrow().get(&name).map_or(false, |ext| { ext.is_enabled() }) } - pub fn get_dom_object(&self) -> Option> + pub fn get_dom_object(&self) -> Option> where T: 'static + WebGLExtension + JSTraceable + HeapSizeOf { diff --git a/components/script/dom/webgl_extensions/wrapper.rs b/components/script/dom/webgl_extensions/wrapper.rs index fa4d1112a3cf..7b4452ad7dc8 100644 --- a/components/script/dom/webgl_extensions/wrapper.rs +++ b/components/script/dom/webgl_extensions/wrapper.rs @@ -4,7 +4,7 @@ use core::nonzero::NonZero; use dom::bindings::reflector::DomObject; -use dom::bindings::root::{MutNullableDom, Root}; +use dom::bindings::root::{DomRoot, MutNullableDom}; use dom::bindings::trace::JSTraceable; use dom::webglrenderingcontext::WebGLRenderingContext; use heapsize::HeapSizeOf; @@ -84,7 +84,7 @@ impl WebGLExtensionWrapper for TypedWebGLExtensionWrapper } impl TypedWebGLExtensionWrapper where T: WebGLExtension + JSTraceable + HeapSizeOf + 'static { - pub fn dom_object(&self) -> Option> { + pub fn dom_object(&self) -> Option> { self.extension.get() } } diff --git a/components/script/dom/webgl_validations/tex_image_2d.rs b/components/script/dom/webgl_validations/tex_image_2d.rs index 7392dae0ae11..5be0c6f44fd7 100644 --- a/components/script/dom/webgl_validations/tex_image_2d.rs +++ b/components/script/dom/webgl_validations/tex_image_2d.rs @@ -3,7 +3,7 @@ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ use canvas_traits::webgl::WebGLError::*; -use dom::bindings::root::Root; +use dom::bindings::root::DomRoot; use dom::webglrenderingcontext::WebGLRenderingContext; use dom::webgltexture::WebGLTexture; use std::{self, fmt}; @@ -97,7 +97,7 @@ pub struct CommonTexImage2DValidator<'a> { } pub struct CommonTexImage2DValidatorResult { - pub texture: Root, + pub texture: DomRoot, pub target: TexImageTarget, pub level: u32, pub internal_format: TexFormat, @@ -263,7 +263,7 @@ pub struct TexImage2DValidatorResult { pub height: u32, pub level: u32, pub border: u32, - pub texture: Root, + pub texture: DomRoot, pub target: TexImageTarget, pub format: TexFormat, pub data_type: TexDataType, diff --git a/components/script/dom/webglactiveinfo.rs b/components/script/dom/webglactiveinfo.rs index 596729b15fe5..6712e61fea4e 100644 --- a/components/script/dom/webglactiveinfo.rs +++ b/components/script/dom/webglactiveinfo.rs @@ -6,7 +6,7 @@ use dom::bindings::codegen::Bindings::WebGLActiveInfoBinding; use dom::bindings::codegen::Bindings::WebGLActiveInfoBinding::WebGLActiveInfoMethods; use dom::bindings::reflector::{Reflector, reflect_dom_object}; -use dom::bindings::root::Root; +use dom::bindings::root::DomRoot; use dom::bindings::str::DOMString; use dom::window::Window; use dom_struct::dom_struct; @@ -30,7 +30,7 @@ impl WebGLActiveInfo { } } - pub fn new(window: &Window, size: i32, ty: u32, name: DOMString) -> Root { + pub fn new(window: &Window, size: i32, ty: u32, name: DOMString) -> DomRoot { reflect_dom_object(box WebGLActiveInfo::new_inherited(size, ty, name), window, WebGLActiveInfoBinding::Wrap) } } diff --git a/components/script/dom/webglbuffer.rs b/components/script/dom/webglbuffer.rs index 63859fb9afe6..4510a74fd1b2 100644 --- a/components/script/dom/webglbuffer.rs +++ b/components/script/dom/webglbuffer.rs @@ -8,7 +8,7 @@ use canvas_traits::webgl::webgl_channel; use dom::bindings::cell::DomRefCell; use dom::bindings::codegen::Bindings::WebGLBufferBinding; use dom::bindings::reflector::reflect_dom_object; -use dom::bindings::root::Root; +use dom::bindings::root::DomRoot; use dom::webglobject::WebGLObject; use dom::window::Window; use dom_struct::dom_struct; @@ -48,7 +48,7 @@ impl WebGLBuffer { } pub fn maybe_new(window: &Window, renderer: WebGLMsgSender) - -> Option> { + -> Option> { let (sender, receiver) = webgl_channel().unwrap(); renderer.send(WebGLCommand::CreateBuffer(sender)).unwrap(); @@ -59,7 +59,7 @@ impl WebGLBuffer { pub fn new(window: &Window, renderer: WebGLMsgSender, id: WebGLBufferId) - -> Root { + -> DomRoot { reflect_dom_object(box WebGLBuffer::new_inherited(renderer, id), window, WebGLBufferBinding::Wrap) } diff --git a/components/script/dom/webglcontextevent.rs b/components/script/dom/webglcontextevent.rs index 494740a96979..3e28af76d6e1 100644 --- a/components/script/dom/webglcontextevent.rs +++ b/components/script/dom/webglcontextevent.rs @@ -9,7 +9,7 @@ use dom::bindings::codegen::Bindings::WebGLContextEventBinding::WebGLContextEven use dom::bindings::error::Fallible; use dom::bindings::inheritance::Castable; use dom::bindings::reflector::reflect_dom_object; -use dom::bindings::root::Root; +use dom::bindings::root::DomRoot; use dom::bindings::str::DOMString; use dom::event::{Event, EventBubbles, EventCancelable}; use dom::window::Window; @@ -42,7 +42,7 @@ impl WebGLContextEvent { } } - pub fn new_uninitialized(window: &Window) -> Root { + pub fn new_uninitialized(window: &Window) -> DomRoot { // according to https://www.khronos.org/registry/webgl/specs/1.0/#5.15 this is // additional information or the empty string if no additional information is // available. @@ -57,7 +57,7 @@ impl WebGLContextEvent { type_: Atom, bubbles: EventBubbles, cancelable: EventCancelable, - status_message: DOMString) -> Root { + status_message: DOMString) -> DomRoot { let event = reflect_dom_object( box WebGLContextEvent::new_inherited(status_message), window, @@ -73,7 +73,7 @@ impl WebGLContextEvent { pub fn Constructor(window: &Window, type_: DOMString, - init: &WebGLContextEventInit) -> Fallible> { + init: &WebGLContextEventInit) -> Fallible> { let status_message = match init.statusMessage.as_ref() { Some(message) => message.clone(), None => DOMString::new(), diff --git a/components/script/dom/webglframebuffer.rs b/components/script/dom/webglframebuffer.rs index 35698c5a4d2a..211a4a5d8b90 100644 --- a/components/script/dom/webglframebuffer.rs +++ b/components/script/dom/webglframebuffer.rs @@ -10,7 +10,7 @@ use dom::bindings::cell::DomRefCell; use dom::bindings::codegen::Bindings::WebGLFramebufferBinding; use dom::bindings::codegen::Bindings::WebGLRenderingContextBinding::WebGLRenderingContextConstants as constants; use dom::bindings::reflector::reflect_dom_object; -use dom::bindings::root::{Dom, Root}; +use dom::bindings::root::{Dom, DomRoot}; use dom::webglobject::WebGLObject; use dom::webglrenderbuffer::WebGLRenderbuffer; use dom::webgltexture::WebGLTexture; @@ -65,7 +65,7 @@ impl WebGLFramebuffer { } pub fn maybe_new(window: &Window, renderer: WebGLMsgSender) - -> Option> { + -> Option> { let (sender, receiver) = webgl_channel().unwrap(); renderer.send(WebGLCommand::CreateFramebuffer(sender)).unwrap(); @@ -76,7 +76,7 @@ impl WebGLFramebuffer { pub fn new(window: &Window, renderer: WebGLMsgSender, id: WebGLFramebufferId) - -> Root { + -> DomRoot { reflect_dom_object(box WebGLFramebuffer::new_inherited(renderer, id), window, WebGLFramebufferBinding::Wrap) diff --git a/components/script/dom/webglprogram.rs b/components/script/dom/webglprogram.rs index 39262c2f5bda..50c61397bb85 100644 --- a/components/script/dom/webglprogram.rs +++ b/components/script/dom/webglprogram.rs @@ -8,7 +8,7 @@ use canvas_traits::webgl::webgl_channel; use dom::bindings::codegen::Bindings::WebGLProgramBinding; use dom::bindings::codegen::Bindings::WebGLRenderingContextBinding::WebGLRenderingContextConstants as constants; use dom::bindings::reflector::{DomObject, reflect_dom_object}; -use dom::bindings::root::{MutNullableDom, Root}; +use dom::bindings::root::{DomRoot, MutNullableDom}; use dom::bindings::str::DOMString; use dom::webglactiveinfo::WebGLActiveInfo; use dom::webglobject::WebGLObject; @@ -48,7 +48,7 @@ impl WebGLProgram { } pub fn maybe_new(window: &Window, renderer: WebGLMsgSender) - -> Option> { + -> Option> { let (sender, receiver) = webgl_channel().unwrap(); renderer.send(WebGLCommand::CreateProgram(sender)).unwrap(); @@ -59,7 +59,7 @@ impl WebGLProgram { pub fn new(window: &Window, renderer: WebGLMsgSender, id: WebGLProgramId) - -> Root { + -> DomRoot { reflect_dom_object(box WebGLProgram::new_inherited(renderer, id), window, WebGLProgramBinding::Wrap) @@ -219,7 +219,7 @@ impl WebGLProgram { Ok(()) } - pub fn get_active_uniform(&self, index: u32) -> WebGLResult> { + pub fn get_active_uniform(&self, index: u32) -> WebGLResult> { if self.is_deleted() { return Err(WebGLError::InvalidValue); } @@ -233,7 +233,7 @@ impl WebGLProgram { } /// glGetActiveAttrib - pub fn get_active_attrib(&self, index: u32) -> WebGLResult> { + pub fn get_active_attrib(&self, index: u32) -> WebGLResult> { if self.is_deleted() { return Err(WebGLError::InvalidValue); } diff --git a/components/script/dom/webglrenderbuffer.rs b/components/script/dom/webglrenderbuffer.rs index be324d5e9052..89151a07f8de 100644 --- a/components/script/dom/webglrenderbuffer.rs +++ b/components/script/dom/webglrenderbuffer.rs @@ -7,7 +7,7 @@ use canvas_traits::webgl::{webgl_channel, WebGLCommand, WebGLError, WebGLMsgSend use dom::bindings::codegen::Bindings::WebGLRenderbufferBinding; use dom::bindings::codegen::Bindings::WebGLRenderingContextBinding::WebGLRenderingContextConstants as constants; use dom::bindings::reflector::reflect_dom_object; -use dom::bindings::root::Root; +use dom::bindings::root::DomRoot; use dom::webglobject::WebGLObject; use dom::window::Window; use dom_struct::dom_struct; @@ -41,7 +41,7 @@ impl WebGLRenderbuffer { } pub fn maybe_new(window: &Window, renderer: WebGLMsgSender) - -> Option> { + -> Option> { let (sender, receiver) = webgl_channel().unwrap(); renderer.send(WebGLCommand::CreateRenderbuffer(sender)).unwrap(); @@ -52,7 +52,7 @@ impl WebGLRenderbuffer { pub fn new(window: &Window, renderer: WebGLMsgSender, id: WebGLRenderbufferId) - -> Root { + -> DomRoot { reflect_dom_object(box WebGLRenderbuffer::new_inherited(renderer, id), window, WebGLRenderbufferBinding::Wrap) diff --git a/components/script/dom/webglrenderingcontext.rs b/components/script/dom/webglrenderingcontext.rs index dd0c802ab09e..6ff48147144a 100644 --- a/components/script/dom/webglrenderingcontext.rs +++ b/components/script/dom/webglrenderingcontext.rs @@ -20,7 +20,7 @@ use dom::bindings::conversions::{ConversionResult, FromJSValConvertible, ToJSVal use dom::bindings::error::{Error, Fallible}; use dom::bindings::inheritance::Castable; use dom::bindings::reflector::{DomObject, Reflector, reflect_dom_object}; -use dom::bindings::root::{Dom, LayoutDom, MutNullableDom, Root}; +use dom::bindings::root::{Dom, DomRoot, LayoutDom, MutNullableDom}; use dom::bindings::str::DOMString; use dom::event::{Event, EventBubbles, EventCancelable}; use dom::htmlcanvaselement::HTMLCanvasElement; @@ -207,7 +207,7 @@ impl WebGLRenderingContext { #[allow(unrooted_must_root)] pub fn new(window: &Window, canvas: &HTMLCanvasElement, size: Size2D, attrs: GLContextAttributes) - -> Option> { + -> Option> { match WebGLRenderingContext::new_inherited(window, canvas, size, attrs) { Ok(ctx) => Some(reflect_dom_object(box ctx, window, WebGLRenderingContextBinding::Wrap)), Err(msg) => { @@ -227,7 +227,7 @@ impl WebGLRenderingContext { &self.limits } - pub fn bound_texture_for_target(&self, target: &TexImageTarget) -> Option> { + pub fn bound_texture_for_target(&self, target: &TexImageTarget) -> Option> { match *target { TexImageTarget::Texture2D => self.bound_texture_2d.get(), TexImageTarget::CubeMapPositiveX | @@ -247,7 +247,7 @@ impl WebGLRenderingContext { *self.bound_attrib_buffers.borrow_mut() = FnvHashMap::from_iter(iter.map(|(k,v)| (k, Dom::from_ref(v)))); } - pub fn bound_buffer_element_array(&self) -> Option> { + pub fn bound_buffer_element_array(&self) -> Option> { self.bound_buffer_element_array.get() } @@ -992,7 +992,7 @@ impl WebGLRenderingContext { } fn tex_sub_image_2d(&self, - texture: Root, + texture: DomRoot, target: TexImageTarget, level: u32, xoffset: i32, @@ -1133,8 +1133,8 @@ unsafe fn fallible_array_buffer_view_to_vec(cx: *mut JSContext, abv: *mut JSObje impl WebGLRenderingContextMethods for WebGLRenderingContext { // https://www.khronos.org/registry/webgl/specs/latest/1.0/#5.14.1 - fn Canvas(&self) -> Root { - Root::from_ref(&*self.canvas) + fn Canvas(&self) -> DomRoot { + DomRoot::from_ref(&*self.canvas) } // https://www.khronos.org/registry/webgl/specs/latest/1.0/#5.14.11 @@ -1840,32 +1840,32 @@ impl WebGLRenderingContextMethods for WebGLRenderingContext { // TODO(emilio): Probably in the future we should keep track of the // generated objects, either here or in the webgl thread // https://www.khronos.org/registry/webgl/specs/latest/1.0/#5.14.5 - fn CreateBuffer(&self) -> Option> { + fn CreateBuffer(&self) -> Option> { WebGLBuffer::maybe_new(self.global().as_window(), self.webgl_sender.clone()) } // https://www.khronos.org/registry/webgl/specs/latest/1.0/#5.14.6 - fn CreateFramebuffer(&self) -> Option> { + fn CreateFramebuffer(&self) -> Option> { WebGLFramebuffer::maybe_new(self.global().as_window(), self.webgl_sender.clone()) } // https://www.khronos.org/registry/webgl/specs/latest/1.0/#5.14.7 - fn CreateRenderbuffer(&self) -> Option> { + fn CreateRenderbuffer(&self) -> Option> { WebGLRenderbuffer::maybe_new(self.global().as_window(), self.webgl_sender.clone()) } // https://www.khronos.org/registry/webgl/specs/latest/1.0/#5.14.8 - fn CreateTexture(&self) -> Option> { + fn CreateTexture(&self) -> Option> { WebGLTexture::maybe_new(self.global().as_window(), self.webgl_sender.clone()) } // https://www.khronos.org/registry/webgl/specs/latest/1.0/#5.14.9 - fn CreateProgram(&self) -> Option> { + fn CreateProgram(&self) -> Option> { WebGLProgram::maybe_new(self.global().as_window(), self.webgl_sender.clone()) } // https://www.khronos.org/registry/webgl/specs/latest/1.0/#5.14.9 - fn CreateShader(&self, shader_type: u32) -> Option> { + fn CreateShader(&self, shader_type: u32) -> Option> { match shader_type { constants::VERTEX_SHADER | constants::FRAGMENT_SHADER => {}, _ => { @@ -2087,7 +2087,7 @@ impl WebGLRenderingContextMethods for WebGLRenderingContext { } // https://www.khronos.org/registry/webgl/specs/latest/1.0/#5.14.10 - fn GetActiveUniform(&self, program: Option<&WebGLProgram>, index: u32) -> Option> { + fn GetActiveUniform(&self, program: Option<&WebGLProgram>, index: u32) -> Option> { let program = match program { Some(program) => program, None => { @@ -2114,7 +2114,7 @@ impl WebGLRenderingContextMethods for WebGLRenderingContext { } // https://www.khronos.org/registry/webgl/specs/latest/1.0/#5.14.10 - fn GetActiveAttrib(&self, program: Option<&WebGLProgram>, index: u32) -> Option> { + fn GetActiveAttrib(&self, program: Option<&WebGLProgram>, index: u32) -> Option> { let program = match program { Some(program) => program, None => { @@ -2212,7 +2212,7 @@ impl WebGLRenderingContextMethods for WebGLRenderingContext { fn GetShaderPrecisionFormat(&self, shader_type: u32, precision_type: u32) - -> Option> { + -> Option> { let (sender, receiver) = webgl_channel().unwrap(); self.send_command(WebGLCommand::GetShaderPrecisionFormat(shader_type, precision_type, @@ -2232,7 +2232,7 @@ impl WebGLRenderingContextMethods for WebGLRenderingContext { // https://www.khronos.org/registry/webgl/specs/latest/1.0/#5.14.10 fn GetUniformLocation(&self, program: Option<&WebGLProgram>, - name: DOMString) -> Option> { + name: DOMString) -> Option> { program.and_then(|p| { handle_potential_webgl_error!(self, p.get_uniform_location(name), None) .map(|location| WebGLUniformLocation::new(self.global().as_window(), location, p.id())) diff --git a/components/script/dom/webglshader.rs b/components/script/dom/webglshader.rs index 54f2a743446b..2a48ca21e73a 100644 --- a/components/script/dom/webglshader.rs +++ b/components/script/dom/webglshader.rs @@ -8,7 +8,7 @@ use canvas_traits::webgl::{webgl_channel, WebGLCommand, WebGLMsgSender, WebGLPar use dom::bindings::cell::DomRefCell; use dom::bindings::codegen::Bindings::WebGLShaderBinding; use dom::bindings::reflector::reflect_dom_object; -use dom::bindings::root::Root; +use dom::bindings::root::DomRoot; use dom::bindings::str::DOMString; use dom::webgl_extensions::WebGLExtensions; use dom::webgl_extensions::ext::oesstandardderivatives::OESStandardDerivatives; @@ -69,7 +69,7 @@ impl WebGLShader { pub fn maybe_new(window: &Window, renderer: WebGLMsgSender, shader_type: u32) - -> Option> { + -> Option> { let (sender, receiver) = webgl_channel().unwrap(); renderer.send(WebGLCommand::CreateShader(shader_type, sender)).unwrap(); @@ -81,7 +81,7 @@ impl WebGLShader { renderer: WebGLMsgSender, id: WebGLShaderId, shader_type: u32) - -> Root { + -> DomRoot { reflect_dom_object(box WebGLShader::new_inherited(renderer, id, shader_type), window, WebGLShaderBinding::Wrap) diff --git a/components/script/dom/webglshaderprecisionformat.rs b/components/script/dom/webglshaderprecisionformat.rs index befad009bb5f..5ea5d8e83cf9 100644 --- a/components/script/dom/webglshaderprecisionformat.rs +++ b/components/script/dom/webglshaderprecisionformat.rs @@ -8,7 +8,7 @@ use dom::bindings::codegen::Bindings::WebGLShaderPrecisionFormatBinding; use dom::bindings::codegen::Bindings::WebGLShaderPrecisionFormatBinding::WebGLShaderPrecisionFormatMethods; use dom::bindings::reflector::{Reflector, reflect_dom_object}; -use dom::bindings::root::Root; +use dom::bindings::root::DomRoot; use dom::window::Window; use dom_struct::dom_struct; @@ -33,7 +33,7 @@ impl WebGLShaderPrecisionFormat { pub fn new(window: &Window, range_min: i32, range_max: i32, - precision: i32) -> Root { + precision: i32) -> DomRoot { reflect_dom_object( box WebGLShaderPrecisionFormat::new_inherited(range_min, range_max, precision), window, diff --git a/components/script/dom/webgltexture.rs b/components/script/dom/webgltexture.rs index fe323b53efda..ec8dee281720 100644 --- a/components/script/dom/webgltexture.rs +++ b/components/script/dom/webgltexture.rs @@ -9,7 +9,7 @@ use dom::bindings::cell::DomRefCell; use dom::bindings::codegen::Bindings::WebGLRenderingContextBinding::WebGLRenderingContextConstants as constants; use dom::bindings::codegen::Bindings::WebGLTextureBinding; use dom::bindings::reflector::reflect_dom_object; -use dom::bindings::root::Root; +use dom::bindings::root::DomRoot; use dom::webgl_validations::types::{TexImageTarget, TexFormat, TexDataType}; use dom::webglobject::WebGLObject; use dom::window::Window; @@ -66,7 +66,7 @@ impl WebGLTexture { } pub fn maybe_new(window: &Window, renderer: WebGLMsgSender) - -> Option> { + -> Option> { let (sender, receiver) = webgl_channel().unwrap(); renderer.send(WebGLCommand::CreateTexture(sender)).unwrap(); @@ -77,7 +77,7 @@ impl WebGLTexture { pub fn new(window: &Window, renderer: WebGLMsgSender, id: WebGLTextureId) - -> Root { + -> DomRoot { reflect_dom_object(box WebGLTexture::new_inherited(renderer, id), window, WebGLTextureBinding::Wrap) diff --git a/components/script/dom/webgluniformlocation.rs b/components/script/dom/webgluniformlocation.rs index ded74593c678..080dda92d8b6 100644 --- a/components/script/dom/webgluniformlocation.rs +++ b/components/script/dom/webgluniformlocation.rs @@ -6,7 +6,7 @@ use canvas_traits::webgl::WebGLProgramId; use dom::bindings::codegen::Bindings::WebGLUniformLocationBinding; use dom::bindings::reflector::{Reflector, reflect_dom_object}; -use dom::bindings::root::Root; +use dom::bindings::root::DomRoot; use dom::window::Window; use dom_struct::dom_struct; @@ -31,7 +31,7 @@ impl WebGLUniformLocation { pub fn new(window: &Window, id: i32, program_id: WebGLProgramId) - -> Root { + -> DomRoot { reflect_dom_object(box WebGLUniformLocation::new_inherited(id, program_id), window, WebGLUniformLocationBinding::Wrap) diff --git a/components/script/dom/websocket.rs b/components/script/dom/websocket.rs index 132c616ae498..49a77dd3db5d 100644 --- a/components/script/dom/websocket.rs +++ b/components/script/dom/websocket.rs @@ -12,7 +12,7 @@ use dom::bindings::error::{Error, ErrorResult, Fallible}; use dom::bindings::inheritance::Castable; use dom::bindings::refcounted::Trusted; use dom::bindings::reflector::{DomObject, reflect_dom_object}; -use dom::bindings::root::Root; +use dom::bindings::root::DomRoot; use dom::bindings::str::{DOMString, USVString, is_token}; use dom::blob::{Blob, BlobImpl}; use dom::closeevent::CloseEvent; @@ -124,7 +124,7 @@ impl WebSocket { } } - fn new(global: &GlobalScope, url: ServoUrl) -> Root { + fn new(global: &GlobalScope, url: ServoUrl) -> DomRoot { reflect_dom_object(box WebSocket::new_inherited(url), global, WebSocketBinding::Wrap) } @@ -133,7 +133,7 @@ impl WebSocket { pub fn Constructor(global: &GlobalScope, url: DOMString, protocols: Option) - -> Fallible> { + -> Fallible> { // Steps 1-2. let url_record = ServoUrl::parse(&url).or(Err(Error::Syntax))?; diff --git a/components/script/dom/window.rs b/components/script/dom/window.rs index 10e0299b0aed..7a7b628ceccc 100644 --- a/components/script/dom/window.rs +++ b/components/script/dom/window.rs @@ -21,7 +21,7 @@ use dom::bindings::inheritance::Castable; use dom::bindings::num::Finite; use dom::bindings::refcounted::Trusted; use dom::bindings::reflector::DomObject; -use dom::bindings::root::{Dom, MutNullableDom, Root}; +use dom::bindings::root::{Dom, DomRoot, MutNullableDom}; use dom::bindings::str::DOMString; use dom::bindings::structuredclone::StructuredCloneData; use dom::bindings::trace::RootedTraceableBox; @@ -353,13 +353,13 @@ impl Window { } /// This can panic if it is called after the browsing context has been discarded - pub fn window_proxy(&self) -> Root { + pub fn window_proxy(&self) -> DomRoot { self.window_proxy.get().unwrap() } /// Returns the window proxy if it has not been discarded. /// https://html.spec.whatwg.org/multipage/#a-browsing-context-is-discarded - pub fn undiscarded_window_proxy(&self) -> Option> { + pub fn undiscarded_window_proxy(&self) -> Option> { self.window_proxy.get() .and_then(|window_proxy| if window_proxy.is_browsing_context_discarded() { None @@ -399,7 +399,7 @@ impl Window { self.webvr_chan.clone() } - fn new_paint_worklet(&self) -> Root { + fn new_paint_worklet(&self) -> DomRoot { debug!("Creating new paint worklet."); Worklet::new(self, WorkletGlobalScopeType::Paint) } @@ -553,42 +553,42 @@ impl WindowMethods for Window { } // https://html.spec.whatwg.org/multipage/#dom-document-2 - fn Document(&self) -> Root { + fn Document(&self) -> DomRoot { self.document.get().expect("Document accessed before initialization.") } // https://html.spec.whatwg.org/multipage/#dom-history - fn History(&self) -> Root { + fn History(&self) -> DomRoot { self.history.or_init(|| History::new(self)) } // https://html.spec.whatwg.org/multipage/#dom-window-customelements - fn CustomElements(&self) -> Root { + fn CustomElements(&self) -> DomRoot { self.custom_element_registry.or_init(|| CustomElementRegistry::new(self)) } // https://html.spec.whatwg.org/multipage/#dom-location - fn Location(&self) -> Root { + fn Location(&self) -> DomRoot { self.location.or_init(|| Location::new(self)) } // https://html.spec.whatwg.org/multipage/#dom-sessionstorage - fn SessionStorage(&self) -> Root { + fn SessionStorage(&self) -> DomRoot { self.session_storage.or_init(|| Storage::new(self, StorageType::Session)) } // https://html.spec.whatwg.org/multipage/#dom-localstorage - fn LocalStorage(&self) -> Root { + fn LocalStorage(&self) -> DomRoot { self.local_storage.or_init(|| Storage::new(self, StorageType::Local)) } // https://dvcs.w3.org/hg/webcrypto-api/raw-file/tip/spec/Overview.html#dfn-GlobalCrypto - fn Crypto(&self) -> Root { + fn Crypto(&self) -> DomRoot { self.upcast::().crypto() } // https://html.spec.whatwg.org/multipage/#dom-frameelement - fn GetFrameElement(&self) -> Option> { + fn GetFrameElement(&self) -> Option> { // Steps 1-3. let window_proxy = match self.window_proxy.get() { None => return None, @@ -606,11 +606,11 @@ impl WindowMethods for Window { return None; } // Step 7. - Some(Root::from_ref(container)) + Some(DomRoot::from_ref(container)) } // https://html.spec.whatwg.org/multipage/#dom-navigator - fn Navigator(&self) -> Root { + fn Navigator(&self) -> DomRoot { self.navigator.or_init(|| Navigator::new(self)) } @@ -669,22 +669,22 @@ impl WindowMethods for Window { } // https://html.spec.whatwg.org/multipage/#dom-window - fn Window(&self) -> Root { + fn Window(&self) -> DomRoot { self.window_proxy() } // https://html.spec.whatwg.org/multipage/#dom-self - fn Self_(&self) -> Root { + fn Self_(&self) -> DomRoot { self.window_proxy() } // https://html.spec.whatwg.org/multipage/#dom-frames - fn Frames(&self) -> Root { + fn Frames(&self) -> DomRoot { self.window_proxy() } // https://html.spec.whatwg.org/multipage/#dom-parent - fn GetParent(&self) -> Option> { + fn GetParent(&self) -> Option> { // Steps 1-3. let window_proxy = match self.undiscarded_window_proxy() { Some(window_proxy) => window_proxy, @@ -692,26 +692,26 @@ impl WindowMethods for Window { }; // Step 4. if let Some(parent) = window_proxy.parent() { - return Some(Root::from_ref(parent)); + return Some(DomRoot::from_ref(parent)); } // Step 5. Some(window_proxy) } // https://html.spec.whatwg.org/multipage/#dom-top - fn GetTop(&self) -> Option> { + fn GetTop(&self) -> Option> { // Steps 1-3. let window_proxy = match self.undiscarded_window_proxy() { Some(window_proxy) => window_proxy, None => return None, }; // Steps 4-5. - Some(Root::from_ref(window_proxy.top())) + Some(DomRoot::from_ref(window_proxy.top())) } // https://dvcs.w3.org/hg/webperf/raw-file/tip/specs/ // NavigationTiming/Overview.html#sec-window.performance-attribute - fn Performance(&self) -> Root { + fn Performance(&self) -> DomRoot { self.performance.or_init(|| { let global_scope = self.upcast::(); Performance::new(global_scope, self.navigation_start.get(), @@ -726,7 +726,7 @@ impl WindowMethods for Window { window_event_handlers!(); // https://developer.mozilla.org/en-US/docs/Web/API/Window/screen - fn Screen(&self) -> Root { + fn Screen(&self) -> DomRoot { self.screen.or_init(|| Screen::new(self)) } @@ -828,7 +828,7 @@ impl WindowMethods for Window { // https://drafts.csswg.org/cssom/#dom-window-getcomputedstyle fn GetComputedStyle(&self, element: &Element, - pseudo: Option) -> Root { + pseudo: Option) -> DomRoot { // Steps 1-4. let pseudo = match pseudo.map(|mut s| { s.make_ascii_lowercase(); s }) { Some(ref pseudo) if pseudo == ":before" || pseudo == "::before" => @@ -1007,7 +1007,7 @@ impl WindowMethods for Window { } // https://drafts.csswg.org/cssom-view/#dom-window-matchmedia - fn MatchMedia(&self, query: DOMString) -> Root { + fn MatchMedia(&self, query: DOMString) -> DomRoot { let mut input = ParserInput::new(&query); let mut parser = Parser::new(&mut input); let url = self.get_url(); @@ -1030,11 +1030,11 @@ impl WindowMethods for Window { } // https://drafts.css-houdini.org/css-paint-api-1/#paint-worklet - fn PaintWorklet(&self) -> Root { + fn PaintWorklet(&self) -> DomRoot { self.paint_worklet.or_init(|| self.new_paint_worklet()) } - fn TestRunner(&self) -> Root { + fn TestRunner(&self) -> DomRoot { self.test_runner.or_init(|| TestRunner::new(self.upcast())) } } @@ -1500,7 +1500,7 @@ impl Window { } #[allow(unsafe_code)] - pub fn offset_parent_query(&self, node: TrustedNodeAddress) -> (Option>, Rect) { + pub fn offset_parent_query(&self, node: TrustedNodeAddress) -> (Option>, Rect) { if !self.reflow(ReflowGoal::ForScriptQuery, ReflowQueryType::OffsetParentQuery(node), ReflowReason::Query) { @@ -1512,7 +1512,7 @@ impl Window { let js_runtime = js_runtime.as_ref().unwrap(); let element = response.node_address.and_then(|parent_node_address| { let node = unsafe { from_untrusted_node_address(js_runtime.rt(), parent_node_address) }; - Root::downcast(node) + DomRoot::downcast(node) }); (element, response.rect) } @@ -1661,7 +1661,7 @@ impl Window { } // https://html.spec.whatwg.org/multipage/#accessing-other-browsing-contexts - pub fn IndexedGetter(&self, _index: u32, _found: &mut bool) -> Option> { + pub fn IndexedGetter(&self, _index: u32, _found: &mut bool) -> Option> { None } @@ -1822,7 +1822,7 @@ impl Window { webgl_chan: WebGLChan, webvr_chan: Option>, microtask_queue: Rc, - ) -> Root { + ) -> DomRoot { let layout_rpc: Box = { let (rpc_send, rpc_recv) = channel(); layout_chan.send(Msg::GetRPC(rpc_send)).unwrap(); diff --git a/components/script/dom/windowproxy.rs b/components/script/dom/windowproxy.rs index 3c8a340d0f73..3d5faba1ad33 100644 --- a/components/script/dom/windowproxy.rs +++ b/components/script/dom/windowproxy.rs @@ -7,7 +7,7 @@ use dom::bindings::error::{Error, throw_dom_exception}; use dom::bindings::inheritance::Castable; use dom::bindings::proxyhandler::{fill_property_descriptor, get_property_descriptor}; use dom::bindings::reflector::{DomObject, Reflector}; -use dom::bindings::root::{Dom, Root, RootedReference}; +use dom::bindings::root::{Dom, DomRoot, RootedReference}; use dom::bindings::trace::JSTraceable; use dom::bindings::utils::{WindowProxyHandler, get_array_index_from_id, AsVoidPtr}; use dom::dissimilaroriginwindow::DissimilarOriginWindow; @@ -97,7 +97,7 @@ impl WindowProxy { top_level_browsing_context_id: TopLevelBrowsingContextId, frame_element: Option<&Element>, parent: Option<&WindowProxy>) - -> Root + -> DomRoot { unsafe { let WindowProxyHandler(handler) = window.windowproxy_handler(); @@ -131,7 +131,7 @@ impl WindowProxy { // Set the reflector. debug!("Initializing reflector of {:p} to {:p}.", window_proxy, js_proxy.get()); window_proxy.reflector.set_jsobject(js_proxy.get()); - Root::from_ref(&*Box::into_raw(window_proxy)) + DomRoot::from_ref(&*Box::into_raw(window_proxy)) } } @@ -140,7 +140,7 @@ impl WindowProxy { browsing_context_id: BrowsingContextId, top_level_browsing_context_id: TopLevelBrowsingContextId, parent: Option<&WindowProxy>) - -> Root + -> DomRoot { unsafe { let handler = CreateWrapperProxyHandler(&XORIGIN_PROXY_HANDLER); @@ -176,7 +176,7 @@ impl WindowProxy { // Set the reflector. debug!("Initializing reflector of {:p} to {:p}.", window_proxy, js_proxy.get()); window_proxy.reflector.set_jsobject(js_proxy.get()); - Root::from_ref(&*Box::into_raw(window_proxy)) + DomRoot::from_ref(&*Box::into_raw(window_proxy)) } } @@ -278,7 +278,7 @@ impl WindowProxy { unsafe fn GetSubframeWindow(cx: *mut JSContext, proxy: HandleObject, id: HandleId) - -> Option> { + -> Option> { let index = get_array_index_from_id(cx, id); if let Some(index) = index { rooted!(in(cx) let target = GetProxyPrivate(*proxy.ptr).to_object()); diff --git a/components/script/dom/worker.rs b/components/script/dom/worker.rs index 31e65c563b36..d437b19c1489 100644 --- a/components/script/dom/worker.rs +++ b/components/script/dom/worker.rs @@ -11,7 +11,7 @@ use dom::bindings::error::{Error, ErrorResult, Fallible}; use dom::bindings::inheritance::Castable; use dom::bindings::refcounted::Trusted; use dom::bindings::reflector::{DomObject, reflect_dom_object}; -use dom::bindings::root::Root; +use dom::bindings::root::DomRoot; use dom::bindings::str::DOMString; use dom::bindings::structuredclone::StructuredCloneData; use dom::dedicatedworkerglobalscope::DedicatedWorkerGlobalScope; @@ -60,7 +60,7 @@ impl Worker { pub fn new(global: &GlobalScope, sender: Sender<(TrustedWorkerAddress, WorkerScriptMsg)>, - closing: Arc) -> Root { + closing: Arc) -> DomRoot { reflect_dom_object(box Worker::new_inherited(sender, closing), global, WorkerBinding::Wrap) @@ -68,7 +68,7 @@ impl Worker { // https://html.spec.whatwg.org/multipage/#dom-worker #[allow(unsafe_code)] - pub fn Constructor(global: &GlobalScope, script_url: DOMString) -> Fallible> { + pub fn Constructor(global: &GlobalScope, script_url: DOMString) -> Fallible> { // Step 2-4. let worker_url = match global.api_base_url().join(&script_url) { Ok(url) => url, diff --git a/components/script/dom/workerglobalscope.rs b/components/script/dom/workerglobalscope.rs index 252be0f3bf1b..ca7e2c3b7a91 100644 --- a/components/script/dom/workerglobalscope.rs +++ b/components/script/dom/workerglobalscope.rs @@ -10,7 +10,7 @@ use dom::bindings::codegen::UnionTypes::RequestOrUSVString; use dom::bindings::error::{Error, ErrorResult, Fallible, report_pending_exception}; use dom::bindings::inheritance::Castable; use dom::bindings::reflector::DomObject; -use dom::bindings::root::{MutNullableDom, Root}; +use dom::bindings::root::{DomRoot, MutNullableDom}; use dom::bindings::settings_stack::AutoEntryScript; use dom::bindings::str::DOMString; use dom::bindings::trace::RootedTraceableBox; @@ -170,12 +170,12 @@ impl WorkerGlobalScope { impl WorkerGlobalScopeMethods for WorkerGlobalScope { // https://html.spec.whatwg.org/multipage/#dom-workerglobalscope-self - fn Self_(&self) -> Root { - Root::from_ref(self) + fn Self_(&self) -> DomRoot { + DomRoot::from_ref(self) } // https://html.spec.whatwg.org/multipage/#dom-workerglobalscope-location - fn Location(&self) -> Root { + fn Location(&self) -> DomRoot { self.location.or_init(|| { WorkerLocation::new(self, self.worker_url.clone()) }) @@ -236,12 +236,12 @@ impl WorkerGlobalScopeMethods for WorkerGlobalScope { } // https://html.spec.whatwg.org/multipage/#dom-worker-navigator - fn Navigator(&self) -> Root { + fn Navigator(&self) -> DomRoot { self.navigator.or_init(|| WorkerNavigator::new(self)) } // https://html.spec.whatwg.org/multipage/#dfn-Crypto - fn Crypto(&self) -> Root { + fn Crypto(&self) -> DomRoot { self.upcast::().crypto() } @@ -316,7 +316,7 @@ impl WorkerGlobalScopeMethods for WorkerGlobalScope { } // https://w3c.github.io/hr-time/#the-performance-attribute - fn Performance(&self) -> Root { + fn Performance(&self) -> DomRoot { self.performance.or_init(|| { let global_scope = self.upcast::(); Performance::new(global_scope, diff --git a/components/script/dom/workerlocation.rs b/components/script/dom/workerlocation.rs index d7ceda40531a..ca7d30d4d3cb 100644 --- a/components/script/dom/workerlocation.rs +++ b/components/script/dom/workerlocation.rs @@ -5,7 +5,7 @@ use dom::bindings::codegen::Bindings::WorkerLocationBinding; use dom::bindings::codegen::Bindings::WorkerLocationBinding::WorkerLocationMethods; use dom::bindings::reflector::{Reflector, reflect_dom_object}; -use dom::bindings::root::Root; +use dom::bindings::root::DomRoot; use dom::bindings::str::{DOMString, USVString}; use dom::urlhelper::UrlHelper; use dom::workerglobalscope::WorkerGlobalScope; @@ -27,7 +27,7 @@ impl WorkerLocation { } } - pub fn new(global: &WorkerGlobalScope, url: ServoUrl) -> Root { + pub fn new(global: &WorkerGlobalScope, url: ServoUrl) -> DomRoot { reflect_dom_object(box WorkerLocation::new_inherited(url), global, WorkerLocationBinding::Wrap) diff --git a/components/script/dom/workernavigator.rs b/components/script/dom/workernavigator.rs index d2d99be1264e..e11347c34c64 100644 --- a/components/script/dom/workernavigator.rs +++ b/components/script/dom/workernavigator.rs @@ -5,7 +5,7 @@ use dom::bindings::codegen::Bindings::WorkerNavigatorBinding; use dom::bindings::codegen::Bindings::WorkerNavigatorBinding::WorkerNavigatorMethods; use dom::bindings::reflector::{DomObject, Reflector, reflect_dom_object}; -use dom::bindings::root::{MutNullableDom, Root}; +use dom::bindings::root::{DomRoot, MutNullableDom}; use dom::bindings::str::DOMString; use dom::navigatorinfo; use dom::permissions::Permissions; @@ -27,7 +27,7 @@ impl WorkerNavigator { } } - pub fn new(global: &WorkerGlobalScope) -> Root { + pub fn new(global: &WorkerGlobalScope) -> DomRoot { reflect_dom_object(box WorkerNavigator::new_inherited(), global, WorkerNavigatorBinding::Wrap) @@ -76,7 +76,7 @@ impl WorkerNavigatorMethods for WorkerNavigator { } // https://w3c.github.io/permissions/#navigator-and-workernavigator-extension - fn Permissions(&self) -> Root { + fn Permissions(&self) -> DomRoot { self.permissions.or_init(|| Permissions::new(&self.global())) } } diff --git a/components/script/dom/worklet.rs b/components/script/dom/worklet.rs index b83de5e462d7..4f13fac1b1ac 100644 --- a/components/script/dom/worklet.rs +++ b/components/script/dom/worklet.rs @@ -20,7 +20,7 @@ use dom::bindings::inheritance::Castable; use dom::bindings::refcounted::TrustedPromise; use dom::bindings::reflector::Reflector; use dom::bindings::reflector::reflect_dom_object; -use dom::bindings::root::{Dom, Root, RootCollection}; +use dom::bindings::root::{Dom, DomRoot, RootCollection}; use dom::bindings::str::USVString; use dom::bindings::trace::JSTraceable; use dom::bindings::trace::RootedTraceableBox; @@ -93,7 +93,7 @@ impl Worklet { } } - pub fn new(window: &Window, global_type: WorkletGlobalScopeType) -> Root { + pub fn new(window: &Window, global_type: WorkletGlobalScopeType) -> DomRoot { debug!("Creating worklet {:?}.", global_type); reflect_dom_object(box Worklet::new_inherited(window, global_type), window, Wrap) } @@ -538,10 +538,10 @@ impl WorkletThread { worklet_id: WorkletId, global_type: WorkletGlobalScopeType, base_url: ServoUrl) - -> Root + -> DomRoot { match self.global_scopes.entry(worklet_id) { - hash_map::Entry::Occupied(entry) => Root::from_ref(entry.get()), + hash_map::Entry::Occupied(entry) => DomRoot::from_ref(entry.get()), hash_map::Entry::Vacant(entry) => { debug!("Creating new worklet global scope."); let executor = WorkletExecutor::new(worklet_id, self.primary_sender.clone()); diff --git a/components/script/dom/workletglobalscope.rs b/components/script/dom/workletglobalscope.rs index 64c8f0793a68..adae76e22bb8 100644 --- a/components/script/dom/workletglobalscope.rs +++ b/components/script/dom/workletglobalscope.rs @@ -4,7 +4,7 @@ use devtools_traits::ScriptToDevtoolsControlMsg; use dom::bindings::inheritance::Castable; -use dom::bindings::root::Root; +use dom::bindings::root::DomRoot; use dom::globalscope::GlobalScope; use dom::paintworkletglobalscope::PaintWorkletGlobalScope; use dom::paintworkletglobalscope::PaintWorkletTask; @@ -171,13 +171,13 @@ impl WorkletGlobalScopeType { base_url: ServoUrl, executor: WorkletExecutor, init: &WorkletGlobalScopeInit) - -> Root + -> DomRoot { match *self { WorkletGlobalScopeType::Test => - Root::upcast(TestWorkletGlobalScope::new(runtime, pipeline_id, base_url, executor, init)), + DomRoot::upcast(TestWorkletGlobalScope::new(runtime, pipeline_id, base_url, executor, init)), WorkletGlobalScopeType::Paint => - Root::upcast(PaintWorkletGlobalScope::new(runtime, pipeline_id, base_url, executor, init)), + DomRoot::upcast(PaintWorkletGlobalScope::new(runtime, pipeline_id, base_url, executor, init)), } } } diff --git a/components/script/dom/xmldocument.rs b/components/script/dom/xmldocument.rs index 182cf65f2e2e..f5ef640abce9 100644 --- a/components/script/dom/xmldocument.rs +++ b/components/script/dom/xmldocument.rs @@ -8,7 +8,7 @@ use dom::bindings::codegen::Bindings::DocumentBinding::DocumentMethods; use dom::bindings::codegen::Bindings::XMLDocumentBinding::{self, XMLDocumentMethods}; use dom::bindings::inheritance::Castable; use dom::bindings::reflector::reflect_dom_object; -use dom::bindings::root::Root; +use dom::bindings::root::DomRoot; use dom::bindings::str::DOMString; use dom::document::{Document, DocumentSource, HasBrowsingContext, IsHTMLDocument}; use dom::location::Location; @@ -62,7 +62,7 @@ impl XMLDocument { activity: DocumentActivity, source: DocumentSource, doc_loader: DocumentLoader) - -> Root { + -> DomRoot { let doc = reflect_dom_object( box XMLDocument::new_inherited(window, has_browsing_context, @@ -86,7 +86,7 @@ impl XMLDocument { impl XMLDocumentMethods for XMLDocument { // https://html.spec.whatwg.org/multipage/#dom-document-location - fn GetLocation(&self) -> Option> { + fn GetLocation(&self) -> Option> { self.upcast::().GetLocation() } diff --git a/components/script/dom/xmlhttprequest.rs b/components/script/dom/xmlhttprequest.rs index 16c14cb2e5b8..4b9b2b45a4c7 100644 --- a/components/script/dom/xmlhttprequest.rs +++ b/components/script/dom/xmlhttprequest.rs @@ -16,7 +16,7 @@ use dom::bindings::error::{Error, ErrorResult, Fallible}; use dom::bindings::inheritance::Castable; use dom::bindings::refcounted::Trusted; use dom::bindings::reflector::{DomObject, reflect_dom_object}; -use dom::bindings::root::{Dom, MutNullableDom, Root}; +use dom::bindings::root::{Dom, DomRoot, MutNullableDom}; use dom::bindings::str::{ByteString, DOMString, USVString, is_token}; use dom::blob::{Blob, BlobImpl}; use dom::document::{Document, HasBrowsingContext, IsHTMLDocument}; @@ -203,14 +203,14 @@ impl XMLHttpRequest { referrer_policy: referrer_policy, } } - pub fn new(global: &GlobalScope) -> Root { + pub fn new(global: &GlobalScope) -> DomRoot { reflect_dom_object(box XMLHttpRequest::new_inherited(global), global, XMLHttpRequestBinding::Wrap) } // https://xhr.spec.whatwg.org/#constructors - pub fn Constructor(global: &GlobalScope) -> Fallible> { + pub fn Constructor(global: &GlobalScope) -> Fallible> { Ok(XMLHttpRequest::new(global)) } @@ -289,7 +289,7 @@ impl XMLHttpRequestMethods for XMLHttpRequest { fn Open_(&self, method: ByteString, url: USVString, async: bool, username: Option, password: Option) -> ErrorResult { // Step 1 - if let Some(window) = Root::downcast::(self.global()) { + if let Some(window) = DomRoot::downcast::(self.global()) { if !window.Document().is_fully_active() { return Err(Error::InvalidState); } @@ -481,8 +481,8 @@ impl XMLHttpRequestMethods for XMLHttpRequest { } // https://xhr.spec.whatwg.org/#the-upload-attribute - fn Upload(&self) -> Root { - Root::from_ref(&*self.upload) + fn Upload(&self) -> DomRoot { + DomRoot::from_ref(&*self.upload) } // https://xhr.spec.whatwg.org/#the-send()-method @@ -570,7 +570,7 @@ impl XMLHttpRequestMethods for XMLHttpRequest { // preference is enabled, we allow bypassing the CORS check. // This is a temporary measure until we figure out Servo privilege // story. See https://github.com/servo/servo/issues/9582 - if let Some(win) = Root::downcast::(self.global()) { + if let Some(win) = DomRoot::downcast::(self.global()) { let is_root_pipeline = win.parent_info().is_none(); is_root_pipeline && PREFS.is_mozbrowser_enabled() } else { @@ -811,7 +811,7 @@ impl XMLHttpRequestMethods for XMLHttpRequest { } // https://xhr.spec.whatwg.org/#the-responsexml-attribute - fn GetResponseXML(&self) -> Fallible>> { + fn GetResponseXML(&self) -> Fallible>> { // TODO(#2823): Until [Exposed] is implemented, this attribute needs to return null // explicitly in the worker scope. if self.global().is::() { @@ -1088,7 +1088,7 @@ impl XMLHttpRequest { } // https://xhr.spec.whatwg.org/#blob-response - fn blob_response(&self) -> Root { + fn blob_response(&self) -> DomRoot { // Step 1 if let Some(response) = self.response_blob.get() { return response; @@ -1104,7 +1104,7 @@ impl XMLHttpRequest { } // https://xhr.spec.whatwg.org/#document-response - fn document_response(&self) -> Option> { + fn document_response(&self) -> Option> { // Step 1 let response = self.response_xml.get(); if response.is_some() { @@ -1114,7 +1114,7 @@ impl XMLHttpRequest { let mime_type = self.final_mime_type(); // TODO: prescan the response to determine encoding if final charset is null let charset = self.final_charset().unwrap_or(UTF_8); - let temp_doc: Root; + let temp_doc: DomRoot; match mime_type { Some(Mime(mime::TopLevel::Text, mime::SubLevel::Html, _)) => { // Step 5 @@ -1181,7 +1181,7 @@ impl XMLHttpRequest { self.response_json.get() } - fn document_text_html(&self) -> Root { + fn document_text_html(&self) -> DomRoot { let charset = self.final_charset().unwrap_or(UTF_8); let wr = self.global(); let decoded = charset.decode(&self.response.borrow(), DecoderTrap::Replace).unwrap(); @@ -1194,7 +1194,7 @@ impl XMLHttpRequest { document } - fn handle_xml(&self) -> Root { + fn handle_xml(&self) -> DomRoot { let charset = self.final_charset().unwrap_or(UTF_8); let wr = self.global(); let decoded = charset.decode(&self.response.borrow(), DecoderTrap::Replace).unwrap(); @@ -1207,7 +1207,7 @@ impl XMLHttpRequest { document } - fn new_doc(&self, is_html_document: IsHTMLDocument) -> Root { + fn new_doc(&self, is_html_document: IsHTMLDocument) -> DomRoot { let wr = self.global(); let win = wr.as_window(); let doc = win.Document(); diff --git a/components/script/dom/xmlhttprequestupload.rs b/components/script/dom/xmlhttprequestupload.rs index e390caa5a05c..7c6a1a4f5131 100644 --- a/components/script/dom/xmlhttprequestupload.rs +++ b/components/script/dom/xmlhttprequestupload.rs @@ -4,7 +4,7 @@ use dom::bindings::codegen::Bindings::XMLHttpRequestUploadBinding; use dom::bindings::reflector::reflect_dom_object; -use dom::bindings::root::Root; +use dom::bindings::root::DomRoot; use dom::globalscope::GlobalScope; use dom::xmlhttprequesteventtarget::XMLHttpRequestEventTarget; use dom_struct::dom_struct; @@ -20,7 +20,7 @@ impl XMLHttpRequestUpload { eventtarget: XMLHttpRequestEventTarget::new_inherited(), } } - pub fn new(global: &GlobalScope) -> Root { + pub fn new(global: &GlobalScope) -> DomRoot { reflect_dom_object(box XMLHttpRequestUpload::new_inherited(), global, XMLHttpRequestUploadBinding::Wrap) diff --git a/components/script/fetch.rs b/components/script/fetch.rs index babd4c7e9426..7a6f63f7b406 100644 --- a/components/script/fetch.rs +++ b/components/script/fetch.rs @@ -10,7 +10,7 @@ use dom::bindings::error::Error; use dom::bindings::inheritance::Castable; use dom::bindings::refcounted::{Trusted, TrustedPromise}; use dom::bindings::reflector::DomObject; -use dom::bindings::root::Root; +use dom::bindings::root::DomRoot; use dom::bindings::trace::RootedTraceableBox; use dom::globalscope::GlobalScope; use dom::headers::Guard; @@ -184,7 +184,7 @@ impl FetchResponseListener for FetchContext { } } -fn fill_headers_with_metadata(r: Root, m: Metadata) { +fn fill_headers_with_metadata(r: DomRoot, m: Metadata) { r.set_headers(m.headers); r.set_raw_status(m.status); r.set_final_url(m.final_url); diff --git a/components/script/microtask.rs b/components/script/microtask.rs index 476a551c25cc..f0ec5d44ae53 100644 --- a/components/script/microtask.rs +++ b/components/script/microtask.rs @@ -9,7 +9,7 @@ use dom::bindings::callback::ExceptionHandling; use dom::bindings::cell::DomRefCell; use dom::bindings::codegen::Bindings::PromiseBinding::PromiseJobCallback; -use dom::bindings::root::Root; +use dom::bindings::root::DomRoot; use dom::globalscope::GlobalScope; use dom::htmlimageelement::ImageElementMicrotask; use dom::htmlmediaelement::MediaElementMicrotask; @@ -60,7 +60,7 @@ impl MicrotaskQueue { /// https://html.spec.whatwg.org/multipage/#perform-a-microtask-checkpoint /// Perform a microtask checkpoint, executing all queued microtasks until the queue is empty. pub fn checkpoint(&self, target_provider: F) - where F: Fn(PipelineId) -> Option> + where F: Fn(PipelineId) -> Option> { if self.performing_a_microtask_checkpoint.get() { return; diff --git a/components/script/script_thread.rs b/components/script/script_thread.rs index 5957b3a88578..4b9984845e8b 100644 --- a/components/script/script_thread.rs +++ b/components/script/script_thread.rs @@ -34,7 +34,7 @@ use dom::bindings::conversions::{ConversionResult, FromJSValConvertible, Stringi use dom::bindings::inheritance::Castable; use dom::bindings::num::Finite; use dom::bindings::reflector::DomObject; -use dom::bindings::root::{Dom, MutNullableDom, Root, RootCollection}; +use dom::bindings::root::{Dom, DomRoot, MutNullableDom, RootCollection}; use dom::bindings::root::{RootCollectionPtr, RootedReference}; use dom::bindings::str::DOMString; use dom::bindings::structuredclone::StructuredCloneData; @@ -334,28 +334,28 @@ impl Documents { self.map.insert(pipeline_id, Dom::from_ref(doc)); } - pub fn remove(&mut self, pipeline_id: PipelineId) -> Option> { - self.map.remove(&pipeline_id).map(|ref doc| Root::from_ref(&**doc)) + pub fn remove(&mut self, pipeline_id: PipelineId) -> Option> { + self.map.remove(&pipeline_id).map(|ref doc| DomRoot::from_ref(&**doc)) } pub fn is_empty(&self) -> bool { self.map.is_empty() } - pub fn find_document(&self, pipeline_id: PipelineId) -> Option> { - self.map.get(&pipeline_id).map(|doc| Root::from_ref(&**doc)) + pub fn find_document(&self, pipeline_id: PipelineId) -> Option> { + self.map.get(&pipeline_id).map(|doc| DomRoot::from_ref(&**doc)) } - pub fn find_window(&self, pipeline_id: PipelineId) -> Option> { - self.find_document(pipeline_id).map(|doc| Root::from_ref(doc.window())) + pub fn find_window(&self, pipeline_id: PipelineId) -> Option> { + self.find_document(pipeline_id).map(|doc| DomRoot::from_ref(doc.window())) } - pub fn find_global(&self, pipeline_id: PipelineId) -> Option> { - self.find_window(pipeline_id).map(|window| Root::from_ref(window.upcast())) + pub fn find_global(&self, pipeline_id: PipelineId) -> Option> { + self.find_window(pipeline_id).map(|window| DomRoot::from_ref(window.upcast())) } pub fn find_iframe(&self, pipeline_id: PipelineId, browsing_context_id: BrowsingContextId) - -> Option> + -> Option> { self.find_document(pipeline_id).and_then(|doc| doc.find_iframe(browsing_context_id)) } @@ -373,10 +373,10 @@ pub struct DocumentsIter<'a> { } impl<'a> Iterator for DocumentsIter<'a> { - type Item = (PipelineId, Root); + type Item = (PipelineId, DomRoot); - fn next(&mut self) -> Option<(PipelineId, Root)> { - self.iter.next().map(|(id, doc)| (*id, Root::from_ref(&**doc))) + fn next(&mut self) -> Option<(PipelineId, DomRoot)> { + self.iter.next().map(|(id, doc)| (*id, DomRoot::from_ref(&**doc))) } } @@ -616,10 +616,10 @@ impl ScriptThread { }) } - pub fn get_mutation_observers() -> Vec> { + pub fn get_mutation_observers() -> Vec> { SCRIPT_THREAD_ROOT.with(|root| { let script_thread = unsafe { &*root.get().unwrap() }; - script_thread.mutation_observers.borrow().iter().map(|o| Root::from_ref(&**o)).collect() + script_thread.mutation_observers.borrow().iter().map(|o| DomRoot::from_ref(&**o)).collect() }) } @@ -640,7 +640,7 @@ impl ScriptThread { } pub fn page_headers_available(id: &PipelineId, metadata: Option) - -> Option> { + -> Option> { SCRIPT_THREAD_ROOT.with(|root| { let script_thread = unsafe { &*root.get().unwrap() }; script_thread.handle_page_headers_available(id, metadata) @@ -686,18 +686,18 @@ impl ScriptThread { }); } - pub fn find_document(id: PipelineId) -> Option> { + pub fn find_document(id: PipelineId) -> Option> { SCRIPT_THREAD_ROOT.with(|root| root.get().and_then(|script_thread| { let script_thread = unsafe { &*script_thread }; script_thread.documents.borrow().find_document(id) })) } - pub fn find_window_proxy(id: BrowsingContextId) -> Option> { + pub fn find_window_proxy(id: BrowsingContextId) -> Option> { SCRIPT_THREAD_ROOT.with(|root| root.get().and_then(|script_thread| { let script_thread = unsafe { &*script_thread }; script_thread.window_proxies.borrow().get(&id) - .map(|context| Root::from_ref(&**context)) + .map(|context| DomRoot::from_ref(&**context)) })) } @@ -1657,7 +1657,7 @@ impl ScriptThread { /// We have received notification that the response associated with a load has completed. /// Kick off the document and frame tree creation process using the result. fn handle_page_headers_available(&self, id: &PipelineId, - metadata: Option) -> Option> { + metadata: Option) -> Option> { let idx = self.incomplete_loads.borrow().iter().position(|load| { load.pipeline_id == *id }); // The matching in progress load structure may not exist if // the pipeline exited before the page load completed. @@ -1685,9 +1685,9 @@ impl ScriptThread { } } - pub fn handle_get_registration(&self, scope_url: &ServoUrl) -> Option> { + pub fn handle_get_registration(&self, scope_url: &ServoUrl) -> Option> { let maybe_registration_ref = self.registration_map.borrow(); - maybe_registration_ref.get(scope_url).map(|x| Root::from_ref(&**x)) + maybe_registration_ref.get(scope_url).map(|x| DomRoot::from_ref(&**x)) } pub fn handle_serviceworker_registration(&self, @@ -1940,14 +1940,14 @@ impl ScriptThread { global_to_clone: &GlobalScope, top_level_browsing_context_id: TopLevelBrowsingContextId, pipeline_id: PipelineId) - -> Option> + -> Option> { let browsing_context_id = match self.ask_constellation_for_browsing_context_id(pipeline_id) { Some(browsing_context_id) => browsing_context_id, None => return None, }; if let Some(window_proxy) = self.window_proxies.borrow().get(&browsing_context_id) { - return Some(Root::from_ref(window_proxy)); + return Some(DomRoot::from_ref(window_proxy)); } let parent = match self.ask_constellation_for_parent_info(pipeline_id) { Some((parent_id, FrameType::IFrame)) => self.remote_window_proxy(global_to_clone, @@ -1974,11 +1974,11 @@ impl ScriptThread { browsing_context_id: BrowsingContextId, top_level_browsing_context_id: TopLevelBrowsingContextId, parent_info: Option<(PipelineId, FrameType)>) - -> Root + -> DomRoot { if let Some(window_proxy) = self.window_proxies.borrow().get(&browsing_context_id) { window_proxy.set_currently_active(&*window); - return Root::from_ref(window_proxy); + return DomRoot::from_ref(window_proxy); } let iframe = match parent_info { Some((parent_id, FrameType::IFrame)) => self.documents.borrow().find_iframe(parent_id, browsing_context_id), @@ -2002,7 +2002,7 @@ impl ScriptThread { /// The entry point to document loading. Defines bindings, sets up the window and document /// objects, parses HTML and CSS, and kicks off initial layout. - fn load(&self, metadata: Metadata, incomplete: InProgressLoad) -> Root { + fn load(&self, metadata: Metadata, incomplete: InProgressLoad) -> DomRoot { let final_url = metadata.final_url.clone(); { // send the final url to the layout thread. @@ -2213,7 +2213,7 @@ impl ScriptThread { if let Some(target) = self.topmost_mouse_over_target.get() { if let Some(anchor) = target.upcast::() .inclusive_ancestors() - .filter_map(Root::downcast::) + .filter_map(DomRoot::downcast::) .next() { let status = anchor.upcast::() .get_attribute(&ns!(), &local_name!("href")) @@ -2235,7 +2235,7 @@ impl ScriptThread { if let Some(target) = prev_mouse_over_target { if let Some(_) = target.upcast::() .inclusive_ancestors() - .filter_map(Root::downcast::) + .filter_map(DomRoot::downcast::) .next() { let event = ScriptMsg::NodeStatus(None); self.script_sender.send((pipeline_id, event)).unwrap(); diff --git a/components/script/webdriver_handlers.rs b/components/script/webdriver_handlers.rs index 66ee6fe4eb49..39dba228ba3c 100644 --- a/components/script/webdriver_handlers.rs +++ b/components/script/webdriver_handlers.rs @@ -13,7 +13,7 @@ use dom::bindings::codegen::Bindings::NodeBinding::NodeMethods; use dom::bindings::codegen::Bindings::WindowBinding::WindowMethods; use dom::bindings::conversions::{ConversionResult, FromJSValConvertible, StringificationBehavior}; use dom::bindings::inheritance::Castable; -use dom::bindings::root::Root; +use dom::bindings::root::DomRoot; use dom::bindings::str::DOMString; use dom::element::Element; use dom::globalscope::GlobalScope; @@ -40,7 +40,7 @@ use servo_url::ServoUrl; fn find_node_by_unique_id(documents: &Documents, pipeline: PipelineId, node_id: String) - -> Option> { + -> Option> { documents.find_document(pipeline).and_then(|document| document.upcast::().traverse_preorder().find(|candidate| candidate.unique_id() == node_id) )