aboutsummaryrefslogtreecommitdiffstats
path: root/components
diff options
context:
space:
mode:
authorAnthony Ramine <n.oxyde@gmail.com>2017-09-26 01:53:40 +0200
committerAnthony Ramine <n.oxyde@gmail.com>2017-09-26 09:49:10 +0200
commitf87c2a8d7616112ca924e30292db2d244cf87eec (patch)
tree7344afe7ec0ec1ac7d1d13f5385111ee9c4be332 /components
parent577370746e2ce3da7fa25a20b8e1bbeed319df65 (diff)
downloadservo-f87c2a8d7616112ca924e30292db2d244cf87eec.tar.gz
servo-f87c2a8d7616112ca924e30292db2d244cf87eec.zip
Rename Root<T> to DomRoot<T>
In a later PR, DomRoot<T> will become a type alias of Root<Dom<T>>, where Root<T> 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.
Diffstat (limited to 'components')
-rw-r--r--components/script/body.rs6
-rw-r--r--components/script/devtools.rs4
-rw-r--r--components/script/docs/JS-Servos-only-GC.md20
-rw-r--r--components/script/dom/attr.rs8
-rw-r--r--components/script/dom/beforeunloadevent.rs6
-rw-r--r--components/script/dom/bindings/callback.rs4
-rw-r--r--components/script/dom/bindings/codegen/CodegenRust.py26
-rw-r--r--components/script/dom/bindings/codegen/Configuration.py2
-rw-r--r--components/script/dom/bindings/conversions.rs24
-rw-r--r--components/script/dom/bindings/interface.rs10
-rw-r--r--components/script/dom/bindings/iterable.rs4
-rw-r--r--components/script/dom/bindings/refcounted.rs6
-rw-r--r--components/script/dom/bindings/reflector.rs8
-rw-r--r--components/script/dom/bindings/root.rs58
-rw-r--r--components/script/dom/bindings/settings_stack.rs14
-rw-r--r--components/script/dom/bindings/structuredclone.rs4
-rw-r--r--components/script/dom/bindings/trace.rs14
-rw-r--r--components/script/dom/bindings/weakref.rs12
-rw-r--r--components/script/dom/blob.rs10
-rw-r--r--components/script/dom/bluetooth.rs4
-rw-r--r--components/script/dom/bluetoothadvertisingevent.rs10
-rw-r--r--components/script/dom/bluetoothcharacteristicproperties.rs4
-rw-r--r--components/script/dom/bluetoothdevice.rs24
-rw-r--r--components/script/dom/bluetoothpermissionresult.rs12
-rw-r--r--components/script/dom/bluetoothremotegattcharacteristic.rs12
-rw-r--r--components/script/dom/bluetoothremotegattdescriptor.rs8
-rw-r--r--components/script/dom/bluetoothremotegattserver.rs8
-rw-r--r--components/script/dom/bluetoothremotegattservice.rs8
-rw-r--r--components/script/dom/canvasgradient.rs4
-rw-r--r--components/script/dom/canvaspattern.rs4
-rw-r--r--components/script/dom/canvasrenderingcontext2d.rs28
-rw-r--r--components/script/dom/characterdata.rs18
-rw-r--r--components/script/dom/client.rs6
-rw-r--r--components/script/dom/closeevent.rs8
-rw-r--r--components/script/dom/comment.rs6
-rw-r--r--components/script/dom/compositionevent.rs6
-rw-r--r--components/script/dom/create.rs22
-rw-r--r--components/script/dom/crypto.rs4
-rw-r--r--components/script/dom/cssfontfacerule.rs4
-rw-r--r--components/script/dom/cssgroupingrule.rs6
-rw-r--r--components/script/dom/cssimportrule.rs4
-rw-r--r--components/script/dom/csskeyframerule.rs6
-rw-r--r--components/script/dom/csskeyframesrule.rs12
-rw-r--r--components/script/dom/cssmediarule.rs8
-rw-r--r--components/script/dom/cssnamespacerule.rs4
-rw-r--r--components/script/dom/cssrule.rs24
-rw-r--r--components/script/dom/cssrulelist.rs14
-rw-r--r--components/script/dom/cssstyledeclaration.rs8
-rw-r--r--components/script/dom/cssstylerule.rs6
-rw-r--r--components/script/dom/cssstylesheet.rs8
-rw-r--r--components/script/dom/cssstylevalue.rs4
-rw-r--r--components/script/dom/csssupportsrule.rs4
-rw-r--r--components/script/dom/cssviewportrule.rs4
-rw-r--r--components/script/dom/customelementregistry.rs20
-rw-r--r--components/script/dom/customevent.rs8
-rw-r--r--components/script/dom/dedicatedworkerglobalscope.rs6
-rw-r--r--components/script/dom/dissimilaroriginlocation.rs4
-rw-r--r--components/script/dom/dissimilaroriginwindow.rs28
-rw-r--r--components/script/dom/document.rs252
-rw-r--r--components/script/dom/documentfragment.rs22
-rw-r--r--components/script/dom/documenttype.rs4
-rw-r--r--components/script/dom/domexception.rs4
-rw-r--r--components/script/dom/domimplementation.rs16
-rw-r--r--components/script/dom/dommatrix.rs56
-rw-r--r--components/script/dom/dommatrixreadonly.rs36
-rw-r--r--components/script/dom/domparser.rs8
-rw-r--r--components/script/dom/dompoint.rs8
-rw-r--r--components/script/dom/dompointreadonly.rs6
-rw-r--r--components/script/dom/domquad.rs28
-rw-r--r--components/script/dom/domrect.rs6
-rw-r--r--components/script/dom/domrectreadonly.rs6
-rw-r--r--components/script/dom/domstringmap.rs4
-rw-r--r--components/script/dom/domtokenlist.rs6
-rw-r--r--components/script/dom/element.rs132
-rw-r--r--components/script/dom/errorevent.rs8
-rw-r--r--components/script/dom/event.rs18
-rw-r--r--components/script/dom/eventsource.rs6
-rw-r--r--components/script/dom/eventtarget.rs14
-rw-r--r--components/script/dom/extendableevent.rs6
-rw-r--r--components/script/dom/extendablemessageevent.rs6
-rw-r--r--components/script/dom/file.rs8
-rw-r--r--components/script/dom/filelist.rs10
-rw-r--r--components/script/dom/filereader.rs8
-rw-r--r--components/script/dom/filereadersync.rs6
-rw-r--r--components/script/dom/focusevent.rs10
-rw-r--r--components/script/dom/forcetouchevent.rs4
-rw-r--r--components/script/dom/formdata.rs18
-rw-r--r--components/script/dom/gamepad.rs12
-rw-r--r--components/script/dom/gamepadbutton.rs4
-rw-r--r--components/script/dom/gamepadbuttonlist.rs10
-rw-r--r--components/script/dom/gamepadevent.rs12
-rw-r--r--components/script/dom/gamepadlist.rs12
-rw-r--r--components/script/dom/globalscope.rs24
-rw-r--r--components/script/dom/hashchangeevent.rs8
-rw-r--r--components/script/dom/headers.rs10
-rw-r--r--components/script/dom/history.rs4
-rw-r--r--components/script/dom/htmlanchorelement.rs6
-rw-r--r--components/script/dom/htmlappletelement.rs4
-rw-r--r--components/script/dom/htmlareaelement.rs6
-rw-r--r--components/script/dom/htmlaudioelement.rs4
-rw-r--r--components/script/dom/htmlbaseelement.rs4
-rw-r--r--components/script/dom/htmlbodyelement.rs4
-rw-r--r--components/script/dom/htmlbrelement.rs4
-rwxr-xr-xcomponents/script/dom/htmlbuttonelement.rs14
-rw-r--r--components/script/dom/htmlcanvaselement.rs12
-rw-r--r--components/script/dom/htmlcollection.rs46
-rw-r--r--components/script/dom/htmldataelement.rs4
-rw-r--r--components/script/dom/htmldatalistelement.rs6
-rw-r--r--components/script/dom/htmldetailselement.rs4
-rw-r--r--components/script/dom/htmldialogelement.rs4
-rw-r--r--components/script/dom/htmldirectoryelement.rs4
-rw-r--r--components/script/dom/htmldivelement.rs4
-rw-r--r--components/script/dom/htmldlistelement.rs4
-rw-r--r--components/script/dom/htmlelement.rs22
-rw-r--r--components/script/dom/htmlembedelement.rs4
-rw-r--r--components/script/dom/htmlfieldsetelement.rs12
-rw-r--r--components/script/dom/htmlfontelement.rs4
-rw-r--r--components/script/dom/htmlformcontrolscollection.rs10
-rwxr-xr-xcomponents/script/dom/htmlformelement.rs44
-rw-r--r--components/script/dom/htmlframeelement.rs4
-rw-r--r--components/script/dom/htmlframesetelement.rs4
-rw-r--r--components/script/dom/htmlheadelement.rs6
-rw-r--r--components/script/dom/htmlheadingelement.rs4
-rw-r--r--components/script/dom/htmlhrelement.rs4
-rw-r--r--components/script/dom/htmlhtmlelement.rs4
-rw-r--r--components/script/dom/htmliframeelement.rs12
-rw-r--r--components/script/dom/htmlimageelement.rs16
-rwxr-xr-xcomponents/script/dom/htmlinputelement.rs24
-rw-r--r--components/script/dom/htmllabelelement.rs18
-rw-r--r--components/script/dom/htmllegendelement.rs8
-rw-r--r--components/script/dom/htmllielement.rs4
-rw-r--r--components/script/dom/htmllinkelement.rs12
-rw-r--r--components/script/dom/htmlmapelement.rs8
-rw-r--r--components/script/dom/htmlmediaelement.rs16
-rw-r--r--components/script/dom/htmlmetaelement.rs6
-rw-r--r--components/script/dom/htmlmeterelement.rs6
-rw-r--r--components/script/dom/htmlmodelement.rs4
-rwxr-xr-xcomponents/script/dom/htmlobjectelement.rs10
-rw-r--r--components/script/dom/htmlolistelement.rs4
-rw-r--r--components/script/dom/htmloptgroupelement.rs6
-rw-r--r--components/script/dom/htmloptionelement.rs10
-rw-r--r--components/script/dom/htmloptionscollection.rs12
-rw-r--r--components/script/dom/htmloutputelement.rs12
-rw-r--r--components/script/dom/htmlparagraphelement.rs4
-rw-r--r--components/script/dom/htmlparamelement.rs4
-rw-r--r--components/script/dom/htmlpreelement.rs4
-rw-r--r--components/script/dom/htmlprogresselement.rs6
-rw-r--r--components/script/dom/htmlquoteelement.rs4
-rw-r--r--components/script/dom/htmlscriptelement.rs4
-rwxr-xr-xcomponents/script/dom/htmlselectelement.rs36
-rw-r--r--components/script/dom/htmlsourceelement.rs4
-rw-r--r--components/script/dom/htmlspanelement.rs4
-rw-r--r--components/script/dom/htmlstyleelement.rs10
-rw-r--r--components/script/dom/htmltablecaptionelement.rs4
-rw-r--r--components/script/dom/htmltablecolelement.rs4
-rw-r--r--components/script/dom/htmltabledatacellelement.rs4
-rw-r--r--components/script/dom/htmltableelement.rs40
-rw-r--r--components/script/dom/htmltableheadercellelement.rs4
-rw-r--r--components/script/dom/htmltablerowelement.rs10
-rw-r--r--components/script/dom/htmltablesectionelement.rs8
-rw-r--r--components/script/dom/htmltemplateelement.rs8
-rwxr-xr-xcomponents/script/dom/htmltextareaelement.rs10
-rw-r--r--components/script/dom/htmltimeelement.rs4
-rw-r--r--components/script/dom/htmltitleelement.rs4
-rw-r--r--components/script/dom/htmltrackelement.rs4
-rw-r--r--components/script/dom/htmlulistelement.rs4
-rw-r--r--components/script/dom/htmlunknownelement.rs4
-rw-r--r--components/script/dom/htmlvideoelement.rs4
-rw-r--r--components/script/dom/imagedata.rs10
-rw-r--r--components/script/dom/inputevent.rs6
-rw-r--r--components/script/dom/keyboardevent.rs8
-rw-r--r--components/script/dom/location.rs4
-rw-r--r--components/script/dom/macros.rs4
-rw-r--r--components/script/dom/mediaerror.rs4
-rw-r--r--components/script/dom/medialist.rs4
-rw-r--r--components/script/dom/mediaquerylist.rs4
-rw-r--r--components/script/dom/mediaquerylistevent.rs8
-rw-r--r--components/script/dom/messageevent.rs10
-rw-r--r--components/script/dom/mimetype.rs4
-rw-r--r--components/script/dom/mimetypearray.rs12
-rw-r--r--components/script/dom/mod.rs2
-rw-r--r--components/script/dom/mouseevent.rs10
-rw-r--r--components/script/dom/mutationobserver.rs20
-rw-r--r--components/script/dom/mutationrecord.rs22
-rw-r--r--components/script/dom/namednodemap.rs24
-rw-r--r--components/script/dom/navigator.rs18
-rw-r--r--components/script/dom/node.rs204
-rw-r--r--components/script/dom/nodeiterator.rs16
-rw-r--r--components/script/dom/nodelist.rs24
-rw-r--r--components/script/dom/pagetransitionevent.rs8
-rw-r--r--components/script/dom/paintrenderingcontext2d.rs10
-rw-r--r--components/script/dom/paintsize.rs4
-rw-r--r--components/script/dom/paintworkletglobalscope.rs6
-rw-r--r--components/script/dom/performance.rs30
-rw-r--r--components/script/dom/performanceentry.rs4
-rw-r--r--components/script/dom/performanceobserver.rs8
-rw-r--r--components/script/dom/performanceobserverentrylist.rs10
-rw-r--r--components/script/dom/performancepainttiming.rs4
-rw-r--r--components/script/dom/performancetiming.rs4
-rw-r--r--components/script/dom/permissions.rs6
-rw-r--r--components/script/dom/permissionstatus.rs4
-rw-r--r--components/script/dom/plugin.rs10
-rw-r--r--components/script/dom/pluginarray.rs12
-rw-r--r--components/script/dom/popstateevent.rs8
-rw-r--r--components/script/dom/processinginstruction.rs4
-rw-r--r--components/script/dom/progressevent.rs8
-rw-r--r--components/script/dom/promisenativehandler.rs4
-rw-r--r--components/script/dom/radionodelist.rs10
-rw-r--r--components/script/dom/range.rs50
-rw-r--r--components/script/dom/request.rs18
-rw-r--r--components/script/dom/response.rs14
-rw-r--r--components/script/dom/screen.rs4
-rw-r--r--components/script/dom/serviceworker.rs4
-rw-r--r--components/script/dom/serviceworkercontainer.rs6
-rw-r--r--components/script/dom/serviceworkerglobalscope.rs6
-rw-r--r--components/script/dom/serviceworkerregistration.rs24
-rw-r--r--components/script/dom/servoparser/async_html.rs12
-rw-r--r--components/script/dom/servoparser/html.rs18
-rw-r--r--components/script/dom/servoparser/mod.rs28
-rw-r--r--components/script/dom/servoparser/xml.rs4
-rw-r--r--components/script/dom/storage.rs4
-rw-r--r--components/script/dom/storageevent.rs10
-rw-r--r--components/script/dom/stylepropertymapreadonly.rs8
-rw-r--r--components/script/dom/stylesheet.rs4
-rw-r--r--components/script/dom/stylesheetlist.rs10
-rw-r--r--components/script/dom/svgsvgelement.rs4
-rw-r--r--components/script/dom/testbinding.rs40
-rw-r--r--components/script/dom/testbindingiterable.rs6
-rw-r--r--components/script/dom/testbindingpairiterable.rs6
-rw-r--r--components/script/dom/testrunner.rs4
-rw-r--r--components/script/dom/testworklet.rs6
-rw-r--r--components/script/dom/testworkletglobalscope.rs4
-rw-r--r--components/script/dom/text.rs8
-rw-r--r--components/script/dom/textdecoder.rs8
-rw-r--r--components/script/dom/textencoder.rs6
-rw-r--r--components/script/dom/touch.rs6
-rw-r--r--components/script/dom/touchevent.rs12
-rw-r--r--components/script/dom/touchlist.rs10
-rw-r--r--components/script/dom/transitionevent.rs6
-rw-r--r--components/script/dom/treewalker.rs48
-rw-r--r--components/script/dom/uievent.rs10
-rw-r--r--components/script/dom/url.rs8
-rw-r--r--components/script/dom/urlsearchparams.rs6
-rwxr-xr-xcomponents/script/dom/validitystate.rs4
-rw-r--r--components/script/dom/vr.rs24
-rw-r--r--components/script/dom/vrdisplay.rs24
-rw-r--r--components/script/dom/vrdisplaycapabilities.rs4
-rw-r--r--components/script/dom/vrdisplayevent.rs12
-rw-r--r--components/script/dom/vreyeparameters.rs8
-rw-r--r--components/script/dom/vrfieldofview.rs4
-rw-r--r--components/script/dom/vrframedata.rs10
-rw-r--r--components/script/dom/vrpose.rs4
-rw-r--r--components/script/dom/vrstageparameters.rs4
-rw-r--r--components/script/dom/webgl_extensions/ext/oesstandardderivatives.rs4
-rw-r--r--components/script/dom/webgl_extensions/ext/oestexturefloat.rs4
-rw-r--r--components/script/dom/webgl_extensions/ext/oestexturefloatlinear.rs4
-rw-r--r--components/script/dom/webgl_extensions/ext/oestexturehalffloat.rs4
-rw-r--r--components/script/dom/webgl_extensions/ext/oestexturehalffloatlinear.rs4
-rw-r--r--components/script/dom/webgl_extensions/ext/oesvertexarrayobject.rs6
-rw-r--r--components/script/dom/webgl_extensions/ext/webglvertexarrayobjectoes.rs10
-rw-r--r--components/script/dom/webgl_extensions/extension.rs4
-rw-r--r--components/script/dom/webgl_extensions/extensions.rs4
-rw-r--r--components/script/dom/webgl_extensions/wrapper.rs4
-rw-r--r--components/script/dom/webgl_validations/tex_image_2d.rs6
-rw-r--r--components/script/dom/webglactiveinfo.rs4
-rw-r--r--components/script/dom/webglbuffer.rs6
-rw-r--r--components/script/dom/webglcontextevent.rs8
-rw-r--r--components/script/dom/webglframebuffer.rs6
-rw-r--r--components/script/dom/webglprogram.rs10
-rw-r--r--components/script/dom/webglrenderbuffer.rs6
-rw-r--r--components/script/dom/webglrenderingcontext.rs34
-rw-r--r--components/script/dom/webglshader.rs6
-rw-r--r--components/script/dom/webglshaderprecisionformat.rs4
-rw-r--r--components/script/dom/webgltexture.rs6
-rw-r--r--components/script/dom/webgluniformlocation.rs4
-rw-r--r--components/script/dom/websocket.rs6
-rw-r--r--components/script/dom/window.rs62
-rw-r--r--components/script/dom/windowproxy.rs12
-rw-r--r--components/script/dom/worker.rs6
-rw-r--r--components/script/dom/workerglobalscope.rs14
-rw-r--r--components/script/dom/workerlocation.rs4
-rw-r--r--components/script/dom/workernavigator.rs6
-rw-r--r--components/script/dom/worklet.rs8
-rw-r--r--components/script/dom/workletglobalscope.rs8
-rw-r--r--components/script/dom/xmldocument.rs6
-rw-r--r--components/script/dom/xmlhttprequest.rs28
-rw-r--r--components/script/dom/xmlhttprequestupload.rs4
-rw-r--r--components/script/fetch.rs4
-rw-r--r--components/script/microtask.rs4
-rw-r--r--components/script/script_thread.rs58
-rw-r--r--components/script/webdriver_handlers.rs4
291 files changed, 1774 insertions, 1770 deletions
diff --git a/components/script/body.rs b/components/script/body.rs
index b574b112535..bdeff81e163 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<Blob>),
- FormData(Root<FormData>),
+ BlobData(DomRoot<Blob>),
+ FormData(DomRoot<FormData>),
}
// https://fetch.spec.whatwg.org/#concept-body-consume-body
diff --git a/components/script/devtools.rs b/components/script/devtools.rs
index 81c257c902f..9bcd2376167 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<Root<Node>> {
+ -> Option<DomRoot<Node>> {
documents.find_document(pipeline).and_then(|document|
document.upcast::<Node>().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 0f38e4fadfd..f2502691afd 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<T>`][root] struct. When the `Root<T>` is destroyed,
+purpose, we have a [`DomRoot<T>`][root] struct. When the `DomRoot<T>` 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<T>` structs are primarily returned from [`T::new` functions][new] when
+`DomRoot<T>` 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<T>` struct in that case.
+received allows us to; the [`DomRoot::from_ref` associated function][from-ref]
+allows creating a new `DomRoot<T>` 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<T>` through Rust's built-in
+We can then obtain a reference from the `DomRoot<T>` 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<T>`.
+through a `DomRoot<T>`.
[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<T>` guarantees that we can't use a DOM object
+- The implementation of `DomRoot<T>` 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 36b0c4c8c26..10e0ee6bb5c 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<Prefix>,
owner: Option<&Element>)
- -> Root<Attr> {
+ -> DomRoot<Attr> {
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<Root<Element>> {
+ fn GetOwnerElement(&self) -> Option<DomRoot<Element>> {
self.owner()
}
@@ -232,7 +232,7 @@ impl Attr {
self.owner.set(owner);
}
- pub fn owner(&self) -> Option<Root<Element>> {
+ pub fn owner(&self) -> Option<DomRoot<Element>> {
self.owner.get()
}
diff --git a/components/script/dom/beforeunloadevent.rs b/components/script/dom/beforeunloadevent.rs
index 0f5f476ab59..ad1f3ee2a21 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<BeforeUnloadEvent> {
+ pub fn new_uninitialized(window: &Window) -> DomRoot<BeforeUnloadEvent> {
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<BeforeUnloadEvent> {
+ cancelable: EventCancelable) -> DomRoot<BeforeUnloadEvent> {
let ev = BeforeUnloadEvent::new_uninitialized(window);
{
let event = ev.upcast::<Event>();
diff --git a/components/script/dom/bindings/callback.rs b/components/script/dom/bindings/callback.rs
index 15458499782..7a73ce60215 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<T: DomObject>(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<GlobalScope>,
+ exception_global: DomRoot<GlobalScope>,
/// 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 888a17a3a8c..8880707f7d5 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 @@ class CGWrapMethod(CGAbstractMethod):
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 @@ assert!(!proto.is_null());
%(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 @@ class CGWrapGlobalMethod(CGAbstractMethod):
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 @@ assert!(immutable);
%(unforgeable)s
-Root::from_ref(&*raw)\
+DomRoot::from_ref(&*raw)\
""" % values)
@@ -3421,7 +3421,9 @@ class CGAbstractStaticBindingMethod(CGAbstractMethod):
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::<dom::types::%s>(global).unwrap();\n" % list(self.exposureSet)[0]
+ preamble += """
+let global = DomRoot::downcast::<dom::types::%s>(global).unwrap();
+""" % list(self.exposureSet)[0]
return CGList([CGGeneric(preamble), self.generate_code()])
def generate_code(self):
@@ -5352,7 +5354,9 @@ class CGClassConstructHook(CGAbstractExternMethod):
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::<dom::types::%s>(global).unwrap();\n" % list(self.exposureSet)[0]
+ preamble += """\
+let global = DomRoot::downcast::<dom::types::%s>(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 @@ if !JS_WrapObject(cx, prototype.handle_mut()) {
return false;
}
-let result: Result<Root<%s>, Error> = html_constructor(&global, &args);
+let result: Result<DomRoot<%s>, 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 @@ class CGRegisterProxyHandlers(CGThing):
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 @@ class GlobalGenRoots():
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 df6c0a36c76..56141e52b09 100644
--- a/components/script/dom/bindings/codegen/Configuration.py
+++ b/components/script/dom/bindings/codegen/Configuration.py
@@ -212,7 +212,7 @@ class Descriptor(DescriptorProvider):
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 7528830ea7c..075f681308e 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<T>` |
+//! | interface types | `&T` | `DomRoot<T>` |
//! | dictionary types | `&T` | *unsupported* |
//! | enumeration types | `T` |
//! | callback function types | `Rc<T>` |
@@ -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<T: Float + FromJSValConvertible<Config=()>> FromJSValConvertible for Finite
}
}
-impl <T: DomObject + IDLInterface> FromJSValConvertible for Root<T> {
+impl <T: DomObject + IDLInterface> FromJSValConvertible for DomRoot<T> {
type Config = ();
unsafe fn from_jsval(_cx: *mut JSContext,
value: HandleValue,
_config: Self::Config)
- -> Result<ConversionResult<Root<T>>, ()> {
+ -> Result<ConversionResult<DomRoot<T>>, ()> {
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<T>(obj: *mut JSObject) -> Result<*const T, ()>
}
}
-/// Get a `Root<T>` for the given DOM object, unwrapping any wrapper
+/// Get a `DomRoot<T>` 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<T>(obj: *mut JSObject) -> Result<Root<T>, ()>
+pub fn root_from_object<T>(obj: *mut JSObject) -> Result<DomRoot<T>, ()>
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<T>(v: HandleValue) -> Result<*const T, ()>
native_from_object(v.get().to_object())
}
-/// Get a `Root<T>` for a DOM object accessible from a `HandleValue`.
+/// Get a `DomRoot<T>` 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<T>(v: HandleValue) -> Result<Root<T>, ()>
+pub fn root_from_handlevalue<T>(v: HandleValue) -> Result<DomRoot<T>, ()>
where T: DomObject + IDLInterface
{
if !v.get().is_object() {
@@ -439,14 +439,14 @@ pub fn root_from_handlevalue<T>(v: HandleValue) -> Result<Root<T>, ()>
root_from_object(v.get().to_object())
}
-/// Get a `Root<T>` for a DOM object accessible from a `HandleObject`.
-pub fn root_from_handleobject<T>(obj: HandleObject) -> Result<Root<T>, ()>
+/// Get a `DomRoot<T>` for a DOM object accessible from a `HandleObject`.
+pub fn root_from_handleobject<T>(obj: HandleObject) -> Result<DomRoot<T>, ()>
where T: DomObject + IDLInterface
{
root_from_object(obj.get())
}
-impl<T: DomObject> ToJSValConvertible for Root<T> {
+impl<T: DomObject> ToJSValConvertible for DomRoot<T> {
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 5e04e80ad73..5604d33aa29 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<T>(window: &Window, call_args: &CallArgs) -> Fallible<Root<T>>
+pub unsafe fn html_constructor<T>(window: &Window, call_args: &CallArgs) -> Fallible<DomRoot<T>>
where T: DerivedFrom<Element> {
let document = window.Document();
@@ -289,7 +289,7 @@ pub unsafe fn html_constructor<T>(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<T>(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<T>(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 a7bf937b5b7..fbb9894210e 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<T: DomObject + JSTraceable + Iterable> IterableIterator<T> {
pub fn new(iterable: &T,
type_: IteratorType,
wrap: unsafe fn(*mut JSContext, &GlobalScope, Box<IterableIterator<T>>)
- -> Root<Self>) -> Root<Self> {
+ -> DomRoot<Self>) -> DomRoot<Self> {
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 d2c1a484887..02f6784fb2f 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<T: DomObject> Trusted<T> {
/// Obtain a usable DOM pointer from a pinned `Trusted<T>` value. Fails if used on
/// a different thread than the original value from which this `Trusted<T>` was
/// obtained.
- pub fn root(&self) -> Root<T> {
+ pub fn root(&self) -> DomRoot<T> {
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 356086ac146..de6c8ab7c81 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<T, U>(
obj: Box<T>,
global: &U,
- wrap_fn: unsafe fn(*mut JSContext, &GlobalScope, Box<T>) -> Root<T>)
- -> Root<T>
+ wrap_fn: unsafe fn(*mut JSContext, &GlobalScope, Box<T>) -> DomRoot<T>)
+ -> DomRoot<T>
where T: DomObject, U: DerivedFrom<GlobalScope>
{
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<GlobalScope> where Self: Sized {
+ fn global(&self) -> DomRoot<GlobalScope> where Self: Sized {
GlobalScope::from_reflector(self)
}
}
diff --git a/components/script/dom/bindings/root.rs b/components/script/dom/bindings/root.rs
index 417d4b9de52..1a81965fef9 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<T>`: a stack-based reference to a rooted DOM object.
+//! - `DomRoot<T>`: a stack-based reference to a rooted DOM object.
//! - `Dom<T>`: a reference to a DOM object that can automatically be traced by
//! the GC when encountered as a field of a Rust structure.
//!
//! `Dom<T>` does not allow access to their inner value without explicitly
-//! creating a stack-based root via the `root` method. This returns a `Root<T>`,
+//! creating a stack-based root via the `root` method. This returns a `DomRoot<T>`,
//! 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<T>`.
+//! originating `DomRoot<T>`.
//!
use core::nonzero::NonZero;
@@ -259,10 +259,10 @@ impl<T: DomObject> MutDom<T> {
}
/// Get the value in this `MutDom`.
- pub fn get(&self) -> Root<T> {
+ pub fn get(&self) -> DomRoot<T> {
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<T: DomObject> MutNullableDom<T> {
/// 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<F>(&self, cb: F) -> Root<T>
- where F: FnOnce() -> Root<T>
+ pub fn or_init<F>(&self, cb: F) -> DomRoot<T>
+ where F: FnOnce() -> DomRoot<T>
{
debug_assert!(thread_state::get().is_script());
match self.get() {
@@ -337,10 +337,10 @@ impl<T: DomObject> MutNullableDom<T> {
/// Get a rooted value out of this object
#[allow(unrooted_must_root)]
- pub fn get(&self) -> Option<Root<T>> {
+ pub fn get(&self) -> Option<DomRoot<T>> {
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<T: DomObject> MutNullableDom<T> {
}
/// Gets the current value out of this object and sets it to `None`.
- pub fn take(&self) -> Option<Root<T>> {
+ pub fn take(&self) -> Option<DomRoot<T>> {
let value = self.get();
self.set(None);
value
@@ -409,7 +409,7 @@ impl<T: DomObject> DomOnceCell<T> {
/// initialized with the result of `cb` first.
#[allow(unrooted_must_root)]
pub fn init_once<F>(&self, cb: F) -> &T
- where F: FnOnce() -> Root<T>
+ where F: FnOnce() -> DomRoot<T>
{
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<T: DomObject> {
+pub struct DomRoot<T: DomObject> {
/// 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<T: Castable> Root<T> {
+impl<T: Castable> DomRoot<T> {
/// Cast a DOM object root upwards to one of the interfaces it derives from.
- pub fn upcast<U>(root: Root<T>) -> Root<U>
+ pub fn upcast<U>(root: DomRoot<T>) -> DomRoot<U>
where U: Castable,
T: DerivedFrom<U>
{
@@ -576,7 +576,7 @@ impl<T: Castable> Root<T> {
}
/// Cast a DOM object root downwards to one of the interfaces it might implement.
- pub fn downcast<U>(root: Root<T>) -> Option<Root<U>>
+ pub fn downcast<U>(root: DomRoot<T>) -> Option<DomRoot<U>>
where U: DerivedFrom<T>
{
if root.is::<U>() {
@@ -587,16 +587,16 @@ impl<T: Castable> Root<T> {
}
}
-impl<T: DomObject> Root<T> {
+impl<T: DomObject> DomRoot<T> {
/// 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<T> {
+ pub fn new(unrooted: NonZero<*const T>) -> DomRoot<T> {
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<T: DomObject> Root<T> {
}
/// Generate a new root from a reference
- pub fn from_ref(unrooted: &T) -> Root<T> {
- Root::new(unsafe { NonZero::new_unchecked(unrooted) })
+ pub fn from_ref(unrooted: &T) -> DomRoot<T> {
+ DomRoot::new(unsafe { NonZero::new_unchecked(unrooted) })
}
}
-impl<'root, T: DomObject + 'root> RootedReference<'root> for Root<T> {
+impl<'root, T: DomObject + 'root> RootedReference<'root> for DomRoot<T> {
type Ref = &'root T;
fn r(&'root self) -> &'root T {
self
}
}
-impl<T: DomObject> Deref for Root<T> {
+impl<T: DomObject> Deref for DomRoot<T> {
type Target = T;
fn deref(&self) -> &T {
debug_assert!(thread_state::get().is_script());
@@ -624,25 +624,25 @@ impl<T: DomObject> Deref for Root<T> {
}
}
-impl<T: DomObject + HeapSizeOf> HeapSizeOf for Root<T> {
+impl<T: DomObject + HeapSizeOf> HeapSizeOf for DomRoot<T> {
fn heap_size_of_children(&self) -> usize {
(**self).heap_size_of_children()
}
}
-impl<T: DomObject> PartialEq for Root<T> {
+impl<T: DomObject> PartialEq for DomRoot<T> {
fn eq(&self, other: &Self) -> bool {
self.ptr == other.ptr
}
}
-impl<T: DomObject> Clone for Root<T> {
- fn clone(&self) -> Root<T> {
- Root::from_ref(&*self)
+impl<T: DomObject> Clone for DomRoot<T> {
+ fn clone(&self) -> DomRoot<T> {
+ DomRoot::from_ref(&*self)
}
}
-impl<T: DomObject> Drop for Root<T> {
+impl<T: DomObject> Drop for DomRoot<T> {
fn drop(&mut self) {
unsafe {
(*self.root_list).unroot(self.reflector());
@@ -650,7 +650,7 @@ impl<T: DomObject> Drop for Root<T> {
}
}
-unsafe impl<T: DomObject> JSTraceable for Root<T> {
+unsafe impl<T: DomObject> JSTraceable for DomRoot<T> {
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 0d747cca205..fb708d1b235 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<GlobalScope>,
+ global: DomRoot<GlobalScope>,
}
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<GlobalScope> {
+pub fn entry_global() -> DomRoot<GlobalScope> {
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<Root<GlobalScope>> {
+pub fn incumbent_global() -> Option<DomRoot<GlobalScope>> {
// 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<Root<GlobalScope>> {
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 e23d478e5a8..bdc5348782f 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<Blob>,
+unsafe fn write_blob(blob: DomRoot<Blob>,
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 56b48b5750c..c367df5ee56 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<T: JSTraceable + 'static> JSTraceable for RootedTraceableBox<T> {
}
impl<T: JSTraceable + 'static> RootedTraceableBox<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: T) -> RootedTraceableBox<T> {
let traceable = Box::into_raw(box traceable);
unsafe {
@@ -804,7 +804,7 @@ impl<T: JSTraceable + 'static> Drop for RootedTraceableBox<T> {
/// 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<T>> {
/// Create a vector of items of type Dom<T> that is rooted for
/// the lifetime of this struct
pub fn from_iter<I>(root: &'a mut RootableVec<Dom<T>>, iter: I) -> Self
- where I: Iterator<Item = Root<T>>
+ where I: Iterator<Item = DomRoot<T>>
{
unsafe {
RootedTraceableSet::add(root);
diff --git a/components/script/dom/bindings/weakref.rs b/components/script/dom/bindings/weakref.rs
index 61a50a240b1..6ece47cea3b 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<T: WeakReferenceable> WeakRef<T> {
value.downgrade()
}
- /// Root a weak reference. Returns `None` if the object was already collected.
- pub fn root(&self) -> Option<Root<T>> {
- 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<DomRoot<T>> {
+ unsafe { &*self.ptr.get() }.value.get().map(DomRoot::new)
}
/// Return whether the weakly-referenced object is still alive.
@@ -179,9 +179,9 @@ impl<T: WeakReferenceable> MutableWeakRef<T> {
}
}
- /// 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<Root<T>> {
+ pub fn root(&self) -> Option<DomRoot<T>> {
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 7317f9f8d56..66dcc5b475c 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<Blob> {
+ -> DomRoot<Blob> {
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<Blob> {
+ relative_content_type: DOMString) -> DomRoot<Blob> {
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<Vec<BlobOrString>>,
blobPropertyBag: &BlobBinding::BlobPropertyBag)
- -> Fallible<Root<Blob>> {
+ -> Fallible<DomRoot<Blob>> {
// TODO: accept other blobParts types - ArrayBuffer or ArrayBufferView
let bytes: Vec<u8> = match blobParts {
None => Vec::new(),
@@ -369,7 +369,7 @@ impl BlobMethods for Blob {
start: Option<i64>,
end: Option<i64>,
content_type: Option<DOMString>)
- -> Root<Blob> {
+ -> DomRoot<Blob> {
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 1815a1a07bc..ac3b9b7ea53 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<Bluetooth> {
+ pub fn new(global: &GlobalScope) -> DomRoot<Bluetooth> {
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 e266cc01d15..9477c998587 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<u16>,
txPower: Option<i8>,
rssi: Option<i8>)
- -> Root<BluetoothAdvertisingEvent> {
+ -> DomRoot<BluetoothAdvertisingEvent> {
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<Root<BluetoothAdvertisingEvent>> {
+ -> Fallible<DomRoot<BluetoothAdvertisingEvent>> {
let global = window.upcast::<GlobalScope>();
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<BluetoothDevice> {
- Root::from_ref(&*self.device)
+ fn Device(&self) -> DomRoot<BluetoothDevice> {
+ 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 3afdf3d4e4c..048e52765c8 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<BluetoothCharacteristicProperties> {
+ -> DomRoot<BluetoothCharacteristicProperties> {
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 ce2f2845b2a..6c6dc5c9d6e 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<DOMString>,
context: &Bluetooth)
- -> Root<BluetoothDevice> {
+ -> DomRoot<BluetoothDevice> {
reflect_dom_object(box BluetoothDevice::new_inherited(id,
name,
context),
@@ -73,24 +73,24 @@ impl BluetoothDevice {
BluetoothDeviceBinding::Wrap)
}
- pub fn get_gatt(&self) -> Root<BluetoothRemoteGATTServer> {
+ pub fn get_gatt(&self) -> DomRoot<BluetoothRemoteGATTServer> {
self.gatt.or_init(|| {
BluetoothRemoteGATTServer::new(&self.global(), self)
})
}
- fn get_context(&self) -> Root<Bluetooth> {
- Root::from_ref(&self.context)
+ fn get_context(&self) -> DomRoot<Bluetooth> {
+ DomRoot::from_ref(&self.context)
}
pub fn get_or_create_service(&self,
service: &BluetoothServiceMsg,
server: &BluetoothRemoteGATTServer)
- -> Root<BluetoothRemoteGATTService> {
+ -> DomRoot<BluetoothRemoteGATTService> {
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<BluetoothRemoteGATTCharacteristic> {
+ -> DomRoot<BluetoothRemoteGATTCharacteristic> {
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<BluetoothRemoteGATTDescriptor> {
+ -> DomRoot<BluetoothRemoteGATTDescriptor> {
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<Root<BluetoothRemoteGATTServer>> {
+ fn GetGatt(&self) -> Option<DomRoot<BluetoothRemoteGATTServer>> {
// 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 57e22968726..ea1097c1f29 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<BluetoothPermissionResult> {
+ pub fn new(global: &GlobalScope, status: &PermissionStatus) -> DomRoot<BluetoothPermissionResult> {
reflect_dom_object(box BluetoothPermissionResult::new_inherited(status),
global,
BluetoothPermissionResultBinding::Wrap)
}
- pub fn get_bluetooth(&self) -> Root<Bluetooth> {
+ pub fn get_bluetooth(&self) -> DomRoot<Bluetooth> {
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<Root<BluetoothDevice>> {
- let device_vec: Vec<Root<BluetoothDevice>> =
- self.devices.borrow().iter().map(|d| Root::from_ref(&**d)).collect();
+ fn Devices(&self) -> Vec<DomRoot<BluetoothDevice>> {
+ let device_vec: Vec<DomRoot<BluetoothDevice>> =
+ 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 daefa2dea2f..d322d0494b4 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<BluetoothRemoteGATTCharacteristic> {
+ -> DomRoot<BluetoothRemoteGATTCharacteristic> {
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<BluetoothCharacteristicProperties> {
- Root::from_ref(&self.properties)
+ fn Properties(&self) -> DomRoot<BluetoothCharacteristicProperties> {
+ DomRoot::from_ref(&self.properties)
}
// https://webbluetoothcg.github.io/web-bluetooth/#dom-bluetoothremotegattcharacteristic-service
- fn Service(&self) -> Root<BluetoothRemoteGATTService> {
- Root::from_ref(&self.service)
+ fn Service(&self) -> DomRoot<BluetoothRemoteGATTService> {
+ 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 66a07e3b4f0..03ae0aa5651 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<BluetoothRemoteGATTDescriptor>{
+ -> DomRoot<BluetoothRemoteGATTDescriptor>{
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<BluetoothRemoteGATTCharacteristic> {
- Root::from_ref(&self.characteristic)
+ fn Characteristic(&self) -> DomRoot<BluetoothRemoteGATTCharacteristic> {
+ 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 99777f87b85..dbc477456c6 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<BluetoothRemoteGATTServer> {
+ pub fn new(global: &GlobalScope, device: &BluetoothDevice) -> DomRoot<BluetoothRemoteGATTServer> {
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<BluetoothDevice> {
- Root::from_ref(&self.device)
+ fn Device(&self) -> DomRoot<BluetoothDevice> {
+ 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 ca9f8b3286c..acb81f1f9a1 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<BluetoothRemoteGATTService> {
+ -> DomRoot<BluetoothRemoteGATTService> {
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<BluetoothDevice> {
- Root::from_ref(&self.device)
+ fn Device(&self) -> DomRoot<BluetoothDevice> {
+ 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 b6568119cfb..21bd0c3a0d1 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<CanvasGradient> {
+ pub fn new(global: &GlobalScope, style: CanvasGradientStyle) -> DomRoot<CanvasGradient> {
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 7adb6d21fbc..5c1a7edaf75 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<i32>,
repeat: RepetitionStyle,
origin_clean: bool)
- -> Root<CanvasPattern> {
+ -> DomRoot<CanvasPattern> {
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 b9e7def9a1c..de56cb28deb 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<i32>)
- -> Root<CanvasRenderingContext2D> {
+ -> DomRoot<CanvasRenderingContext2D> {
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<CanvasRenderingContext2
// FIXME: this behavior should might be generated by some annotattions to idl.
impl CanvasRenderingContext2DMethods for CanvasRenderingContext2D {
// https://html.spec.whatwg.org/multipage/#dom-context-2d-canvas
- fn Canvas(&self) -> Root<HTMLCanvasElement> {
+ fn Canvas(&self) -> DomRoot<HTMLCanvasElement> {
// 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<f64>, sh: Finite<f64>) -> Fallible<Root<ImageData>> {
+ fn CreateImageData(&self, sw: Finite<f64>, sh: Finite<f64>) -> Fallible<DomRoot<ImageData>> {
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<Root<ImageData>> {
+ fn CreateImageData_(&self, imagedata: &ImageData) -> Fallible<DomRoot<ImageData>> {
ImageData::new(&self.global(),
imagedata.Width(),
imagedata.Height(),
@@ -1111,7 +1111,7 @@ impl CanvasRenderingContext2DMethods for CanvasRenderingContext2D {
sy: Finite<f64>,
sw: Finite<f64>,
sh: Finite<f64>)
- -> Fallible<Root<ImageData>> {
+ -> Fallible<DomRoot<ImageData>> {
if !self.origin_is_clean() {
return Err(Error::Security)
}
@@ -1198,7 +1198,7 @@ impl CanvasRenderingContext2DMethods for CanvasRenderingContext2D {
y0: Finite<f64>,
x1: Finite<f64>,
y1: Finite<f64>)
- -> Root<CanvasGradient> {
+ -> DomRoot<CanvasGradient> {
CanvasGradient::new(&self.global(),
CanvasGradientStyle::Linear(LinearGradientStyle::new(*x0,
*y0,
@@ -1215,7 +1215,7 @@ impl CanvasRenderingContext2DMethods for CanvasRenderingContext2D {
x1: Finite<f64>,
y1: Finite<f64>,
r1: Finite<f64>)
- -> Fallible<Root<CanvasGradient>> {
+ -> Fallible<DomRoot<CanvasGradient>> {
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<Root<CanvasPattern>> {
+ -> Fallible<DomRoot<CanvasPattern>> {
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 4d6c3a8f011..65c84f1e2c0 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<Node> {
+ pub fn clone_with_data(&self, data: DOMString, document: &Document) -> DomRoot<Node> {
match self.upcast::<Node>().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::<ProcessingInstruction>().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<Root<Element>> {
- self.upcast::<Node>().preceding_siblings().filter_map(Root::downcast).next()
+ fn GetPreviousElementSibling(&self) -> Option<DomRoot<Element>> {
+ self.upcast::<Node>().preceding_siblings().filter_map(DomRoot::downcast).next()
}
// https://dom.spec.whatwg.org/#dom-nondocumenttypechildnode-nextelementsibling
- fn GetNextElementSibling(&self) -> Option<Root<Element>> {
- self.upcast::<Node>().following_siblings().filter_map(Root::downcast).next()
+ fn GetNextElementSibling(&self) -> Option<DomRoot<Element>> {
+ self.upcast::<Node>().following_siblings().filter_map(DomRoot::downcast).next()
}
}
diff --git a/components/script/dom/client.rs b/components/script/dom/client.rs
index 6ec88bd0cbd..e4bb8f137a1 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<Client> {
+ pub fn new(window: &Window) -> DomRoot<Client> {
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<Root<ServiceWorker>> {
+ pub fn get_controller(&self) -> Option<DomRoot<ServiceWorker>> {
self.active_worker.get()
}
diff --git a/components/script/dom/closeevent.rs b/components/script/dom/closeevent.rs
index 8af7d5414c8..ef25e97c945 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<CloseEvent> {
+ pub fn new_uninitialized(global: &GlobalScope) -> DomRoot<CloseEvent> {
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<CloseEvent> {
+ -> DomRoot<CloseEvent> {
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<Root<CloseEvent>> {
+ -> Fallible<DomRoot<CloseEvent>> {
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 e6a5f42b3db..a42ba542eb5 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<Comment> {
+ pub fn new(text: DOMString, document: &Document) -> DomRoot<Comment> {
Node::reflect_node(box Comment::new_inherited(text, document),
document,
CommentBinding::Wrap)
}
- pub fn Constructor(window: &Window, data: DOMString) -> Fallible<Root<Comment>> {
+ pub fn Constructor(window: &Window, data: DOMString) -> Fallible<DomRoot<Comment>> {
let document = window.Document();
Ok(Comment::new(data, &document))
}
diff --git a/components/script/dom/compositionevent.rs b/components/script/dom/compositionevent.rs
index 3c29e5d1b26..f28f9229742 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<CompositionEvent> {
+ data: DOMString) -> DomRoot<CompositionEvent> {
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<Root<CompositionEvent>> {
+ -> Fallible<DomRoot<CompositionEvent>> {
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 c62fc1c14c6..39e91a215e5 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<Prefix>,
document: &Document)
- -> Root<Element> {
+ -> DomRoot<Element> {
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<Element> {
+ -> DomRoot<Element> {
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::<Element>(
+ let result = DomRoot::upcast::<Element>(
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::<Element>(
+ let element = DomRoot::upcast::<Element>(
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<Prefix>,
document: &Document,
creator: ElementCreator)
- -> Root<Element> {
+ -> DomRoot<Element> {
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<Element> {
+ -> DomRoot<Element> {
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 afde6f47be9..e6c6354557f 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<Crypto> {
+ pub fn new(global: &GlobalScope) -> DomRoot<Crypto> {
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 1a72f11a5fa..f24c2003700 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<Locked<FontFaceRule>>) -> Root<CSSFontFaceRule> {
+ fontfacerule: Arc<Locked<FontFaceRule>>) -> DomRoot<CSSFontFaceRule> {
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 de5e59f2784..dec666c825e 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<CSSRuleList> {
+ fn rulelist(&self) -> DomRoot<CSSRuleList> {
let parent_stylesheet = self.upcast::<CSSRule>().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<CSSRuleList> {
+ fn CssRules(&self) -> DomRoot<CSSRuleList> {
// XXXManishearth check origin clean flag
self.rulelist()
}
diff --git a/components/script/dom/cssimportrule.rs b/components/script/dom/cssimportrule.rs
index e0f913bb81e..78233b998e6 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<Locked<ImportRule>>) -> Root<Self> {
+ import_rule: Arc<Locked<ImportRule>>) -> DomRoot<Self> {
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 17b5c7a63c4..e1883d33af3 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<Locked<Keyframe>>) -> Root<CSSKeyframeRule> {
+ keyframerule: Arc<Locked<Keyframe>>) -> DomRoot<CSSKeyframeRule> {
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<CSSStyleDeclaration> {
+ fn Style(&self) -> DomRoot<CSSStyleDeclaration> {
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 280cd53fcf6..407a3f78ff1 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<Locked<KeyframesRule>>) -> Root<CSSKeyframesRule> {
+ keyframesrule: Arc<Locked<KeyframesRule>>) -> DomRoot<CSSKeyframesRule> {
reflect_dom_object(box CSSKeyframesRule::new_inherited(parent_stylesheet, keyframesrule),
window,
CSSKeyframesRuleBinding::Wrap)
}
- fn rulelist(&self) -> Root<CSSRuleList> {
+ fn rulelist(&self) -> DomRoot<CSSRuleList> {
self.rulelist.or_init(|| {
let parent_stylesheet = &self.upcast::<CSSRule>().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<CSSRuleList> {
+ fn CssRules(&self) -> DomRoot<CSSRuleList> {
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<Root<CSSKeyframeRule>> {
+ fn FindRule(&self, selector: DOMString) -> Option<DomRoot<CSSKeyframeRule>> {
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 c77ed0b7563..3bf34bc6cf5 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<Locked<MediaRule>>) -> Root<CSSMediaRule> {
+ mediarule: Arc<Locked<MediaRule>>) -> DomRoot<CSSMediaRule> {
reflect_dom_object(box CSSMediaRule::new_inherited(parent_stylesheet, mediarule),
window,
CSSMediaRuleBinding::Wrap)
}
- fn medialist(&self) -> Root<MediaList> {
+ fn medialist(&self) -> DomRoot<MediaList> {
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<MediaList> {
+ fn Media(&self) -> DomRoot<MediaList> {
self.medialist()
}
}
diff --git a/components/script/dom/cssnamespacerule.rs b/components/script/dom/cssnamespacerule.rs
index b64b46ec4e2..0d5768d646f 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<Locked<NamespaceRule>>) -> Root<CSSNamespaceRule> {
+ namespacerule: Arc<Locked<NamespaceRule>>) -> DomRoot<CSSNamespaceRule> {
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 928762abb3c..da867be8df0 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<CSSRule> {
+ rule: StyleCssRule) -> DomRoot<CSSRule> {
// 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<Root<CSSStyleSheet>> {
+ fn GetParentStyleSheet(&self) -> Option<DomRoot<CSSStyleSheet>> {
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 1690b2f71d1..c33005d0a57 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<CSSRuleList> {
+ rules: RulesSource) -> DomRoot<CSSRuleList> {
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<Root<CSSRule>> {
+ pub fn item(&self, idx: u32) -> Option<DomRoot<CSSRule>> {
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<Root<CSSRule>> {
+ fn Item(&self, idx: u32) -> Option<DomRoot<CSSRule>> {
self.item(idx)
}
@@ -186,7 +186,7 @@ impl CSSRuleListMethods for CSSRuleList {
}
// check-tidy: no specs after this line
- fn IndexedGetter(&self, index: u32) -> Option<Root<CSSRule>> {
+ fn IndexedGetter(&self, index: u32) -> Option<DomRoot<CSSRule>> {
self.Item(index)
}
}
diff --git a/components/script/dom/cssstyledeclaration.rs b/components/script/dom/cssstyledeclaration.rs
index dc2bf64d166..f2cb3b4e5ce 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<Window> {
+ fn window(&self) -> DomRoot<Window> {
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<PseudoElement>,
modification_access: CSSModificationAccess)
- -> Root<CSSStyleDeclaration> {
+ -> DomRoot<CSSStyleDeclaration> {
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 b8b99b8aef3..e67245f835f 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<Locked<StyleRule>>) -> Root<CSSStyleRule> {
+ stylerule: Arc<Locked<StyleRule>>) -> DomRoot<CSSStyleRule> {
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<CSSStyleDeclaration> {
+ fn Style(&self) -> DomRoot<CSSStyleDeclaration> {
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 2839708e607..bf8f34977b1 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<DOMString>,
title: Option<DOMString>,
- stylesheet: Arc<StyleStyleSheet>) -> Root<CSSStyleSheet> {
+ stylesheet: Arc<StyleStyleSheet>) -> DomRoot<CSSStyleSheet> {
reflect_dom_object(box CSSStyleSheet::new_inherited(owner, type_, href, title, stylesheet),
window,
CSSStyleSheetBinding::Wrap)
}
- fn rulelist(&self) -> Root<CSSRuleList> {
+ fn rulelist(&self) -> DomRoot<CSSRuleList> {
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<Root<CSSRuleList>> {
+ fn GetCssRules(&self) -> Fallible<DomRoot<CSSRuleList>> {
if !self.origin_clean.get() {
return Err(Error::Security);
}
diff --git a/components/script/dom/cssstylevalue.rs b/components/script/dom/cssstylevalue.rs
index a2dd60d8788..a498ff7b59d 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<CSSStyleValue> {
+ pub fn new(global: &GlobalScope, value: String) -> DomRoot<CSSStyleValue> {
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 22466c85981..fe42ebba717 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<Locked<SupportsRule>>) -> Root<CSSSupportsRule> {
+ supportsrule: Arc<Locked<SupportsRule>>) -> DomRoot<CSSSupportsRule> {
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 47528100e83..afe845a7882 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<Locked<ViewportRule>>) -> Root<CSSViewportRule> {
+ viewportrule: Arc<Locked<ViewportRule>>) -> DomRoot<CSSViewportRule> {
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 503605428ab..912a4038a81 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<CustomElementRegistry> {
+ pub fn new(window: &Window) -> DomRoot<CustomElementRegistry> {
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::<Node>().traverse_preorder().filter_map(Root::downcast::<Element>) {
+ for candidate in document.upcast::<Node>().traverse_preorder().filter_map(DomRoot::downcast::<Element>) {
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>),
+ Element(DomRoot<Element>),
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<Prefix>) -> Fallible<Root<Element>> {
+ pub fn create_element(&self, document: &Document, prefix: Option<Prefix>) -> Fallible<DomRoot<Element>> {
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<Element> = match unsafe { Root::from_jsval(cx, element_val.handle(), ()) } {
+ let element: DomRoot<Element> = 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<CustomElementDefinition>, 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<Document>, Root<Document>),
+ Adopted(DomRoot<Document>, DomRoot<Document>),
AttributeChanged(LocalName, Option<DOMString>, Option<DOMString>, Namespace),
}
@@ -795,8 +795,8 @@ impl ElementQueue {
self.queue.borrow_mut().clear();
}
- fn next_element(&self) -> Option<Root<Element>> {
- self.queue.borrow_mut().pop_front().as_ref().map(Dom::deref).map(Root::from_ref)
+ fn next_element(&self) -> Option<DomRoot<Element>> {
+ 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 938ef8ed4f8..0c2d0a26a3a 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<CustomEvent> {
+ pub fn new_uninitialized(global: &GlobalScope) -> DomRoot<CustomEvent> {
reflect_dom_object(box CustomEvent::new_inherited(),
global,
CustomEventBinding::Wrap)
@@ -44,7 +44,7 @@ impl CustomEvent {
bubbles: bool,
cancelable: bool,
detail: HandleValue)
- -> Root<CustomEvent> {
+ -> DomRoot<CustomEvent> {
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<CustomEventBinding::CustomEventInit>)
- -> Fallible<Root<CustomEvent>> {
+ -> Fallible<DomRoot<CustomEvent>> {
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 a5273865283..118f2d32887 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<TimerEvent>,
timer_event_port: Receiver<(TrustedWorkerAddress, TimerEvent)>,
closing: Arc<AtomicBool>)
- -> Root<DedicatedWorkerGlobalScope> {
+ -> DomRoot<DedicatedWorkerGlobalScope> {
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::<WorkerGlobalScope>(GlobalScope::from_context(cx))
+ DomRoot::downcast::<WorkerGlobalScope>(GlobalScope::from_context(cx))
.expect("global is not a worker scope");
assert!(worker.is::<DedicatedWorkerGlobalScope>());
diff --git a/components/script/dom/dissimilaroriginlocation.rs b/components/script/dom/dissimilaroriginlocation.rs
index 249e960ff07..b75bff7620d 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<DissimilarOriginLocation> {
+ pub fn new(window: &DissimilarOriginWindow) -> DomRoot<DissimilarOriginLocation> {
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 ba1adf00c21..786169f2921 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<Self> {
+ ) -> DomRoot<Self> {
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<WindowProxy> {
- Root::from_ref(&*self.window_proxy)
+ fn Window(&self) -> DomRoot<WindowProxy> {
+ DomRoot::from_ref(&*self.window_proxy)
}
// https://html.spec.whatwg.org/multipage/#dom-self
- fn Self_(&self) -> Root<WindowProxy> {
- Root::from_ref(&*self.window_proxy)
+ fn Self_(&self) -> DomRoot<WindowProxy> {
+ DomRoot::from_ref(&*self.window_proxy)
}
// https://html.spec.whatwg.org/multipage/#dom-frames
- fn Frames(&self) -> Root<WindowProxy> {
- Root::from_ref(&*self.window_proxy)
+ fn Frames(&self) -> DomRoot<WindowProxy> {
+ DomRoot::from_ref(&*self.window_proxy)
}
// https://html.spec.whatwg.org/multipage/#dom-parent
- fn GetParent(&self) -> Option<Root<WindowProxy>> {
+ fn GetParent(&self) -> Option<DomRoot<WindowProxy>> {
// 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<Root<WindowProxy>> {
+ fn GetTop(&self) -> Option<DomRoot<WindowProxy>> {
// 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<DissimilarOriginLocation> {
+ fn Location(&self) -> DomRoot<DissimilarOriginLocation> {
self.location.or_init(|| DissimilarOriginLocation::new(self))
}
}
diff --git a/components/script/dom/document.rs b/components/script/dom/document.rs
index 7b6bd5e793c..c29314d04c1 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<Root<WindowProxy>> {
+ pub fn browsing_context(&self) -> Option<DomRoot<WindowProxy>> {
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<Root<HTMLBaseElement>> {
+ pub fn base_element(&self) -> Option<DomRoot<HTMLBaseElement>> {
self.base_element.get()
}
@@ -532,7 +532,7 @@ impl Document {
pub fn refresh_base_element(&self) {
let base = self.upcast::<Node>()
.traverse_preorder()
- .filter_map(Root::downcast::<HTMLBaseElement>)
+ .filter_map(DomRoot::downcast::<HTMLBaseElement>)
.find(|element| element.upcast::<Element>().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<Root<Element>> {
+ pub fn find_fragment_node(&self, fragid: &str) -> Option<DomRoot<Element>> {
// 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<Root<Element>> {
+ fn get_anchor_by_name(&self, name: &str) -> Option<DomRoot<Element>> {
let check_anchor = |node: &HTMLAnchorElement| {
let elem = node.upcast::<Element>();
elem.get_attribute(&ns!(), &local_name!("name"))
@@ -738,9 +738,9 @@ impl Document {
};
let doc_node = self.upcast::<Node>();
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<Root<Element>> {
+ pub fn get_focused_element(&self) -> Option<DomRoot<Element>> {
self.focused.get()
}
@@ -863,10 +863,10 @@ impl Document {
};
let el = match node.downcast::<Element>() {
- Some(el) => Root::from_ref(el),
+ Some(el) => DomRoot::from_ref(el),
None => {
let parent = node.GetParentNode();
- match parent.and_then(Root::downcast::<Element>) {
+ match parent.and_then(DomRoot::downcast::<Element>) {
Some(parent) => parent,
None => return,
}
@@ -1018,10 +1018,10 @@ impl Document {
};
let el = match node.downcast::<Element>() {
- Some(el) => Root::from_ref(el),
+ Some(el) => DomRoot::from_ref(el),
None => {
let parent = node.GetParentNode();
- match parent.and_then(Root::downcast::<Element>) {
+ match parent.and_then(DomRoot::downcast::<Element>) {
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::<Element>)
+ .filter_map(DomRoot::downcast::<Element>)
.next()
});
@@ -1169,7 +1169,7 @@ impl Document {
if !old_target_is_ancestor_of_new_target {
for element in old_target.upcast::<Node>()
.inclusive_ancestors()
- .filter_map(Root::downcast::<Element>) {
+ .filter_map(DomRoot::downcast::<Element>) {
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::<Node>()
.inclusive_ancestors()
- .filter_map(Root::downcast::<Element>) {
+ .filter_map(DomRoot::downcast::<Element>) {
if element.hover_state() {
break;
}
@@ -1229,10 +1229,10 @@ impl Document {
None => return TouchEventResult::Processed(false),
};
let el = match node.downcast::<Element>() {
- Some(el) => Root::from_ref(el),
+ Some(el) => DomRoot::from_ref(el),
None => {
let parent = node.GetParentNode();
- match parent.and_then(Root::downcast::<Element>) {
+ match parent.and_then(DomRoot::downcast::<Element>) {
Some(parent) => parent,
None => return TouchEventResult::Processed(false),
}
@@ -1253,7 +1253,7 @@ impl Document {
return TouchEventResult::Forwarded;
}
- let target = Root::upcast::<EventTarget>(el);
+ let target = DomRoot::upcast::<EventTarget>(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<NodeOrString>)
- -> Fallible<Root<Node>> {
+ -> Fallible<DomRoot<Node>> {
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::<Node>(self.CreateDocumentFragment());
+ let fragment = DomRoot::upcast::<Node>(self.CreateDocumentFragment());
for node in nodes {
match node {
NodeOrString::Node(node) => {
fragment.AppendChild(&node)?;
},
NodeOrString::String(string) => {
- let node = Root::upcast::<Node>(self.CreateTextNode(string));
+ let node = DomRoot::upcast::<Node>(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::<HTMLBodyElement>) {
+ match self.GetBody().and_then(DomRoot::downcast::<HTMLBodyElement>) {
Some(ref body) => {
body.upcast::<Element>().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::<HTMLBodyElement>) {
+ if let Some(ref body) = self.GetBody().and_then(DomRoot::downcast::<HTMLBodyElement>) {
let body = body.upcast::<Element>();
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<Root<ServoParser>> {
+ pub fn get_current_parser(&self) -> Option<DomRoot<ServoParser>> {
self.current_parser.get()
}
/// Iterate over all iframes in the document.
- pub fn iter_iframes(&self) -> impl Iterator<Item=Root<HTMLIFrameElement>> {
+ pub fn iter_iframes(&self) -> impl Iterator<Item=DomRoot<HTMLIFrameElement>> {
self.upcast::<Node>()
.traverse_preorder()
- .filter_map(Root::downcast::<HTMLIFrameElement>)
+ .filter_map(DomRoot::downcast::<HTMLIFrameElement>)
}
/// Find an iframe element in the document.
- pub fn find_iframe(&self, browsing_context_id: BrowsingContextId) -> Option<Root<HTMLIFrameElement>> {
+ pub fn find_iframe(&self, browsing_context_id: BrowsingContextId) -> Option<DomRoot<HTMLIFrameElement>> {
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<Root<HTMLIFrameElement>>
+ -> Option<DomRoot<HTMLIFrameElement>>
{
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<Root<Document>> {
+ pub fn Constructor(window: &Window) -> Fallible<DomRoot<Document>> {
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<String>,
referrer_policy: Option<ReferrerPolicy>)
- -> Root<Document> {
+ -> DomRoot<Document> {
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<F: Fn(&Node) -> bool>(&self, callback: F) -> Root<NodeList> {
+ fn create_node_list<F: Fn(&Node) -> bool>(&self, callback: F) -> DomRoot<NodeList> {
let doc = self.GetDocumentElement();
let maybe_node = doc.r().map(Castable::upcast::<Node>);
let iter = maybe_node.iter()
@@ -2370,8 +2370,8 @@ impl Document {
NodeList::new_simple_list(&self.window, iter)
}
- fn get_html_element(&self) -> Option<Root<HTMLHtmlElement>> {
- self.GetDocumentElement().and_then(Root::downcast)
+ fn get_html_element(&self) -> Option<DomRoot<HTMLHtmlElement>> {
+ 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<Root<CSSStyleSheet>> {
+ pub fn stylesheet_at(&self, index: usize) -> Option<DomRoot<CSSStyleSheet>> {
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<Document> {
+ pub fn appropriate_template_contents_owner_document(&self) -> DomRoot<Document> {
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<Root<Element>> {
- self.id_map.borrow().get(&id).map(|ref elements| Root::from_ref(&*(*elements)[0]))
+ pub fn get_element_by_id(&self, id: &Atom) -> Option<DomRoot<Element>> {
+ self.id_map.borrow().get(&id).map(|ref elements| DomRoot::from_ref(&*(*elements)[0]))
}
pub fn ensure_pending_restyle(&self, el: &Element) -> RefMut<PendingRestyle> {
@@ -2747,12 +2747,12 @@ impl Element {
impl DocumentMethods for Document {
// https://drafts.csswg.org/cssom/#dom-document-stylesheets
- fn StyleSheets(&self) -> Root<StyleSheetList> {
+ fn StyleSheets(&self) -> DomRoot<StyleSheetList> {
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<DOMImplementation> {
+ fn Implementation(&self) -> DomRoot<DOMImplementation> {
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<Root<Element>> {
+ fn GetActiveElement(&self) -> Option<DomRoot<Element>> {
// 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<Root<DocumentType>> {
- self.upcast::<Node>().children().filter_map(Root::downcast).next()
+ fn GetDoctype(&self) -> Option<DomRoot<DocumentType>> {
+ self.upcast::<Node>().children().filter_map(DomRoot::downcast).next()
}
// https://dom.spec.whatwg.org/#dom-document-documentelement
- fn GetDocumentElement(&self) -> Option<Root<Element>> {
+ fn GetDocumentElement(&self) -> Option<DomRoot<Element>> {
self.upcast::<Node>().child_elements().next()
}
// https://dom.spec.whatwg.org/#dom-document-getelementsbytagname
- fn GetElementsByTagName(&self, qualified_name: DOMString) -> Root<HTMLCollection> {
+ fn GetElementsByTagName(&self, qualified_name: DOMString) -> DomRoot<HTMLCollection> {
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<DOMString>,
tag_name: DOMString)
- -> Root<HTMLCollection> {
+ -> DomRoot<HTMLCollection> {
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<HTMLCollection> {
+ fn GetElementsByClassName(&self, classes: DOMString) -> DomRoot<HTMLCollection> {
let class_atoms: Vec<Atom> = 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<Root<Element>> {
+ fn GetElementById(&self, id: DOMString) -> Option<DomRoot<Element>> {
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<Root<Element>> {
+ -> Fallible<DomRoot<Element>> {
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<DOMString>,
qualified_name: DOMString,
options: &ElementCreationOptions)
- -> Fallible<Root<Element>> {
+ -> Fallible<DomRoot<Element>> {
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<Root<Attr>> {
+ fn CreateAttribute(&self, mut local_name: DOMString) -> Fallible<DomRoot<Attr>> {
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<DOMString>,
qualified_name: DOMString)
- -> Fallible<Root<Attr>> {
+ -> Fallible<DomRoot<Attr>> {
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<DocumentFragment> {
+ fn CreateDocumentFragment(&self) -> DomRoot<DocumentFragment> {
DocumentFragment::new(self)
}
// https://dom.spec.whatwg.org/#dom-document-createtextnode
- fn CreateTextNode(&self, data: DOMString) -> Root<Text> {
+ fn CreateTextNode(&self, data: DOMString) -> DomRoot<Text> {
Text::new(data, self)
}
// https://dom.spec.whatwg.org/#dom-document-createcomment
- fn CreateComment(&self, data: DOMString) -> Root<Comment> {
+ fn CreateComment(&self, data: DOMString) -> DomRoot<Comment> {
Comment::new(data, self)
}
@@ -3051,7 +3051,7 @@ impl DocumentMethods for Document {
fn CreateProcessingInstruction(&self,
target: DOMString,
data: DOMString)
- -> Fallible<Root<ProcessingInstruction>> {
+ -> Fallible<DomRoot<ProcessingInstruction>> {
// 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<Root<Node>> {
+ fn ImportNode(&self, node: &Node, deep: bool) -> Fallible<DomRoot<Node>> {
// Step 1.
if node.is::<Document>() {
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<Root<Node>> {
+ fn AdoptNode(&self, node: &Node) -> Fallible<DomRoot<Node>> {
// Step 1.
if node.is::<Document>() {
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<Root<Event>> {
+ fn CreateEvent(&self, mut interface: DOMString) -> Fallible<DomRoot<Event>> {
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<Range> {
+ fn CreateRange(&self) -> DomRoot<Range> {
Range::new_with_doc(self)
}
@@ -3165,7 +3165,7 @@ impl DocumentMethods for Document {
root: &Node,
what_to_show: u32,
filter: Option<Rc<NodeFilter>>)
- -> Root<NodeIterator> {
+ -> DomRoot<NodeIterator> {
NodeIterator::new(self, root, what_to_show, filter)
}
@@ -3178,7 +3178,7 @@ impl DocumentMethods for Document {
page_y: Finite<f64>,
screen_x: Finite<f64>,
screen_y: Finite<f64>)
- -> Root<Touch> {
+ -> DomRoot<Touch> {
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<TouchList> {
+ fn CreateTouchList(&self, touches: &[&Touch]) -> DomRoot<TouchList> {
TouchList::new(&self.window, &touches)
}
@@ -3202,7 +3202,7 @@ impl DocumentMethods for Document {
root: &Node,
what_to_show: u32,
filter: Option<Rc<NodeFilter>>)
- -> Root<TreeWalker> {
+ -> DomRoot<TreeWalker> {
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::<Node>)
+ .map(DomRoot::upcast::<Node>)
} else {
// Step 2.
root.upcast::<Node>()
@@ -3247,7 +3247,7 @@ impl DocumentMethods for Document {
node.namespace() == &ns!(svg) && node.local_name() == &local_name!("title")
});
match elem {
- Some(elem) => Root::upcast::<Node>(elem),
+ Some(elem) => DomRoot::upcast::<Node>(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<Root<HTMLHeadElement>> {
+ fn GetHead(&self) -> Option<DomRoot<HTMLHeadElement>> {
self.get_html_element()
- .and_then(|root| root.upcast::<Node>().children().filter_map(Root::downcast).next())
+ .and_then(|root| root.upcast::<Node>().children().filter_map(DomRoot::downcast).next())
}
// https://html.spec.whatwg.org/multipage/#dom-document-currentscript
- fn GetCurrentScript(&self) -> Option<Root<HTMLScriptElement>> {
+ fn GetCurrentScript(&self) -> Option<DomRoot<HTMLScriptElement>> {
self.current_script.get()
}
// https://html.spec.whatwg.org/multipage/#dom-document-body
- fn GetBody(&self) -> Option<Root<HTMLElement>> {
+ fn GetBody(&self) -> Option<DomRoot<HTMLElement>> {
self.get_html_element().and_then(|root| {
let node = root.upcast::<Node>();
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<NodeList> {
+ fn GetElementsByName(&self, name: DOMString) -> DomRoot<NodeList> {
self.create_node_list(|node| {
let element = match node.downcast::<Element>() {
Some(element) => element,
@@ -3372,7 +3372,7 @@ impl DocumentMethods for Document {
}
// https://html.spec.whatwg.org/multipage/#dom-document-images
- fn Images(&self) -> Root<HTMLCollection> {
+ fn Images(&self) -> DomRoot<HTMLCollection> {
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<HTMLCollection> {
+ fn Embeds(&self) -> DomRoot<HTMLCollection> {
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<HTMLCollection> {
+ fn Plugins(&self) -> DomRoot<HTMLCollection> {
self.Embeds()
}
// https://html.spec.whatwg.org/multipage/#dom-document-links
- fn Links(&self) -> Root<HTMLCollection> {
+ fn Links(&self) -> DomRoot<HTMLCollection> {
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<HTMLCollection> {
+ fn Forms(&self) -> DomRoot<HTMLCollection> {
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<HTMLCollection> {
+ fn Scripts(&self) -> DomRoot<HTMLCollection> {
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<HTMLCollection> {
+ fn Anchors(&self) -> DomRoot<HTMLCollection> {
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<HTMLCollection> {
+ fn Applets(&self) -> DomRoot<HTMLCollection> {
// 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<Root<Location>> {
+ fn GetLocation(&self) -> Option<DomRoot<Location>> {
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<HTMLCollection> {
+ fn Children(&self) -> DomRoot<HTMLCollection> {
HTMLCollection::children(&self.window, self.upcast())
}
// https://dom.spec.whatwg.org/#dom-parentnode-firstelementchild
- fn GetFirstElementChild(&self) -> Option<Root<Element>> {
+ fn GetFirstElementChild(&self) -> Option<DomRoot<Element>> {
self.upcast::<Node>().child_elements().next()
}
// https://dom.spec.whatwg.org/#dom-parentnode-lastelementchild
- fn GetLastElementChild(&self) -> Option<Root<Element>> {
- self.upcast::<Node>().rev_children().filter_map(Root::downcast).next()
+ fn GetLastElementChild(&self) -> Option<DomRoot<Element>> {
+ self.upcast::<Node>().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<Option<Root<Element>>> {
+ fn QuerySelector(&self, selectors: DOMString) -> Fallible<Option<DomRoot<Element>>> {
let root = self.upcast::<Node>();
root.query_selector(selectors)
}
// https://dom.spec.whatwg.org/#dom-parentnode-queryselectorall
- fn QuerySelectorAll(&self, selectors: DOMString) -> Fallible<Root<NodeList>> {
+ fn QuerySelectorAll(&self, selectors: DOMString) -> Fallible<DomRoot<NodeList>> {
let root = self.upcast::<Node>();
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<Root<Window>> {
+ fn GetDefaultView(&self) -> Option<DomRoot<Window>> {
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<f64>, y: Finite<f64>) -> Option<Root<Element>> {
+ fn ElementFromPoint(&self, x: Finite<f64>, y: Finite<f64>) -> Option<DomRoot<Element>> {
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::<Element>().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<f64>, y: Finite<f64>) -> Vec<Root<Element>> {
+ fn ElementsFromPoint(&self, x: Finite<f64>, y: Finite<f64>) -> Vec<DomRoot<Element>> {
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<Root<Element>> = self.nodes_from_point(point).iter()
+ let mut elements: Vec<DomRoot<Element>> = 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::<Element>(node)
+ DomRoot::downcast::<Element>(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<Root<Document>> {
+ fn Open(&self, type_: DOMString, replace: DOMString) -> Fallible<DomRoot<Document>> {
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<Root<Element>> {
+ fn GetFullscreenElement(&self) -> Option<DomRoot<Element>> {
// 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<HTMLScriptElement>, ScriptResult)> {
+ fn take_next_ready_to_be_executed(&self) -> Option<(DomRoot<HTMLScriptElement>, 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<HTMLScriptElement>, ScriptResult)> {
- self.load.take().map(|result| (Root::from_ref(&*self.element), result))
+ fn take_result(&mut self) -> Option<(DomRoot<HTMLScriptElement>, 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 f43d93f8517..320d3341691 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<DocumentFragment> {
+ pub fn new(document: &Document) -> DomRoot<DocumentFragment> {
Node::reflect_node(box DocumentFragment::new_inherited(document),
document,
DocumentFragmentBinding::Wrap)
}
- pub fn Constructor(window: &Window) -> Fallible<Root<DocumentFragment>> {
+ pub fn Constructor(window: &Window) -> Fallible<DomRoot<DocumentFragment>> {
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<HTMLCollection> {
+ fn Children(&self) -> DomRoot<HTMLCollection> {
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<Root<Element>> {
+ fn GetElementById(&self, id: DOMString) -> Option<DomRoot<Element>> {
let node = self.upcast::<Node>();
let id = Atom::from(id);
- node.traverse_preorder().filter_map(Root::downcast::<Element>).find(|descendant| {
+ node.traverse_preorder().filter_map(DomRoot::downcast::<Element>).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<Root<Element>> {
+ fn GetFirstElementChild(&self) -> Option<DomRoot<Element>> {
self.upcast::<Node>().child_elements().next()
}
// https://dom.spec.whatwg.org/#dom-parentnode-lastelementchild
- fn GetLastElementChild(&self) -> Option<Root<Element>> {
- self.upcast::<Node>().rev_children().filter_map(Root::downcast::<Element>).next()
+ fn GetLastElementChild(&self) -> Option<DomRoot<Element>> {
+ self.upcast::<Node>().rev_children().filter_map(DomRoot::downcast::<Element>).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<Option<Root<Element>>> {
+ fn QuerySelector(&self, selectors: DOMString) -> Fallible<Option<DomRoot<Element>>> {
self.upcast::<Node>().query_selector(selectors)
}
// https://dom.spec.whatwg.org/#dom-parentnode-queryselectorall
- fn QuerySelectorAll(&self, selectors: DOMString) -> Fallible<Root<NodeList>> {
+ fn QuerySelectorAll(&self, selectors: DOMString) -> Fallible<DomRoot<NodeList>> {
self.upcast::<Node>().query_selector_all(selectors)
}
}
diff --git a/components/script/dom/documenttype.rs b/components/script/dom/documenttype.rs
index 4eb83c39c91..5fd83343570 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<DOMString>,
system_id: Option<DOMString>,
document: &Document)
- -> Root<DocumentType> {
+ -> DomRoot<DocumentType> {
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 933818e1a4f..c9fc953950a 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<DOMException> {
+ pub fn new(global: &GlobalScope, code: DOMErrorName) -> DomRoot<DOMException> {
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 189a10412c3..93ba4b287ff 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<DOMImplementation> {
+ pub fn new(document: &Document) -> DomRoot<DOMImplementation> {
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<Root<DocumentType>> {
+ -> Fallible<DomRoot<DocumentType>> {
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<DOMString>,
qname: DOMString,
maybe_doctype: Option<&DocumentType>)
- -> Fallible<Root<XMLDocument>> {
+ -> Fallible<DomRoot<XMLDocument>> {
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<DOMString>) -> Root<Document> {
+ fn CreateHTMLDocument(&self, title: Option<DOMString>) -> DomRoot<Document> {
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::<Node>();
- let doc_html = Root::upcast::<Node>(HTMLHtmlElement::new(local_name!("html"),
+ let doc_html = DomRoot::upcast::<Node>(HTMLHtmlElement::new(local_name!("html"),
None,
&doc));
doc_node.AppendChild(&doc_html).expect("Appending failed");
{
// Step 5.
- let doc_head = Root::upcast::<Node>(HTMLHeadElement::new(local_name!("head"),
+ let doc_head = DomRoot::upcast::<Node>(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::<Node>(HTMLTitleElement::new(local_name!("title"),
+ DomRoot::upcast::<Node>(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 869dd38d59b..9bf315299f4 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<f64>) -> Root<Self> {
+ pub fn new(global: &GlobalScope, is2D: bool, matrix: Transform3D<f64>) -> DomRoot<Self> {
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<Root<Self>> {
+ pub fn Constructor(global: &GlobalScope) -> Fallible<DomRoot<Self>> {
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<f64>) -> Fallible<Root<Self>> {
+ pub fn Constructor_(global: &GlobalScope, entries: Vec<f64>) -> Fallible<DomRoot<Self>> {
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<Root<Self>> {
+ pub fn FromMatrix(global: &GlobalScope, other: &DOMMatrixInit) -> Fallible<DomRoot<Self>> {
dommatrixinit_to_matrix(&other)
.map(|(is2D, matrix)| {
Self::new(global, is2D, matrix)
})
}
- pub fn from_readonly(global: &GlobalScope, ro: &DOMMatrixReadOnly) -> Root<Self> {
+ pub fn from_readonly(global: &GlobalScope, ro: &DOMMatrixReadOnly) -> DomRoot<Self> {
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<Root<DOMMatrix>> {
+ fn MultiplySelf(&self, other:&DOMMatrixInit) -> Fallible<DomRoot<DOMMatrix>> {
// Steps 1-3.
self.upcast::<DOMMatrixReadOnly>().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<Root<DOMMatrix>> {
+ fn PreMultiplySelf(&self, other:&DOMMatrixInit) -> Fallible<DomRoot<DOMMatrix>> {
// Steps 1-3.
self.upcast::<DOMMatrixReadOnly>().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<DOMMatrix> {
+ fn TranslateSelf(&self, tx: f64, ty: f64, tz: f64) -> DomRoot<DOMMatrix> {
// Steps 1-2.
self.upcast::<DOMMatrixReadOnly>().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<f64>, scaleZ: f64,
- originX: f64, originY: f64, originZ: f64) -> Root<DOMMatrix> {
+ originX: f64, originY: f64, originZ: f64) -> DomRoot<DOMMatrix> {
// Steps 1-6.
self.upcast::<DOMMatrixReadOnly>().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<DOMMatrix> {
+ fn Scale3dSelf(&self, scale: f64, originX: f64, originY: f64, originZ: f64) -> DomRoot<DOMMatrix> {
// Steps 1-4.
self.upcast::<DOMMatrixReadOnly>().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<f64>, rotZ: Option<f64>) -> Root<DOMMatrix> {
+ fn RotateSelf(&self, rotX: f64, rotY: Option<f64>, rotZ: Option<f64>) -> DomRoot<DOMMatrix> {
// Steps 1-7.
self.upcast::<DOMMatrixReadOnly>().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<DOMMatrix> {
+ fn RotateFromVectorSelf(&self, x: f64, y: f64) -> DomRoot<DOMMatrix> {
// Step 1.
self.upcast::<DOMMatrixReadOnly>().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<DOMMatrix> {
+ fn RotateAxisAngleSelf(&self, x: f64, y: f64, z: f64, angle: f64) -> DomRoot<DOMMatrix> {
// Steps 1-2.
self.upcast::<DOMMatrixReadOnly>().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<DOMMatrix> {
+ fn SkewXSelf(&self, sx: f64) -> DomRoot<DOMMatrix> {
// Step 1.
self.upcast::<DOMMatrixReadOnly>().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<DOMMatrix> {
+ fn SkewYSelf(&self, sy: f64) -> DomRoot<DOMMatrix> {
// Step 1.
self.upcast::<DOMMatrixReadOnly>().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<DOMMatrix> {
+ fn InvertSelf(&self) -> DomRoot<DOMMatrix> {
// Steps 1-2.
self.upcast::<DOMMatrixReadOnly>().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 0b6e8be3b6a..82aa96ba7b7 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<f64>) -> Root<Self> {
+ pub fn new(global: &GlobalScope, is2D: bool, matrix: Transform3D<f64>) -> DomRoot<Self> {
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<Root<Self>> {
+ pub fn Constructor(global: &GlobalScope) -> Fallible<DomRoot<Self>> {
Ok(Self::new(global, true, Transform3D::identity()))
}
// https://drafts.fxtf.org/geometry-1/#dom-dommatrixreadonly-dommatrixreadonly-numbersequence
- pub fn Constructor_(global: &GlobalScope, entries: Vec<f64>) -> Fallible<Root<Self>> {
+ pub fn Constructor_(global: &GlobalScope, entries: Vec<f64>) -> Fallible<DomRoot<Self>> {
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<Root<Self>> {
+ pub fn FromMatrix(global: &GlobalScope, other: &DOMMatrixInit) -> Fallible<DomRoot<Self>> {
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<DOMMatrix> {
+ fn Translate(&self, tx: f64, ty: f64, tz: f64) -> DomRoot<DOMMatrix> {
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<f64>, scaleZ: f64,
- originX: f64, originY: f64, originZ: f64) -> Root<DOMMatrix> {
+ originX: f64, originY: f64, originZ: f64) -> DomRoot<DOMMatrix> {
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<DOMMatrix> {
+ fn Scale3d(&self, scale: f64, originX: f64, originY: f64, originZ: f64) -> DomRoot<DOMMatrix> {
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<f64>, rotZ: Option<f64>) -> Root<DOMMatrix> {
+ fn Rotate(&self, rotX: f64, rotY: Option<f64>, rotZ: Option<f64>) -> DomRoot<DOMMatrix> {
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<DOMMatrix> {
+ fn RotateFromVector(&self, x: f64, y: f64) -> DomRoot<DOMMatrix> {
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<DOMMatrix> {
+ fn RotateAxisAngle(&self, x: f64, y: f64, z: f64, angle: f64) -> DomRoot<DOMMatrix> {
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<DOMMatrix> {
+ fn SkewX(&self, sx: f64) -> DomRoot<DOMMatrix> {
DOMMatrix::from_readonly(&self.global(), self).SkewXSelf(sx)
}
// https://drafts.fxtf.org/geometry-1/#dom-dommatrixreadonly-skewy
- fn SkewY(&self, sy: f64) -> Root<DOMMatrix> {
+ fn SkewY(&self, sy: f64) -> DomRoot<DOMMatrix> {
DOMMatrix::from_readonly(&self.global(), self).SkewYSelf(sy)
}
// https://drafts.fxtf.org/geometry-1/#dom-dommatrixreadonly-multiply
- fn Multiply(&self, other: &DOMMatrixInit) -> Fallible<Root<DOMMatrix>> {
+ fn Multiply(&self, other: &DOMMatrixInit) -> Fallible<DomRoot<DOMMatrix>> {
DOMMatrix::from_readonly(&self.global(), self).MultiplySelf(&other)
}
// https://drafts.fxtf.org/geometry-1/#dom-dommatrixreadonly-flipx
- fn FlipX(&self) -> Root<DOMMatrix> {
+ fn FlipX(&self) -> DomRoot<DOMMatrix> {
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<DOMMatrix> {
+ fn FlipY(&self) -> DomRoot<DOMMatrix> {
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<DOMMatrix> {
+ fn Inverse(&self) -> DomRoot<DOMMatrix> {
DOMMatrix::from_readonly(&self.global(), self).InvertSelf()
}
// https://drafts.fxtf.org/geometry-1/#dom-dommatrixreadonly-transformpoint
- fn TransformPoint(&self, point: &DOMPointInit) -> Root<DOMPoint> {
+ fn TransformPoint(&self, point: &DOMPointInit) -> DomRoot<DOMPoint> {
// 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 6181087acd7..957b93f59b2 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<DOMParser> {
+ pub fn new(window: &Window) -> DomRoot<DOMParser> {
reflect_dom_object(box DOMParser::new_inherited(window),
window,
DOMParserBinding::Wrap)
}
- pub fn Constructor(window: &Window) -> Fallible<Root<DOMParser>> {
+ pub fn Constructor(window: &Window) -> Fallible<DomRoot<DOMParser>> {
Ok(DOMParser::new(window))
}
}
@@ -52,7 +52,7 @@ impl DOMParserMethods for DOMParser {
fn ParseFromString(&self,
s: DOMString,
ty: DOMParserBinding::SupportedType)
- -> Fallible<Root<Document>> {
+ -> Fallible<DomRoot<Document>> {
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 44fe7a99ea7..8f27603a456 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<DOMPoint> {
+ pub fn new(global: &GlobalScope, x: f64, y: f64, z: f64, w: f64) -> DomRoot<DOMPoint> {
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<Root<DOMPoint>> {
+ -> Fallible<DomRoot<DOMPoint>> {
Ok(DOMPoint::new(global, x, y, z, w))
}
- pub fn new_from_init(global: &GlobalScope, p: &DOMPointInit) -> Root<DOMPoint> {
+ pub fn new_from_init(global: &GlobalScope, p: &DOMPointInit) -> DomRoot<DOMPoint> {
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 ae9cab6f3f9..13ec9ee8c0f 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<DOMPointReadOnly> {
+ pub fn new(global: &GlobalScope, x: f64, y: f64, z: f64, w: f64) -> DomRoot<DOMPointReadOnly> {
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<Root<DOMPointReadOnly>> {
+ -> Fallible<DomRoot<DOMPointReadOnly>> {
Ok(DOMPointReadOnly::new(global, x, y, z, w))
}
}
diff --git a/components/script/dom/domquad.rs b/components/script/dom/domquad.rs
index f31cfc3e05e..54c07b8275c 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<DOMQuad> {
+ p4: &DOMPoint) -> DomRoot<DOMQuad> {
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<Root<DOMQuad>> {
+ -> Fallible<DomRoot<DOMQuad>> {
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<DOMQuad> {
+ pub fn FromRect(global: &GlobalScope, other: &DOMRectInit) -> DomRoot<DOMQuad> {
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<DOMQuad> {
+ pub fn FromQuad(global: &GlobalScope, other: &DOMQuadInit) -> DomRoot<DOMQuad> {
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<DOMPoint> {
- Root::from_ref(&self.p1)
+ fn P1(&self) -> DomRoot<DOMPoint> {
+ DomRoot::from_ref(&self.p1)
}
// https://drafts.fxtf.org/geometry/#dom-domquad-p2
- fn P2(&self) -> Root<DOMPoint> {
- Root::from_ref(&self.p2)
+ fn P2(&self) -> DomRoot<DOMPoint> {
+ DomRoot::from_ref(&self.p2)
}
// https://drafts.fxtf.org/geometry/#dom-domquad-p3
- fn P3(&self) -> Root<DOMPoint> {
- Root::from_ref(&self.p3)
+ fn P3(&self) -> DomRoot<DOMPoint> {
+ DomRoot::from_ref(&self.p3)
}
// https://drafts.fxtf.org/geometry/#dom-domquad-p4
- fn P4(&self) -> Root<DOMPoint> {
- Root::from_ref(&self.p4)
+ fn P4(&self) -> DomRoot<DOMPoint> {
+ DomRoot::from_ref(&self.p4)
}
// https://drafts.fxtf.org/geometry/#dom-domquad-getbounds
- fn GetBounds(&self) -> Root<DOMRect> {
+ fn GetBounds(&self) -> DomRoot<DOMRect> {
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 5cad05c23f7..4933619d172 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<DOMRect> {
+ pub fn new(global: &GlobalScope, x: f64, y: f64, width: f64, height: f64) -> DomRoot<DOMRect> {
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<Root<DOMRect>> {
+ -> Fallible<DomRoot<DOMRect>> {
Ok(DOMRect::new(global, x, y, width, height))
}
}
diff --git a/components/script/dom/domrectreadonly.rs b/components/script/dom/domrectreadonly.rs
index 7427cf22b8d..fe590b0e749 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<DOMRectReadOnly> {
+ -> DomRoot<DOMRectReadOnly> {
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<Root<DOMRectReadOnly>> {
+ -> Fallible<DomRoot<DOMRectReadOnly>> {
Ok(DOMRectReadOnly::new(global, x, y, width, height))
}
diff --git a/components/script/dom/domstringmap.rs b/components/script/dom/domstringmap.rs
index ae7387c2825..c349a9d5259 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<DOMStringMap> {
+ pub fn new(element: &HTMLElement) -> DomRoot<DOMStringMap> {
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 96fd1226950..22f0a45654b 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<DOMTokenList> {
+ pub fn new(element: &Element, local_name: &LocalName) -> DomRoot<DOMTokenList> {
let window = window_from_node(element);
reflect_dom_object(box DOMTokenList::new_inherited(element, local_name.clone()),
&*window,
DOMTokenListBinding::Wrap)
}
- fn attribute(&self) -> Option<Root<Attr>> {
+ fn attribute(&self) -> Option<DomRoot<Attr>> {
self.element.get_attribute(&ns!(), &self.local_name)
}
diff --git a/components/script/dom/element.rs b/components/script/dom/element.rs
index 30fa0b59b4a..50942510006 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<Element> {
+impl fmt::Debug for DomRoot<Element> {
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<Element> {
+ -> DomRoot<Element> {
create_element(name, is, document, creator, mode)
}
@@ -273,7 +273,7 @@ impl Element {
pub fn new(local_name: LocalName,
namespace: Namespace,
prefix: Option<Prefix>,
- document: &Document) -> Root<Element> {
+ document: &Document) -> DomRoot<Element> {
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::<Node>()
.inclusive_ancestors()
- .filter_map(Root::downcast::<Self>);
+ .filter_map(DomRoot::downcast::<Self>);
// Steps 3-4.
for element in inclusive_ancestor_elements {
@@ -1002,7 +1002,7 @@ impl Element {
}
}
- pub fn root_element(&self) -> Root<Element> {
+ pub fn root_element(&self) -> DomRoot<Element> {
if self.node.is_in_doc() {
self.upcast::<Node>()
.owner_doc()
@@ -1011,7 +1011,7 @@ impl Element {
} else {
self.upcast::<Node>()
.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<Root<Attr>> {
+ pub fn get_attribute(&self, namespace: &Namespace, local_name: &LocalName) -> Option<DomRoot<Attr>> {
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<Root<Attr>> {
+ pub fn get_attribute_by_name(&self, name: DOMString) -> Option<DomRoot<Attr>> {
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<Root<Attr>> {
+ pub fn remove_attribute(&self, namespace: &Namespace, local_name: &LocalName) -> Option<DomRoot<Attr>> {
self.remove_first_matching_attribute(|attr| {
attr.namespace() == namespace && attr.local_name() == local_name
})
}
- pub fn remove_attribute_by_name(&self, name: &LocalName) -> Option<Root<Attr>> {
+ pub fn remove_attribute_by_name(&self, name: &LocalName) -> Option<DomRoot<Attr>> {
self.remove_first_matching_attribute(|attr| attr.name() == name)
}
- fn remove_first_matching_attribute<F>(&self, find: F) -> Option<Root<Attr>>
+ fn remove_first_matching_attribute<F>(&self, find: F) -> Option<DomRoot<Attr>>
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<Option<Root<Node>>> {
+ -> Fallible<Option<DomRoot<Node>>> {
let self_node = self.upcast::<Node>();
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<Root<DocumentFragment>> {
+ pub fn parse_fragment(&self, markup: DOMString) -> Fallible<DomRoot<DocumentFragment>> {
// 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<Self> {
+ pub fn fragment_parsing_context(owner_doc: &Document, element: Option<&Self>) -> DomRoot<Self> {
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<DOMTokenList> {
+ fn ClassList(&self) -> DomRoot<DOMTokenList> {
self.class_list.or_init(|| DOMTokenList::new(self, &local_name!("class")))
}
// https://dom.spec.whatwg.org/#dom-element-attributes
- fn Attributes(&self) -> Root<NamedNodeMap> {
+ fn Attributes(&self) -> DomRoot<NamedNodeMap> {
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<Root<Attr>> {
+ fn GetAttributeNode(&self, name: DOMString) -> Option<DomRoot<Attr>> {
self.get_attribute_by_name(name)
}
@@ -1611,7 +1611,7 @@ impl ElementMethods for Element {
fn GetAttributeNodeNS(&self,
namespace: Option<DOMString>,
local_name: DOMString)
- -> Option<Root<Attr>> {
+ -> Option<DomRoot<Attr>> {
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<Option<Root<Attr>>> {
+ fn SetAttributeNode(&self, attr: &Attr) -> Fallible<Option<DomRoot<Attr>>> {
// 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<Option<Root<Attr>>> {
+ fn SetAttributeNodeNS(&self, attr: &Attr) -> Fallible<Option<DomRoot<Attr>>> {
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<Root<Attr>> {
+ fn RemoveAttributeNode(&self, attr: &Attr) -> Fallible<DomRoot<Attr>> {
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<HTMLCollection> {
+ fn GetElementsByTagName(&self, localname: DOMString) -> DomRoot<HTMLCollection> {
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<DOMString>,
localname: DOMString)
- -> Root<HTMLCollection> {
+ -> DomRoot<HTMLCollection> {
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<HTMLCollection> {
+ fn GetElementsByClassName(&self, classes: DOMString) -> DomRoot<HTMLCollection> {
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<Root<DOMRect>> {
+ fn GetClientRects(&self) -> Vec<DomRoot<DOMRect>> {
let win = window_from_node(self);
let raw_rects = self.upcast::<Node>().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<DOMRect> {
+ fn GetBoundingClientRect(&self) -> DomRoot<DOMRect> {
let win = window_from_node(self);
let rect = self.upcast::<Node>().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::<HTMLTemplateElement>() {
- 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<Root<Element>> {
- self.upcast::<Node>().preceding_siblings().filter_map(Root::downcast).next()
+ fn GetPreviousElementSibling(&self) -> Option<DomRoot<Element>> {
+ self.upcast::<Node>().preceding_siblings().filter_map(DomRoot::downcast).next()
}
// https://dom.spec.whatwg.org/#dom-nondocumenttypechildnode-nextelementsibling
- fn GetNextElementSibling(&self) -> Option<Root<Element>> {
- self.upcast::<Node>().following_siblings().filter_map(Root::downcast).next()
+ fn GetNextElementSibling(&self) -> Option<DomRoot<Element>> {
+ self.upcast::<Node>().following_siblings().filter_map(DomRoot::downcast).next()
}
// https://dom.spec.whatwg.org/#dom-parentnode-children
- fn Children(&self) -> Root<HTMLCollection> {
+ fn Children(&self) -> DomRoot<HTMLCollection> {
let window = window_from_node(self);
HTMLCollection::children(&window, self.upcast())
}
// https://dom.spec.whatwg.org/#dom-parentnode-firstelementchild
- fn GetFirstElementChild(&self) -> Option<Root<Element>> {
+ fn GetFirstElementChild(&self) -> Option<DomRoot<Element>> {
self.upcast::<Node>().child_elements().next()
}
// https://dom.spec.whatwg.org/#dom-parentnode-lastelementchild
- fn GetLastElementChild(&self) -> Option<Root<Element>> {
- self.upcast::<Node>().rev_children().filter_map(Root::downcast::<Element>).next()
+ fn GetLastElementChild(&self) -> Option<DomRoot<Element>> {
+ self.upcast::<Node>().rev_children().filter_map(DomRoot::downcast::<Element>).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<Option<Root<Element>>> {
+ fn QuerySelector(&self, selectors: DOMString) -> Fallible<Option<DomRoot<Element>>> {
let root = self.upcast::<Node>();
root.query_selector(selectors)
}
// https://dom.spec.whatwg.org/#dom-parentnode-queryselectorall
- fn QuerySelectorAll(&self, selectors: DOMString) -> Fallible<Root<NodeList>> {
+ fn QuerySelectorAll(&self, selectors: DOMString) -> Fallible<DomRoot<NodeList>> {
let root = self.upcast::<Node>();
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<Option<Root<Element>>> {
+ fn Closest(&self, selectors: DOMString) -> Fallible<Option<DomRoot<Element>>> {
match SelectorParser::parse_author_origin_no_namespace(&selectors) {
Err(_) => Err(Error::Syntax),
Ok(selectors) => {
let root = self.upcast::<Node>();
for element in root.inclusive_ancestors() {
- if let Some(element) = Root::downcast::<Element>(element) {
+ if let Some(element) = DomRoot::downcast::<Element>(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<Option<Root<Element>>> {
+ -> Fallible<Option<DomRoot<Element>>> {
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::<Node>())
+ DomRoot::from_ref(self.upcast::<Node>())
}
};
@@ -2496,14 +2496,14 @@ impl VirtualMethods for Element {
}
}
-impl<'a> ::selectors::Element for Root<Element> {
+impl<'a> ::selectors::Element for DomRoot<Element> {
type Impl = SelectorImpl;
fn opaque(&self) -> ::selectors::OpaqueElement {
::selectors::OpaqueElement::new(self.reflector().get_jsobject().get())
}
- fn parent_element(&self) -> Option<Root<Element>> {
+ fn parent_element(&self) -> Option<DomRoot<Element>> {
self.upcast::<Node>().GetParentElement()
}
@@ -2516,20 +2516,20 @@ impl<'a> ::selectors::Element for Root<Element> {
}
- fn first_child_element(&self) -> Option<Root<Element>> {
+ fn first_child_element(&self) -> Option<DomRoot<Element>> {
self.node.child_elements().next()
}
- fn last_child_element(&self) -> Option<Root<Element>> {
- self.node.rev_children().filter_map(Root::downcast).next()
+ fn last_child_element(&self) -> Option<DomRoot<Element>> {
+ self.node.rev_children().filter_map(DomRoot::downcast).next()
}
- fn prev_sibling_element(&self) -> Option<Root<Element>> {
- self.node.preceding_siblings().filter_map(Root::downcast).next()
+ fn prev_sibling_element(&self) -> Option<DomRoot<Element>> {
+ self.node.preceding_siblings().filter_map(DomRoot::downcast).next()
}
- fn next_sibling_element(&self) -> Option<Root<Element>> {
- self.node.following_siblings().filter_map(Root::downcast).next()
+ fn next_sibling_element(&self) -> Option<DomRoot<Element>> {
+ 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<Root<Element>> {
+ pub fn nearest_activable_element(&self) -> Option<DomRoot<Element>> {
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::<Node>();
for node in node.ancestors() {
if let Some(node) = node.downcast::<Element>() {
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 337e4f34fcc..cf943948455 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<ErrorEvent> {
+ pub fn new_uninitialized(global: &GlobalScope) -> DomRoot<ErrorEvent> {
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<ErrorEvent> {
+ error: HandleValue) -> DomRoot<ErrorEvent> {
let ev = ErrorEvent::new_uninitialized(global);
{
let event = ev.upcast::<Event>();
@@ -75,7 +75,7 @@ impl ErrorEvent {
pub fn Constructor(global: &GlobalScope,
type_: DOMString,
init: RootedTraceableBox<ErrorEventBinding::ErrorEventInit>)
- -> Fallible<Root<ErrorEvent>>{
+ -> Fallible<DomRoot<ErrorEvent>>{
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 24674147bc5..e693dd1c5eb 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<Event> {
+ pub fn new_uninitialized(global: &GlobalScope) -> DomRoot<Event> {
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<Event> {
+ cancelable: EventCancelable) -> DomRoot<Event> {
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<Root<Event>> {
+ init: &EventBinding::EventInit) -> Fallible<DomRoot<Event>> {
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::<EventTarget>()));
}
let top_most_ancestor_or_target =
- Root::from_ref(event_path.r().last().cloned().unwrap_or(target));
- if let Some(document) = Root::downcast::<Document>(top_most_ancestor_or_target) {
+ DomRoot::from_ref(event_path.r().last().cloned().unwrap_or(target));
+ if let Some(document) = DomRoot::downcast::<Document>(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<Root<EventTarget>> {
+ fn GetTarget(&self) -> Option<DomRoot<EventTarget>> {
self.target.get()
}
// https://dom.spec.whatwg.org/#dom-event-currenttarget
- fn GetCurrentTarget(&self) -> Option<Root<EventTarget>> {
+ fn GetCurrentTarget(&self) -> Option<DomRoot<EventTarget>> {
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::<Window>(target.global()) {
+ let window = match DomRoot::downcast::<Window>(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 82aa62bba26..962138968d0 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<EventSource> {
+ fn new(global: &GlobalScope, url: ServoUrl, with_credentials: bool) -> DomRoot<EventSource> {
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<Root<EventSource>> {
+ event_source_init: &EventSourceInit) -> Fallible<DomRoot<EventSource>> {
// 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 64c903e4de6..a33f7703e1a 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<Event> {
+ pub fn fire_event(&self, name: Atom) -> DomRoot<Event> {
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<Event> {
+ pub fn fire_bubbling_event(&self, name: Atom) -> DomRoot<Event> {
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<Event> {
+ pub fn fire_cancelable_event(&self, name: Atom) -> DomRoot<Event> {
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<Event> {
+ pub fn fire_bubbling_cancelable_event(&self, name: Atom) -> DomRoot<Event> {
self.fire_event_with_params(name,
EventBubbles::Bubbles,
EventCancelable::Cancelable)
@@ -538,7 +538,7 @@ impl EventTarget {
name: Atom,
bubbles: EventBubbles,
cancelable: EventCancelable)
- -> Root<Event> {
+ -> DomRoot<Event> {
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 50ccda70eb7..4af769b2d69 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<ExtendableEvent> {
+ -> DomRoot<ExtendableEvent> {
let ev = reflect_dom_object(box ExtendableEvent::new_inherited(), worker, ExtendableEventBinding::Wrap);
{
let event = ev.upcast::<Event>();
@@ -44,7 +44,7 @@ impl ExtendableEvent {
pub fn Constructor(worker: &ServiceWorkerGlobalScope,
type_: DOMString,
- init: &ExtendableEventBinding::ExtendableEventInit) -> Fallible<Root<ExtendableEvent>> {
+ init: &ExtendableEventBinding::ExtendableEventInit) -> Fallible<DomRoot<ExtendableEvent>> {
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 0bc5403620c..eacc3fb4e8c 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<ExtendableMessageEvent> {
+ -> DomRoot<ExtendableMessageEvent> {
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<ExtendableMessageEventBinding::ExtendableMessageEventInit>)
- -> Fallible<Root<ExtendableMessageEvent>> {
+ -> Fallible<DomRoot<ExtendableMessageEvent>> {
let global = worker.upcast::<GlobalScope>();
let ev = ExtendableMessageEvent::new(global,
Atom::from(type_),
diff --git a/components/script/dom/file.rs b/components/script/dom/file.rs
index bcea622d4d8..1bfd12a2654 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<i64>, typeString: &str) -> Root<File> {
+ name: DOMString, modified: Option<i64>, typeString: &str) -> DomRoot<File> {
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<File> {
+ pub fn new_from_selected(window: &Window, selected: SelectedFile) -> DomRoot<File> {
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<BlobOrString>,
filename: DOMString,
filePropertyBag: &FileBinding::FilePropertyBag)
- -> Fallible<Root<File>> {
+ -> Fallible<DomRoot<File>> {
let bytes: Vec<u8> = 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 2591419c490..559f36cbd7c 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<File>>) -> Root<FileList> {
+ pub fn new(window: &Window, files: Vec<DomRoot<File>>) -> DomRoot<FileList> {
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<Root<File>> {
+ fn Item(&self, index: u32) -> Option<DomRoot<File>> {
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<Root<File>> {
+ fn IndexedGetter(&self, index: u32) -> Option<DomRoot<File>> {
self.Item(index)
}
}
diff --git a/components/script/dom/filereader.rs b/components/script/dom/filereader.rs
index d8ed3788f19..5bd964d4188 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<FileReader> {
+ pub fn new(global: &GlobalScope) -> DomRoot<FileReader> {
reflect_dom_object(box FileReader::new_inherited(),
global, FileReaderBinding::Wrap)
}
- pub fn Constructor(global: &GlobalScope) -> Fallible<Root<FileReader>> {
+ pub fn Constructor(global: &GlobalScope) -> Fallible<DomRoot<FileReader>> {
Ok(FileReader::new(global))
}
@@ -328,7 +328,7 @@ impl FileReaderMethods for FileReader {
}
// https://w3c.github.io/FileAPI/#dfn-error
- fn GetError(&self) -> Option<Root<DOMException>> {
+ fn GetError(&self) -> Option<DomRoot<DOMException>> {
self.error.get()
}
diff --git a/components/script/dom/filereadersync.rs b/components/script/dom/filereadersync.rs
index f6fb8ca8563..a4e75f4bca5 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<FileReaderSync> {
+ pub fn new(global: &GlobalScope) -> DomRoot<FileReaderSync> {
reflect_dom_object(box FileReaderSync::new_inherited(),
global, FileReaderSyncBinding::Wrap)
}
- pub fn Constructor(global: &GlobalScope) -> Fallible<Root<FileReaderSync>> {
+ pub fn Constructor(global: &GlobalScope) -> Fallible<DomRoot<FileReaderSync>> {
Ok(FileReaderSync::new(global))
}
}
diff --git a/components/script/dom/focusevent.rs b/components/script/dom/focusevent.rs
index 10d78227aa2..de689683b6b 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<FocusEvent> {
+ pub fn new_uninitialized(window: &Window) -> DomRoot<FocusEvent> {
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<FocusEvent> {
+ related_target: Option<&EventTarget>) -> DomRoot<FocusEvent> {
let ev = FocusEvent::new_uninitialized(window);
ev.upcast::<UIEvent>().InitUIEvent(type_,
bool::from(can_bubble),
@@ -55,7 +55,7 @@ impl FocusEvent {
pub fn Constructor(window: &Window,
type_: DOMString,
- init: &FocusEventBinding::FocusEventInit) -> Fallible<Root<FocusEvent>> {
+ init: &FocusEventBinding::FocusEventInit) -> Fallible<DomRoot<FocusEvent>> {
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<Root<EventTarget>> {
+ fn GetRelatedTarget(&self) -> Option<DomRoot<EventTarget>> {
self.related_target.get()
}
diff --git a/components/script/dom/forcetouchevent.rs b/components/script/dom/forcetouchevent.rs
index 6ac5ea83206..b1159a57847 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<ForceTouchEvent> {
+ force: f32) -> DomRoot<ForceTouchEvent> {
let event = box ForceTouchEvent::new_inherited(force);
let ev = reflect_dom_object(event, window, ForceTouchEventBinding::Wrap);
ev.upcast::<UIEvent>().InitUIEvent(type_, true, true, Some(window), 0);
diff --git a/components/script/dom/formdata.rs b/components/script/dom/formdata.rs
index 100684505dd..f97b425883a 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<FormData> {
+ pub fn new(form: Option<&HTMLFormElement>, global: &GlobalScope) -> DomRoot<FormData> {
reflect_dom_object(box FormData::new_inherited(form),
global, FormDataWrap)
}
- pub fn Constructor(global: &GlobalScope, form: Option<&HTMLFormElement>) -> Fallible<Root<FormData>> {
+ pub fn Constructor(global: &GlobalScope, form: Option<&HTMLFormElement>) -> Fallible<DomRoot<FormData>> {
// 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<USVString>) -> Root<File> {
+ fn create_an_entry(&self, blob: &Blob, opt_filename: Option<USVString>) -> DomRoot<File> {
let name = match opt_filename {
Some(filename) => DOMString::from(filename.0),
None if blob.downcast::<File>().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 0b6dd7af6f5..39e76818906 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<Gamepad> {
+ state: &WebVRGamepadState) -> DomRoot<Gamepad> {
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<GamepadButtonList> {
- Root::from_ref(&*self.buttons)
+ fn Buttons(&self) -> DomRoot<GamepadButtonList> {
+ 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<Root<VRPose>> {
- self.pose.as_ref().map(|p| Root::from_ref(&**p))
+ fn GetPose(&self) -> Option<DomRoot<VRPose>> {
+ 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 f896b39f3c6..1fc93941f9c 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<GamepadButton> {
+ pub fn new(global: &GlobalScope, pressed: bool, touched: bool) -> DomRoot<GamepadButton> {
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 aa741efc59e..809760baca2 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<GamepadButtonList> {
+ pub fn new_from_vr(global: &GlobalScope, buttons: &[WebVRGamepadButton]) -> DomRoot<GamepadButtonList> {
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<Root<GamepadButton>> {
- self.list.get(index as usize).map(|button| Root::from_ref(&**button))
+ fn Item(&self, index: u32) -> Option<DomRoot<GamepadButton>> {
+ 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<Root<GamepadButton>> {
+ fn IndexedGetter(&self, index: u32) -> Option<DomRoot<GamepadButton>> {
self.Item(index)
}
}
diff --git a/components/script/dom/gamepadevent.rs b/components/script/dom/gamepadevent.rs
index 807cdc42769..644713be225 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<GamepadEvent> {
+ -> DomRoot<GamepadEvent> {
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<GamepadEvent> {
+ -> DomRoot<GamepadEvent> {
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<Root<GamepadEvent>> {
+ -> Fallible<DomRoot<GamepadEvent>> {
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<Gamepad> {
- Root::from_ref(&*self.gamepad)
+ fn Gamepad(&self) -> DomRoot<Gamepad> {
+ 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 26e78cda654..bcbb7131456 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<GamepadList> {
+ pub fn new(global: &GlobalScope, list: &[&Gamepad]) -> DomRoot<GamepadList> {
reflect_dom_object(box GamepadList::new_inherited(list),
global,
GamepadListBinding::Wrap)
}
- pub fn add_if_not_exists(&self, gamepads: &[Root<Gamepad>]) {
+ pub fn add_if_not_exists(&self, gamepads: &[DomRoot<Gamepad>]) {
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<Root<Gamepad>> {
- self.list.borrow().get(index as usize).map(|gamepad| Root::from_ref(&**gamepad))
+ fn Item(&self, index: u32) -> Option<DomRoot<Gamepad>> {
+ 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<Root<Gamepad>> {
+ fn IndexedGetter(&self, index: u32) -> Option<DomRoot<Gamepad>> {
self.Item(index)
}
}
diff --git a/components/script/dom/globalscope.rs b/components/script/dom/globalscope.rs
index ed5ed5cd941..386231ac6e3 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<T: DomObject>(reflector: &T) -> Root<Self> {
+ pub fn from_reflector<T: DomObject>(reflector: &T) -> DomRoot<Self> {
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<Self> {
+ pub unsafe fn from_object(obj: *mut JSObject) -> DomRoot<Self> {
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<Self> {
+ pub unsafe fn from_context(cx: *mut JSContext) -> DomRoot<Self> {
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<Self> {
+ pub unsafe fn from_object_maybe_wrapped(mut obj: *mut JSObject) -> DomRoot<Self> {
if IsWrapper(obj) {
obj = UnwrapObject(obj, /* stopAtWindowProxy = */ 0);
assert!(!obj.is_null());
@@ -190,7 +190,7 @@ impl GlobalScope {
}
}
- pub fn crypto(&self) -> Root<Crypto> {
+ pub fn crypto(&self) -> DomRoot<Crypto> {
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<Root<Self>> {
+ pub fn current() -> Option<DomRoot<Self>> {
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<Self> {
+ pub fn entry() -> DomRoot<Self> {
entry_global()
}
/// Returns the ["incumbent"] global object.
///
/// ["incumbent"]: https://html.spec.whatwg.org/multipage/#incumbent
- pub fn incumbent() -> Option<Root<Self>> {
+ pub fn incumbent() -> Option<DomRoot<Self>> {
incumbent_global()
}
- pub fn performance(&self) -> Root<Performance> {
+ pub fn performance(&self) -> DomRoot<Performance> {
if let Some(window) = self.downcast::<Window>() {
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<GlobalScope> {
+unsafe fn global_scope_from_global(global: *mut JSObject) -> DomRoot<GlobalScope> {
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 4d374685ec6..16dad9f6078 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<HashChangeEvent> {
+ pub fn new_uninitialized(window: &Window) -> DomRoot<HashChangeEvent> {
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<HashChangeEvent> {
+ -> DomRoot<HashChangeEvent> {
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<Root<HashChangeEvent>> {
+ -> Fallible<DomRoot<HashChangeEvent>> {
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 7bd2eeff8e2..2baa604b058 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<Headers> {
+ pub fn new(global: &GlobalScope) -> DomRoot<Headers> {
reflect_dom_object(box Headers::new_inherited(), global, HeadersWrap)
}
// https://fetch.spec.whatwg.org/#dom-headers
pub fn Constructor(global: &GlobalScope, init: Option<HeadersInit>)
- -> Fallible<Root<Headers>> {
+ -> Fallible<DomRoot<Headers>> {
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<Headers> {
+ pub fn for_request(global: &GlobalScope) -> DomRoot<Headers> {
let headers_for_request = Headers::new(global);
headers_for_request.guard.set(Guard::Request);
headers_for_request
}
- pub fn for_response(global: &GlobalScope) -> Root<Headers> {
+ pub fn for_response(global: &GlobalScope) -> DomRoot<Headers> {
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 7cca59380b6..9e97a3d5e95 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<History> {
+ pub fn new(window: &Window) -> DomRoot<History> {
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 bb5c1b67d69..5909480eb95 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<Prefix>,
- document: &Document) -> Root<HTMLAnchorElement> {
+ document: &Document) -> DomRoot<HTMLAnchorElement> {
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<DOMTokenList> {
+ fn RelList(&self) -> DomRoot<DOMTokenList> {
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 61431c6b447..a2847544283 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<Prefix>,
- document: &Document) -> Root<HTMLAppletElement> {
+ document: &Document) -> DomRoot<HTMLAppletElement> {
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 2ea9dfa4006..859c1081e97 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<Prefix>,
- document: &Document) -> Root<HTMLAreaElement> {
+ document: &Document) -> DomRoot<HTMLAreaElement> {
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<DOMTokenList> {
+ fn RelList(&self) -> DomRoot<DOMTokenList> {
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 ed0b0093900..456baaa2316 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<Prefix>,
- document: &Document) -> Root<HTMLAudioElement> {
+ document: &Document) -> DomRoot<HTMLAudioElement> {
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 0ae261d290c..ada9539833a 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<Prefix>,
- document: &Document) -> Root<HTMLBaseElement> {
+ document: &Document) -> DomRoot<HTMLBaseElement> {
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 3ec993ca3df..4ade5560700 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<Prefix>, document: &Document)
- -> Root<HTMLBodyElement> {
+ -> DomRoot<HTMLBodyElement> {
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 4be8cd47772..fa782cf3564 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<Prefix>,
- document: &Document) -> Root<HTMLBRElement> {
+ document: &Document) -> DomRoot<HTMLBRElement> {
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 37997c93702..aea8bf5c585 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<Prefix>,
- document: &Document) -> Root<HTMLButtonElement> {
+ document: &Document) -> DomRoot<HTMLButtonElement> {
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<ValidityState> {
+ fn Validity(&self) -> DomRoot<ValidityState> {
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<Root<HTMLFormElement>> {
+ fn GetForm(&self) -> Option<DomRoot<HTMLFormElement>> {
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<NodeList> {
+ fn Labels(&self) -> DomRoot<NodeList> {
self.upcast::<HTMLElement>().labels()
}
}
@@ -244,7 +244,7 @@ impl VirtualMethods for HTMLButtonElement {
}
impl FormControl for HTMLButtonElement {
- fn form_owner(&self) -> Option<Root<HTMLFormElement>> {
+ fn form_owner(&self) -> Option<DomRoot<HTMLFormElement>> {
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::<HTMLButtonElement>)
+ .filter_map(DomRoot::downcast::<HTMLButtonElement>)
.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 d277c85fd8a..c624d5d9fda 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<Prefix>,
- document: &Document) -> Root<HTMLCanvasElement> {
+ document: &Document) -> DomRoot<HTMLCanvasElement> {
Node::reflect_node(box HTMLCanvasElement::new_inherited(local_name, prefix, document),
document,
HTMLCanvasElementBinding::Wrap)
@@ -151,7 +151,7 @@ impl LayoutHTMLCanvasElementHelpers for LayoutDom<HTMLCanvasElement> {
impl HTMLCanvasElement {
- pub fn get_or_init_2d_context(&self) -> Option<Root<CanvasRenderingContext2D>> {
+ pub fn get_or_init_2d_context(&self) -> Option<DomRoot<CanvasRenderingContext2D>> {
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<HandleValue>) -> Option<Root<WebGLRenderingContext>> {
+ attrs: Option<HandleValue>) -> Option<DomRoot<WebGLRenderingContext>> {
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 dd8a62617db..cefa1407413 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<CollectionFilter + 'static>) -> Root<HTMLCollection> {
+ pub fn new(window: &Window, root: &Node, filter: Box<CollectionFilter + 'static>) -> DomRoot<HTMLCollection> {
reflect_dom_object(box HTMLCollection::new_inherited(root, filter),
window, HTMLCollectionBinding::Wrap)
}
pub fn create(window: &Window, root: &Node,
- filter: Box<CollectionFilter + 'static>) -> Root<HTMLCollection> {
+ filter: Box<CollectionFilter + 'static>) -> DomRoot<HTMLCollection> {
HTMLCollection::new(window, root, filter)
}
@@ -104,7 +104,7 @@ impl HTMLCollection {
}
}
- fn set_cached_cursor(&self, index: u32, element: Option<Root<Element>>) -> Option<Root<Element>> {
+ fn set_cached_cursor(&self, index: u32, element: Option<DomRoot<Element>>) -> Option<DomRoot<Element>> {
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<HTMLCollection> {
+ -> DomRoot<HTMLCollection> {
// 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<DOMString>) -> Root<HTMLCollection> {
+ maybe_ns: Option<DOMString>) -> DomRoot<HTMLCollection> {
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<HTMLCollection> {
+ pub fn by_qual_tag_name(window: &Window, root: &Node, qname: QualName) -> DomRoot<HTMLCollection> {
#[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<HTMLCollection> {
+ -> DomRoot<HTMLCollection> {
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<Atom>)
- -> Root<HTMLCollection> {
+ -> DomRoot<HTMLCollection> {
#[derive(HeapSizeOf, JSTraceable)]
struct ClassNameFilter {
classes: Vec<Atom>
@@ -211,7 +211,7 @@ impl HTMLCollection {
HTMLCollection::create(window, root, box filter)
}
- pub fn children(window: &Window, root: &Node) -> Root<HTMLCollection> {
+ pub fn children(window: &Window, root: &Node) -> DomRoot<HTMLCollection> {
#[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<Item=Root<Element>> + 'a {
+ pub fn elements_iter_after<'a>(&'a self, after: &'a Node) -> impl Iterator<Item=DomRoot<Element>> + '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<Item=Root<Element>> + 'a {
+ pub fn elements_iter<'a>(&'a self) -> impl Iterator<Item=DomRoot<Element>> + '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<Item=Root<Element>> + 'a {
+ pub fn elements_iter_before<'a>(&'a self, before: &'a Node) -> impl Iterator<Item=DomRoot<Element>> + '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<Node> {
- Root::from_ref(&self.root)
+ pub fn root_node(&self) -> DomRoot<Node> {
+ 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<Root<Element>> {
+ fn Item(&self, index: u32) -> Option<DomRoot<Element>> {
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<Node> = Root::upcast(element);
+ let node: DomRoot<Node> = 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<Node> = Root::upcast(element);
+ let node: DomRoot<Node> = 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<Root<Element>> {
+ fn NamedItem(&self, key: DOMString) -> Option<DomRoot<Element>> {
// 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<Root<Element>> {
+ fn IndexedGetter(&self, index: u32) -> Option<DomRoot<Element>> {
self.Item(index)
}
// check-tidy: no specs after this line
- fn NamedGetter(&self, name: DOMString) -> Option<Root<Element>> {
+ fn NamedGetter(&self, name: DOMString) -> Option<DomRoot<Element>> {
self.NamedItem(name)
}
diff --git a/components/script/dom/htmldataelement.rs b/components/script/dom/htmldataelement.rs
index 0a32c87261a..556fec894e2 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<Prefix>,
- document: &Document) -> Root<HTMLDataElement> {
+ document: &Document) -> DomRoot<HTMLDataElement> {
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 bae9b016456..1e71ca7502b 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<Prefix>,
- document: &Document) -> Root<HTMLDataListElement> {
+ document: &Document) -> DomRoot<HTMLDataListElement> {
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<HTMLCollection> {
+ fn Options(&self) -> DomRoot<HTMLCollection> {
#[derive(HeapSizeOf, JSTraceable)]
struct HTMLDataListOptionsFilter;
impl CollectionFilter for HTMLDataListOptionsFilter {
diff --git a/components/script/dom/htmldetailselement.rs b/components/script/dom/htmldetailselement.rs
index 4942253a667..75780f83d86 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<Prefix>,
- document: &Document) -> Root<HTMLDetailsElement> {
+ document: &Document) -> DomRoot<HTMLDetailsElement> {
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 2d26f150628..39e195e0814 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<Prefix>,
- document: &Document) -> Root<HTMLDialogElement> {
+ document: &Document) -> DomRoot<HTMLDialogElement> {
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 cfec92a7198..2ec56cb6415 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<Prefix>,
- document: &Document) -> Root<HTMLDirectoryElement> {
+ document: &Document) -> DomRoot<HTMLDirectoryElement> {
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 5f152d770ad..001ca7c5ca5 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<Prefix>,
- document: &Document) -> Root<HTMLDivElement> {
+ document: &Document) -> DomRoot<HTMLDivElement> {
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 c8890e83f1b..6622571c5c8 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<Prefix>,
- document: &Document) -> Root<HTMLDListElement> {
+ document: &Document) -> DomRoot<HTMLDListElement> {
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 7890cc5fa89..9f671e2d10c 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<Prefix>, document: &Document) -> Root<HTMLElement> {
+ pub fn new(local_name: LocalName, prefix: Option<Prefix>, document: &Document) -> DomRoot<HTMLElement> {
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<CSSStyleDeclaration> {
+ fn Style(&self) -> DomRoot<CSSStyleDeclaration> {
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<DOMStringMap> {
+ fn Dataset(&self) -> DomRoot<DOMStringMap> {
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<Root<Element>> {
+ fn GetOffsetParent(&self) -> Option<DomRoot<Element>> {
if self.is::<HTMLBodyElement>() || self.is::<HTMLHtmlElement>() {
return None;
}
@@ -503,7 +503,7 @@ impl HTMLElement {
}
// https://html.spec.whatwg.org/multipage/#dom-lfe-labels
- pub fn labels(&self) -> Root<NodeList> {
+ pub fn labels(&self) -> DomRoot<NodeList> {
debug_assert!(self.is_labelable_element());
let element = self.upcast::<Element>();
@@ -514,14 +514,14 @@ impl HTMLElement {
let ancestors =
self.upcast::<Node>()
.ancestors()
- .filter_map(Root::downcast::<HTMLElement>)
+ .filter_map(DomRoot::downcast::<HTMLElement>)
// 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::<HTMLLabelElement>)
+ .filter_map(DomRoot::downcast::<HTMLLabelElement>)
.filter(|elem| !elem.upcast::<Element>().has_attribute(&local_name!("for")))
.filter(|elem| elem.first_labelable_descendant().r() == Some(self))
- .map(Root::upcast::<Node>);
+ .map(DomRoot::upcast::<Node>);
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::<Node>();
let children = root_node.traverse_preorder()
- .filter_map(Root::downcast::<Element>)
+ .filter_map(DomRoot::downcast::<Element>)
.filter(|elem| elem.is::<HTMLLabelElement>())
.filter(|elem| elem.get_string_attribute(&local_name!("for")) == id)
- .map(Root::upcast::<Node>);
+ .map(DomRoot::upcast::<Node>);
NodeList::new_simple_list(&window, children.chain(ancestors))
}
diff --git a/components/script/dom/htmlembedelement.rs b/components/script/dom/htmlembedelement.rs
index e5b207764a2..daa011fcf6d 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<Prefix>,
- document: &Document) -> Root<HTMLEmbedElement> {
+ document: &Document) -> DomRoot<HTMLEmbedElement> {
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 e935169c244..89e1d2db481 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<Prefix>,
- document: &Document) -> Root<HTMLFieldSetElement> {
+ document: &Document) -> DomRoot<HTMLFieldSetElement> {
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<HTMLCollection> {
+ fn Elements(&self) -> DomRoot<HTMLCollection> {
#[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<ValidityState> {
+ fn Validity(&self) -> DomRoot<ValidityState> {
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<Root<HTMLFormElement>> {
+ fn GetForm(&self) -> Option<DomRoot<HTMLFormElement>> {
self.form_owner()
}
}
@@ -159,7 +159,7 @@ impl VirtualMethods for HTMLFieldSetElement {
}
impl FormControl for HTMLFieldSetElement {
- fn form_owner(&self) -> Option<Root<HTMLFormElement>> {
+ fn form_owner(&self) -> Option<DomRoot<HTMLFormElement>> {
self.form_owner.get()
}
diff --git a/components/script/dom/htmlfontelement.rs b/components/script/dom/htmlfontelement.rs
index e2f9eaeec21..c5eee197159 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<Prefix>,
- document: &Document) -> Root<HTMLFontElement> {
+ document: &Document) -> DomRoot<HTMLFontElement> {
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 1b215ba2320..8b786d2cb35 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<CollectionFilter + 'static>)
- -> Root<HTMLFormControlsCollection>
+ -> DomRoot<HTMLFormControlsCollection>
{
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::<Node>(elem));
- let list = once.chain(peekable.map(Root::upcast));
+ let once = iter::once(DomRoot::upcast::<Node>(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<Root<Element>> {
+ fn IndexedGetter(&self, index: u32) -> Option<DomRoot<Element>> {
self.collection.IndexedGetter(index)
}
}
diff --git a/components/script/dom/htmlformelement.rs b/components/script/dom/htmlformelement.rs
index abb064fbb19..a61b7bf3e51 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<Prefix>,
- document: &Document) -> Root<HTMLFormElement> {
+ document: &Document) -> DomRoot<HTMLFormElement> {
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<HTMLFormControlsCollection> {
+ fn Elements(&self) -> DomRoot<HTMLFormControlsCollection> {
#[derive(HeapSizeOf, JSTraceable)]
struct ElementsFilter {
- form: Root<HTMLFormElement>
+ form: DomRoot<HTMLFormElement>
}
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<Root<Element>> {
+ fn IndexedGetter(&self, index: u32) -> Option<DomRoot<Element>> {
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::<HTMLDataListElement>(a).is_some()) {
+ .any(|a| DomRoot::downcast::<HTMLDataListElement>(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>),
+ File(DomRoot<File>),
String(DOMString)
}
@@ -718,13 +718,13 @@ pub enum FormMethod {
#[derive(HeapSizeOf)]
#[allow(dead_code)]
pub enum FormSubmittableElement {
- ButtonElement(Root<HTMLButtonElement>),
- InputElement(Root<HTMLInputElement>),
+ ButtonElement(DomRoot<HTMLButtonElement>),
+ InputElement(DomRoot<HTMLInputElement>),
// TODO: HTMLKeygenElement unimplemented
// KeygenElement(&'a HTMLKeygenElement),
- ObjectElement(Root<HTMLObjectElement>),
- SelectElement(Root<HTMLSelectElement>),
- TextAreaElement(Root<HTMLTextAreaElement>),
+ ObjectElement(DomRoot<HTMLObjectElement>),
+ SelectElement(DomRoot<HTMLSelectElement>),
+ TextAreaElement(DomRoot<HTMLTextAreaElement>),
}
impl FormSubmittableElement {
@@ -740,19 +740,19 @@ impl FormSubmittableElement {
fn from_element(element: &Element) -> FormSubmittableElement {
if let Some(input) = element.downcast::<HTMLInputElement>() {
- FormSubmittableElement::InputElement(Root::from_ref(&input))
+ FormSubmittableElement::InputElement(DomRoot::from_ref(&input))
}
else if let Some(input) = element.downcast::<HTMLButtonElement>() {
- FormSubmittableElement::ButtonElement(Root::from_ref(&input))
+ FormSubmittableElement::ButtonElement(DomRoot::from_ref(&input))
}
else if let Some(input) = element.downcast::<HTMLObjectElement>() {
- FormSubmittableElement::ObjectElement(Root::from_ref(&input))
+ FormSubmittableElement::ObjectElement(DomRoot::from_ref(&input))
}
else if let Some(input) = element.downcast::<HTMLSelectElement>() {
- FormSubmittableElement::SelectElement(Root::from_ref(&input))
+ FormSubmittableElement::SelectElement(DomRoot::from_ref(&input))
}
else if let Some(input) = element.downcast::<HTMLTextAreaElement>() {
- 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<Root<HTMLFormElement>>;
+ fn form_owner(&self) -> Option<DomRoot<HTMLFormElement>>;
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::<HTMLFormElement>)
+ .filter_map(DomRoot::downcast::<HTMLFormElement>)
.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::<HTMLFormElement>)
+ doc.GetElementById(form_id).and_then(DomRoot::downcast::<HTMLFormElement>)
} else {
// Step 4
nearest_form_ancestor
diff --git a/components/script/dom/htmlframeelement.rs b/components/script/dom/htmlframeelement.rs
index 0f70cb99b3e..147e05a836e 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<Prefix>,
- document: &Document) -> Root<HTMLFrameElement> {
+ document: &Document) -> DomRoot<HTMLFrameElement> {
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 2f8cf1c99a6..99b58deea3d 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<Prefix>,
- document: &Document) -> Root<HTMLFrameSetElement> {
+ document: &Document) -> DomRoot<HTMLFrameSetElement> {
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 0d0f2be734c..1aaf0a799b5 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<Prefix>,
- document: &Document) -> Root<HTMLHeadElement> {
+ document: &Document) -> DomRoot<HTMLHeadElement> {
Node::reflect_node(box HTMLHeadElement::new_inherited(local_name, prefix, document),
document,
HTMLHeadElementBinding::Wrap)
@@ -49,7 +49,7 @@ impl HTMLHeadElement {
let node = self.upcast::<Node>();
let candidates = node.traverse_preorder()
- .filter_map(Root::downcast::<Element>)
+ .filter_map(DomRoot::downcast::<Element>)
.filter(|elem| elem.is::<HTMLMetaElement>())
.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 5b0a90a1374..44223863dd4 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<Prefix>,
document: &Document,
- level: HeadingLevel) -> Root<HTMLHeadingElement> {
+ level: HeadingLevel) -> DomRoot<HTMLHeadingElement> {
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 e66494e6843..e4769ed7202 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<Prefix>,
- document: &Document) -> Root<HTMLHRElement> {
+ document: &Document) -> DomRoot<HTMLHRElement> {
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 75a233b82ce..b112e304c09 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<Prefix>,
- document: &Document) -> Root<HTMLHtmlElement> {
+ document: &Document) -> DomRoot<HTMLHtmlElement> {
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 39bb2e672b4..8cc7ca9977b 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<Prefix>,
- document: &Document) -> Root<HTMLIFrameElement> {
+ document: &Document) -> DomRoot<HTMLIFrameElement> {
Node::reflect_node(box HTMLIFrameElement::new_inherited(local_name, prefix, document),
document,
HTMLIFrameElementBinding::Wrap)
@@ -461,7 +461,7 @@ impl HTMLIFrameElementLayoutMethods for LayoutDom<HTMLIFrameElement> {
}
#[allow(unsafe_code)]
-pub fn build_mozbrowser_custom_event(window: &Window, event: MozBrowserEvent) -> Root<CustomEvent> {
+pub fn build_mozbrowser_custom_event(window: &Window, event: MozBrowserEvent) -> DomRoot<CustomEvent> {
// 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<DOMTokenList> {
+ fn Sandbox(&self) -> DomRoot<DOMTokenList> {
self.sandbox.or_init(|| DOMTokenList::new(self.upcast::<Element>(), &local_name!("sandbox")))
}
// https://html.spec.whatwg.org/multipage/#dom-iframe-contentwindow
- fn GetContentWindow(&self) -> Option<Root<WindowProxy>> {
+ fn GetContentWindow(&self) -> Option<DomRoot<WindowProxy>> {
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<Root<Document>> {
+ fn GetContentDocument(&self) -> Option<DomRoot<Document>> {
// 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 dac6c955626..7c2255d6696 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<Prefix>,
- document: &Document) -> Root<HTMLImageElement> {
+ document: &Document) -> DomRoot<HTMLImageElement> {
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<u32>,
- height: Option<u32>) -> Fallible<Root<HTMLImageElement>> {
+ height: Option<u32>) -> Fallible<DomRoot<HTMLImageElement>> {
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<Vec<Root<HTMLAreaElement>>> {
+ pub fn areas(&self) -> Option<Vec<DomRoot<HTMLAreaElement>>> {
let elem = self.upcast::<Element>();
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::<Node>()
.traverse_preorder()
- .filter_map(Root::downcast::<HTMLMapElement>)
+ .filter_map(DomRoot::downcast::<HTMLMapElement>)
.find(|n| n.upcast::<Element>().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<HTMLImageElement>,
+ elem: DomRoot<HTMLImageElement>,
generation: u32,
}
}
@@ -937,7 +937,7 @@ impl VirtualMethods for HTMLImageElement {
}
impl FormControl for HTMLImageElement {
- fn form_owner(&self) -> Option<Root<HTMLFormElement>> {
+ fn form_owner(&self) -> Option<DomRoot<HTMLFormElement>> {
self.form_owner.get()
}
diff --git a/components/script/dom/htmlinputelement.rs b/components/script/dom/htmlinputelement.rs
index 77ddc6eb8e3..ce76eb8ced5 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<Prefix>,
- document: &Document) -> Root<HTMLInputElement> {
+ document: &Document) -> DomRoot<HTMLInputElement> {
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<Root<HTMLFormElement>> {
+ fn GetForm(&self) -> Option<DomRoot<HTMLFormElement>> {
self.form_owner()
}
// https://html.spec.whatwg.org/multipage/#dom-input-files
- fn GetFiles(&self) -> Option<Root<FileList>> {
+ fn GetFiles(&self) -> Option<DomRoot<FileList>> {
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<NodeList> {
+ fn Labels(&self) -> DomRoot<NodeList> {
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::<HTMLInputElement>)
+ .filter_map(DomRoot::downcast::<HTMLInputElement>)
.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::<GlobalScope>().resource_threads();
- let mut files: Vec<Root<File>> = vec![];
+ let mut files: Vec<DomRoot<File>> = 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<Root<HTMLFormElement>> {
+ fn form_owner(&self) -> Option<DomRoot<HTMLFormElement>> {
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::<HTMLInputElement>)
+ .filter_map(DomRoot::downcast::<HTMLInputElement>)
.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::<HTMLInputElement>)
+ .filter_map(DomRoot::downcast::<HTMLInputElement>)
.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::<HTMLInputElement>)
+ .filter_map(DomRoot::downcast::<HTMLInputElement>)
.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 0e1e99c3f7b..09397059eab 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<Prefix>,
- document: &Document) -> Root<HTMLLabelElement> {
+ document: &Document) -> DomRoot<HTMLLabelElement> {
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<Root<HTMLFormElement>> {
+ fn GetForm(&self) -> Option<DomRoot<HTMLFormElement>> {
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<Root<HTMLElement>> {
+ fn GetControl(&self) -> Option<DomRoot<HTMLElement>> {
if !self.upcast::<Node>().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::<HTMLElement>)
+ .and_then(DomRoot::downcast::<HTMLElement>)
.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<Root<HTMLElement>> {
+ pub fn first_labelable_descendant(&self) -> Option<DomRoot<HTMLElement>> {
self.upcast::<Node>()
.traverse_preorder()
- .filter_map(Root::downcast::<HTMLElement>)
+ .filter_map(DomRoot::downcast::<HTMLElement>)
.filter(|elem| elem.is_labelable_element())
.next()
}
}
impl FormControl for HTMLLabelElement {
- fn form_owner(&self) -> Option<Root<HTMLFormElement>> {
- self.GetControl().map(Root::upcast::<Element>).and_then(|elem| {
+ fn form_owner(&self) -> Option<DomRoot<HTMLFormElement>> {
+ self.GetControl().map(DomRoot::upcast::<Element>).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 010e80c22ee..c54b25f6118 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<Prefix>,
document: &Document)
- -> Root<HTMLLegendElement> {
+ -> DomRoot<HTMLLegendElement> {
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<Root<HTMLFormElement>> {
+ fn GetForm(&self) -> Option<DomRoot<HTMLFormElement>> {
let parent = match self.upcast::<Node>().GetParentElement() {
Some(parent) => parent,
None => return None,
@@ -87,7 +87,7 @@ impl HTMLLegendElementMethods for HTMLLegendElement {
}
impl FormControl for HTMLLegendElement {
- fn form_owner(&self) -> Option<Root<HTMLFormElement>> {
+ fn form_owner(&self) -> Option<DomRoot<HTMLFormElement>> {
self.form_owner.get()
}
diff --git a/components/script/dom/htmllielement.rs b/components/script/dom/htmllielement.rs
index b175d3359a9..da98a3d1be2 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<Prefix>,
- document: &Document) -> Root<HTMLLIElement> {
+ document: &Document) -> DomRoot<HTMLLIElement> {
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 42b6f59d6bc..320b425331b 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<Prefix>,
document: &Document,
- creator: ElementCreator) -> Root<HTMLLinkElement> {
+ creator: ElementCreator) -> DomRoot<HTMLLinkElement> {
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<Root<CSSStyleSheet>> {
+ pub fn get_cssom_stylesheet(&self) -> Option<DomRoot<CSSStyleSheet>> {
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<DOMTokenList> {
+ fn RelList(&self) -> DomRoot<DOMTokenList> {
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<Root<DOMStyleSheet>> {
- self.get_cssom_stylesheet().map(Root::upcast)
+ fn GetSheet(&self) -> Option<DomRoot<DOMStyleSheet>> {
+ self.get_cssom_stylesheet().map(DomRoot::upcast)
}
}
diff --git a/components/script/dom/htmlmapelement.rs b/components/script/dom/htmlmapelement.rs
index 0f977ae1eda..82afa2c121f 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<Prefix>,
- document: &Document) -> Root<HTMLMapElement> {
+ document: &Document) -> DomRoot<HTMLMapElement> {
Node::reflect_node(box HTMLMapElement::new_inherited(local_name, prefix, document),
document,
HTMLMapElementBinding::Wrap)
}
- pub fn get_area_elements(&self) -> Vec<Root<HTMLAreaElement>> {
+ pub fn get_area_elements(&self) -> Vec<DomRoot<HTMLAreaElement>> {
self.upcast::<Node>()
.traverse_preorder()
- .filter_map(Root::downcast::<HTMLAreaElement>).collect()
+ .filter_map(DomRoot::downcast::<HTMLAreaElement>).collect()
}
}
diff --git a/components/script/dom/htmlmediaelement.rs b/components/script/dom/htmlmediaelement.rs
index 74f8c87b77b..7d976a9d899 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<HTMLSourceElement>),
+ Children(DomRoot<HTMLSourceElement>),
}
fn mode(media: &HTMLMediaElement) -> Option<Mode> {
if let Some(attr) = media.upcast::<Element>().get_attribute(&ns!(), &local_name!("src")) {
@@ -474,7 +474,7 @@ impl HTMLMediaElement {
}
let source_child_element = media.upcast::<Node>()
.children()
- .filter_map(Root::downcast::<HTMLSourceElement>)
+ .filter_map(DomRoot::downcast::<HTMLSourceElement>)
.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<Root<MediaError>> {
+ fn GetError(&self) -> Option<DomRoot<MediaError>> {
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<HTMLMediaElement>,
+ elem: DomRoot<HTMLMediaElement>,
base_url: ServoUrl
},
PauseIfNotInDocumentTask {
- elem: Root<HTMLMediaElement>,
+ elem: DomRoot<HTMLMediaElement>,
}
}
diff --git a/components/script/dom/htmlmetaelement.rs b/components/script/dom/htmlmetaelement.rs
index ea79406c336..36a2f701643 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<Prefix>,
- document: &Document) -> Root<HTMLMetaElement> {
+ document: &Document) -> DomRoot<HTMLMetaElement> {
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<Root<CSSStyleSheet>> {
+ pub fn get_cssom_stylesheet(&self) -> Option<DomRoot<CSSStyleSheet>> {
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 20a51ac2db3..2fd7a554fce 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<Prefix>,
- document: &Document) -> Root<HTMLMeterElement> {
+ document: &Document) -> DomRoot<HTMLMeterElement> {
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<NodeList> {
+ fn Labels(&self) -> DomRoot<NodeList> {
self.upcast::<HTMLElement>().labels()
}
}
diff --git a/components/script/dom/htmlmodelement.rs b/components/script/dom/htmlmodelement.rs
index 5c1aa846b2d..4266b954a81 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<Prefix>,
- document: &Document) -> Root<HTMLModElement> {
+ document: &Document) -> DomRoot<HTMLModElement> {
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 bd84b1bdd0b..0cde28ec1a6 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<Prefix>,
- document: &Document) -> Root<HTMLObjectElement> {
+ document: &Document) -> DomRoot<HTMLObjectElement> {
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<ValidityState> {
+ fn Validity(&self) -> DomRoot<ValidityState> {
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<Root<HTMLFormElement>> {
+ fn GetForm(&self) -> Option<DomRoot<HTMLFormElement>> {
self.form_owner()
}
}
@@ -126,7 +126,7 @@ impl VirtualMethods for HTMLObjectElement {
}
impl FormControl for HTMLObjectElement {
- fn form_owner(&self) -> Option<Root<HTMLFormElement>> {
+ fn form_owner(&self) -> Option<DomRoot<HTMLFormElement>> {
self.form_owner.get()
}
diff --git a/components/script/dom/htmlolistelement.rs b/components/script/dom/htmlolistelement.rs
index 87d217575f9..58c159f1e68 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<Prefix>,
- document: &Document) -> Root<HTMLOListElement> {
+ document: &Document) -> DomRoot<HTMLOListElement> {
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 cbeef475d38..b22bb0a79b5 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<Prefix>,
- document: &Document) -> Root<HTMLOptGroupElement> {
+ document: &Document) -> DomRoot<HTMLOptGroupElement> {
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::<Node>().children().filter(|child| {
child.is::<HTMLOptionElement>()
- }).map(|child| Root::from_ref(child.downcast::<HTMLOptionElement>().unwrap()));
+ }).map(|child| DomRoot::from_ref(child.downcast::<HTMLOptionElement>().unwrap()));
if disabled_state {
for option in options {
let el = option.upcast::<Element>();
diff --git a/components/script/dom/htmloptionelement.rs b/components/script/dom/htmloptionelement.rs
index 41f6996a250..9e916912b87 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<Prefix>,
- document: &Document) -> Root<HTMLOptionElement> {
+ document: &Document) -> DomRoot<HTMLOptionElement> {
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::<Node>().ancestors()
- .filter_map(Root::downcast::<HTMLSelectElement>)
+ .filter_map(DomRoot::downcast::<HTMLSelectElement>)
.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<Root<HTMLFormElement>> {
+ fn GetForm(&self) -> Option<DomRoot<HTMLFormElement>> {
let parent = self.upcast::<Node>().GetParentNode().and_then(|p|
if p.is::<HTMLOptGroupElement>() {
p.upcast::<Node>().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::<HTMLSelectElement>)
+ .filter_map(DomRoot::downcast::<HTMLSelectElement>)
.next() {
select.ask_for_reset();
}
diff --git a/components/script/dom/htmloptionscollection.rs b/components/script/dom/htmloptionscollection.rs
index 9e946cf84e3..84d4901aa8b 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<CollectionFilter + 'static>)
- -> Root<HTMLOptionsCollection>
+ -> DomRoot<HTMLOptionsCollection>
{
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<Root<Element>> {
+ fn NamedGetter(&self, name: DOMString) -> Option<DomRoot<Element>> {
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<Root<Element>> {
+ fn IndexedGetter(&self, index: u32) -> Option<DomRoot<Element>> {
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::<Node>(element)),
+ HTMLElementOrLong::HTMLElement(element) => Some(DomRoot::upcast::<Node>(element)),
HTMLElementOrLong::Long(index) => {
- self.upcast().IndexedGetter(index as u32).map(Root::upcast::<Node>)
+ self.upcast().IndexedGetter(index as u32).map(DomRoot::upcast::<Node>)
}
}
});
diff --git a/components/script/dom/htmloutputelement.rs b/components/script/dom/htmloutputelement.rs
index 2a52cfabcaa..d3d7d5991cf 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<Prefix>,
- document: &Document) -> Root<HTMLOutputElement> {
+ document: &Document) -> DomRoot<HTMLOutputElement> {
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<ValidityState> {
+ fn Validity(&self) -> DomRoot<ValidityState> {
let window = window_from_node(self);
ValidityState::new(&window, self.upcast())
}
// https://html.spec.whatwg.org/multipage/#dom-fae-form
- fn GetForm(&self) -> Option<Root<HTMLFormElement>> {
+ fn GetForm(&self) -> Option<DomRoot<HTMLFormElement>> {
self.form_owner()
}
// https://html.spec.whatwg.org/multipage/#dom-lfe-labels
- fn Labels(&self) -> Root<NodeList> {
+ fn Labels(&self) -> DomRoot<NodeList> {
self.upcast::<HTMLElement>().labels()
}
}
@@ -80,7 +80,7 @@ impl VirtualMethods for HTMLOutputElement {
}
impl FormControl for HTMLOutputElement {
- fn form_owner(&self) -> Option<Root<HTMLFormElement>> {
+ fn form_owner(&self) -> Option<DomRoot<HTMLFormElement>> {
self.form_owner.get()
}
diff --git a/components/script/dom/htmlparagraphelement.rs b/components/script/dom/htmlparagraphelement.rs
index 061847d3e12..f17b7653b6f 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<Prefix>,
- document: &Document) -> Root<HTMLParagraphElement> {
+ document: &Document) -> DomRoot<HTMLParagraphElement> {
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 af7d73c3cd8..a1544b8157c 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<Prefix>,
- document: &Document) -> Root<HTMLParamElement> {
+ document: &Document) -> DomRoot<HTMLParamElement> {
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 dc531c99b76..7befed936cc 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<Prefix>,
- document: &Document) -> Root<HTMLPreElement> {
+ document: &Document) -> DomRoot<HTMLPreElement> {
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 c5c777d9816..c8fb1937fe1 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<Prefix>,
- document: &Document) -> Root<HTMLProgressElement> {
+ document: &Document) -> DomRoot<HTMLProgressElement> {
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<NodeList> {
+ fn Labels(&self) -> DomRoot<NodeList> {
self.upcast::<HTMLElement>().labels()
}
}
diff --git a/components/script/dom/htmlquoteelement.rs b/components/script/dom/htmlquoteelement.rs
index 2169851edb1..9db0dbc87f3 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<Prefix>,
- document: &Document) -> Root<HTMLQuoteElement> {
+ document: &Document) -> DomRoot<HTMLQuoteElement> {
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 c6c21329dbf..7cdebdbcba4 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<Prefix>, document: &Document,
- creator: ElementCreator) -> Root<HTMLScriptElement> {
+ creator: ElementCreator) -> DomRoot<HTMLScriptElement> {
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 73238870e48..d9eba4dea72 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<Prefix>,
- document: &Document) -> Root<HTMLSelectElement> {
+ document: &Document) -> DomRoot<HTMLSelectElement> {
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<Item=Root<HTMLOptionElement>> {
+ fn list_of_options(&self) -> impl Iterator<Item=DomRoot<HTMLOptionElement>> {
self.upcast::<Node>()
.children()
.flat_map(|node| {
if node.is::<HTMLOptionElement>() {
- let node = Root::downcast::<HTMLOptionElement>(node).unwrap();
+ let node = DomRoot::downcast::<HTMLOptionElement>(node).unwrap();
Choice3::First(iter::once(node))
} else if node.is::<HTMLOptGroupElement>() {
- 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<Root<HTMLOptionElement>> = None;
- let mut last_selected: Option<Root<HTMLOptionElement>> = None;
+ let mut first_enabled: Option<DomRoot<HTMLOptionElement>> = None;
+ let mut last_selected: Option<DomRoot<HTMLOptionElement>> = 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::<Element>();
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<ValidityState> {
+ fn Validity(&self) -> DomRoot<ValidityState> {
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<Root<HTMLFormElement>> {
+ fn GetForm(&self) -> Option<DomRoot<HTMLFormElement>> {
self.form_owner()
}
@@ -238,12 +238,12 @@ impl HTMLSelectElementMethods for HTMLSelectElement {
}
// https://html.spec.whatwg.org/multipage/#dom-lfe-labels
- fn Labels(&self) -> Root<NodeList> {
+ fn Labels(&self) -> DomRoot<NodeList> {
self.upcast::<HTMLElement>().labels()
}
// https://html.spec.whatwg.org/multipage/#dom-select-options
- fn Options(&self) -> Root<HTMLOptionsCollection> {
+ fn Options(&self) -> DomRoot<HTMLOptionsCollection> {
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<Root<Element>> {
+ fn Item(&self, index: u32) -> Option<DomRoot<Element>> {
self.Options().upcast().Item(index)
}
// https://html.spec.whatwg.org/multipage/#dom-select-item
- fn IndexedGetter(&self, index: u32) -> Option<Root<Element>> {
+ fn IndexedGetter(&self, index: u32) -> Option<DomRoot<Element>> {
self.Options().IndexedGetter(index)
}
// https://html.spec.whatwg.org/multipage/#dom-select-nameditem
- fn NamedItem(&self, name: DOMString) -> Option<Root<HTMLOptionElement>> {
- self.Options().NamedGetter(name).map_or(None, |e| Root::downcast::<HTMLOptionElement>(e))
+ fn NamedItem(&self, name: DOMString) -> Option<DomRoot<HTMLOptionElement>> {
+ self.Options().NamedGetter(name).map_or(None, |e| DomRoot::downcast::<HTMLOptionElement>(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<Root<HTMLFormElement>> {
+ fn form_owner(&self) -> Option<DomRoot<HTMLFormElement>> {
self.form_owner.get()
}
diff --git a/components/script/dom/htmlsourceelement.rs b/components/script/dom/htmlsourceelement.rs
index 9ff82f59aef..c7a60c159c8 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<Prefix>,
- document: &Document) -> Root<HTMLSourceElement> {
+ document: &Document) -> DomRoot<HTMLSourceElement> {
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 9713ad86007..f0a16e47d61 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<Prefix>,
- document: &Document) -> Root<HTMLSpanElement> {
+ document: &Document) -> DomRoot<HTMLSpanElement> {
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 0ba69b63549..952c143ad68 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<Prefix>,
document: &Document,
- creator: ElementCreator) -> Root<HTMLStyleElement> {
+ creator: ElementCreator) -> DomRoot<HTMLStyleElement> {
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<Root<CSSStyleSheet>> {
+ pub fn get_cssom_stylesheet(&self) -> Option<DomRoot<CSSStyleSheet>> {
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<Root<DOMStyleSheet>> {
- self.get_cssom_stylesheet().map(Root::upcast)
+ fn GetSheet(&self) -> Option<DomRoot<DOMStyleSheet>> {
+ self.get_cssom_stylesheet().map(DomRoot::upcast)
}
}
diff --git a/components/script/dom/htmltablecaptionelement.rs b/components/script/dom/htmltablecaptionelement.rs
index 852850f4db9..2ceecc50609 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<Prefix>,
- document: &Document) -> Root<HTMLTableCaptionElement> {
+ document: &Document) -> DomRoot<HTMLTableCaptionElement> {
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 d2910023466..ffbef21ed89 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<Prefix>,
- document: &Document) -> Root<HTMLTableColElement> {
+ document: &Document) -> DomRoot<HTMLTableColElement> {
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 6c9a2c63817..7ebd64f20dc 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<Prefix>, document: &Document)
- -> Root<HTMLTableDataCellElement> {
+ -> DomRoot<HTMLTableDataCellElement> {
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 3571dda873d..2f8e3e3857b 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<Prefix>, document: &Document)
- -> Root<HTMLTableElement> {
+ -> DomRoot<HTMLTableElement> {
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<Root<HTMLTableSectionElement>> {
+ fn get_first_section_of_type(&self, atom: &LocalName) -> Option<DomRoot<HTMLTableSectionElement>> {
self.upcast::<Node>()
.child_elements()
.find(|n| n.is::<HTMLTableSectionElement>() && 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<Element>) -> bool {
+ where P: FnMut(&DomRoot<Element>) -> bool {
if let Some(e) = section {
if e.upcast::<Element>().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<HTMLTableSectionElement> {
+ fn create_section_of_type(&self, atom: &LocalName) -> DomRoot<HTMLTableSectionElement> {
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<HTMLCollection> {
+ fn Rows(&self) -> DomRoot<HTMLCollection> {
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<Root<HTMLTableCaptionElement>> {
- self.upcast::<Node>().children().filter_map(Root::downcast).next()
+ fn GetCaption(&self) -> Option<DomRoot<HTMLTableCaptionElement>> {
+ self.upcast::<Node>().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<HTMLTableCaptionElement> {
+ fn CreateCaption(&self) -> DomRoot<HTMLTableCaptionElement> {
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<Root<HTMLTableSectionElement>> {
+ fn GetTHead(&self) -> Option<DomRoot<HTMLTableSectionElement>> {
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<HTMLTableSectionElement> {
+ fn CreateTHead(&self) -> DomRoot<HTMLTableSectionElement> {
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<Root<HTMLTableSectionElement>> {
+ fn GetTFoot(&self) -> Option<DomRoot<HTMLTableSectionElement>> {
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<HTMLTableSectionElement> {
+ fn CreateTFoot(&self) -> DomRoot<HTMLTableSectionElement> {
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<HTMLCollection> {
+ fn TBodies(&self) -> DomRoot<HTMLCollection> {
#[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<HTMLTableSectionElement> {
+ fn CreateTBody(&self) -> DomRoot<HTMLTableSectionElement> {
let tbody = HTMLTableSectionElement::new(local_name!("tbody"),
None,
&document_from_node(self));
let node = self.upcast::<Node>();
let last_tbody =
node.rev_children()
- .filter_map(Root::downcast::<Element>)
+ .filter_map(DomRoot::downcast::<Element>)
.find(|n| n.is::<HTMLTableSectionElement>() && n.local_name() == &local_name!("tbody"));
let reference_element =
last_tbody.and_then(|t| t.upcast::<Node>().GetNextSibling());
@@ -289,7 +289,7 @@ impl HTMLTableElementMethods for HTMLTableElement {
}
// https://html.spec.whatwg.org/multipage/#dom-table-insertrow
- fn InsertRow(&self, index: i32) -> Fallible<Root<HTMLTableRowElement>> {
+ fn InsertRow(&self, index: i32) -> Fallible<DomRoot<HTMLTableRowElement>> {
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::<Element>)
+ .filter_map(DomRoot::downcast::<Element>)
.find(|n| n.is::<HTMLTableSectionElement>() && n.local_name() == &local_name!("tbody")) {
last_tbody.upcast::<Node>().AppendChild(new_row.upcast::<Node>())
.expect("InsertRow failed to append first row.");
@@ -355,7 +355,7 @@ impl HTMLTableElementMethods for HTMLTableElement {
return Err(Error::IndexSize);
}
// Step 3.
- Root::upcast::<Node>(rows.Item(index as u32).unwrap()).remove_self();
+ DomRoot::upcast::<Node>(rows.Item(index as u32).unwrap()).remove_self();
Ok(())
}
diff --git a/components/script/dom/htmltableheadercellelement.rs b/components/script/dom/htmltableheadercellelement.rs
index 7f426ff9dca..6b03b421117 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<Prefix>,
- document: &Document) -> Root<HTMLTableHeaderCellElement> {
+ document: &Document) -> DomRoot<HTMLTableHeaderCellElement> {
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 ded30ae590c..bdc6708ee4f 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<Prefix>, document: &Document)
- -> Root<HTMLTableRowElement> {
+ -> DomRoot<HTMLTableRowElement> {
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<HTMLCollection>) -> i32 {
+ fn row_index(&self, collection: DomRoot<HTMLCollection>) -> 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<HTMLCollection> {
+ fn Cells(&self) -> DomRoot<HTMLCollection> {
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<Root<HTMLElement>> {
+ fn InsertCell(&self, index: i32) -> Fallible<DomRoot<HTMLElement>> {
let node = self.upcast::<Node>();
node.insert_cell_or_row(
index,
diff --git a/components/script/dom/htmltablesectionelement.rs b/components/script/dom/htmltablesectionelement.rs
index ffaaeea0427..1b4d1c72020 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<Prefix>, document: &Document)
- -> Root<HTMLTableSectionElement> {
+ -> DomRoot<HTMLTableSectionElement> {
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<HTMLCollection> {
+ fn Rows(&self) -> DomRoot<HTMLCollection> {
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<Root<HTMLElement>> {
+ fn InsertRow(&self, index: i32) -> Fallible<DomRoot<HTMLElement>> {
let node = self.upcast::<Node>();
node.insert_cell_or_row(
index,
diff --git a/components/script/dom/htmltemplateelement.rs b/components/script/dom/htmltemplateelement.rs
index 5f345206a94..dde9d380c72 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<Prefix>,
- document: &Document) -> Root<HTMLTemplateElement> {
+ document: &Document) -> DomRoot<HTMLTemplateElement> {
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<DocumentFragment> {
+ fn Content(&self) -> DomRoot<DocumentFragment> {
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::<HTMLTemplateElement>().unwrap();
// Steps 2-3.
- let copy_contents = Root::upcast::<Node>(copy.Content());
+ let copy_contents = DomRoot::upcast::<Node>(copy.Content());
let copy_contents_doc = copy_contents.owner_doc();
for child in self.Content().upcast::<Node>().children() {
let copy_child = Node::clone(
diff --git a/components/script/dom/htmltextareaelement.rs b/components/script/dom/htmltextareaelement.rs
index 3d0cc360deb..c599113f6b3 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<Prefix>,
- document: &Document) -> Root<HTMLTextAreaElement> {
+ document: &Document) -> DomRoot<HTMLTextAreaElement> {
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<Root<HTMLFormElement>> {
+ fn GetForm(&self) -> Option<DomRoot<HTMLFormElement>> {
self.form_owner()
}
@@ -232,7 +232,7 @@ impl HTMLTextAreaElementMethods for HTMLTextAreaElement {
}
// https://html.spec.whatwg.org/multipage/#dom-lfe-labels
- fn Labels(&self) -> Root<NodeList> {
+ fn Labels(&self) -> DomRoot<NodeList> {
self.upcast::<HTMLElement>().labels()
}
@@ -441,7 +441,7 @@ impl VirtualMethods for HTMLTextAreaElement {
}
impl FormControl for HTMLTextAreaElement {
- fn form_owner(&self) -> Option<Root<HTMLFormElement>> {
+ fn form_owner(&self) -> Option<DomRoot<HTMLFormElement>> {
self.form_owner.get()
}
diff --git a/components/script/dom/htmltimeelement.rs b/components/script/dom/htmltimeelement.rs
index c5a54bc0ebc..0653d32ad5f 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<Prefix>,
- document: &Document) -> Root<HTMLTimeElement> {
+ document: &Document) -> DomRoot<HTMLTimeElement> {
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 4e7208dc9ad..0c1aeac47b6 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<Prefix>,
- document: &Document) -> Root<HTMLTitleElement> {
+ document: &Document) -> DomRoot<HTMLTitleElement> {
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 f91ea1aba3d..94015862c58 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<Prefix>,
- document: &Document) -> Root<HTMLTrackElement> {
+ document: &Document) -> DomRoot<HTMLTrackElement> {
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 7240597d4f0..d6b1b7ea41e 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<Prefix>,
- document: &Document) -> Root<HTMLUListElement> {
+ document: &Document) -> DomRoot<HTMLUListElement> {
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 7894dfafc43..1622b88cb77 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<Prefix>,
- document: &Document) -> Root<HTMLUnknownElement> {
+ document: &Document) -> DomRoot<HTMLUnknownElement> {
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 c841832c17d..998f46c279b 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<Prefix>,
- document: &Document) -> Root<HTMLVideoElement> {
+ document: &Document) -> DomRoot<HTMLVideoElement> {
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 910bc4004de..98be416ff45 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<Vec<u8>>)
- -> Fallible<Root<ImageData>> {
+ -> Fallible<DomRoot<ImageData>> {
let len = width * height * 4;
unsafe {
let cx = global.get_cx();
@@ -54,7 +54,7 @@ impl ImageData {
width: u32,
mut opt_height: Option<u32>,
opt_jsobject: Option<*mut JSObject>)
- -> Fallible<Root<ImageData>> {
+ -> Fallible<DomRoot<ImageData>> {
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<Root<Self>> {
+ pub fn Constructor(global: &GlobalScope, width: u32, height: u32) -> Fallible<DomRoot<Self>> {
unsafe { Self::new_with_jsobject(global, width, Some(height), None) }
}
@@ -125,7 +125,7 @@ impl ImageData {
jsobject: *mut JSObject,
width: u32,
opt_height: Option<u32>)
- -> Fallible<Root<Self>> {
+ -> Fallible<DomRoot<Self>> {
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 821008bb383..641eb21a5d3 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<DOMString>,
- is_composing: bool) -> Root<InputEvent> {
+ is_composing: bool) -> DomRoot<InputEvent> {
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<Root<InputEvent>> {
+ -> Fallible<DomRoot<InputEvent>> {
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 4107c809d3e..69d71ae665a 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<KeyboardEvent> {
+ pub fn new_uninitialized(window: &Window) -> DomRoot<KeyboardEvent> {
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<u32>,
- key_code: u32) -> Root<KeyboardEvent> {
+ key_code: u32) -> DomRoot<KeyboardEvent> {
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<Root<KeyboardEvent>> {
+ init: &KeyboardEventBinding::KeyboardEventInit) -> Fallible<DomRoot<KeyboardEvent>> {
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 839e709d71c..868b9df2266 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<Location> {
+ pub fn new(window: &Window) -> DomRoot<Location> {
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 43b1b17724f..9029a2b694a 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 a506134b90c..5787085e9fc 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<MediaError> {
+ pub fn new(window: &Window, code: u16) -> DomRoot<MediaError> {
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 e707dd428cf..8b67de26071 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<Locked<StyleMediaList>>)
- -> Root<MediaList> {
+ -> DomRoot<MediaList> {
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 4c23ee080ba..33eb2dc92d5 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<MediaQueryList> {
+ pub fn new(document: &Document, media_query_list: MediaList) -> DomRoot<MediaQueryList> {
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 e825b278730..8eb1c8a3520 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<MediaQueryListEvent> {
+ matches: bool) -> DomRoot<MediaQueryListEvent> {
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<MediaQueryListEvent> {
+ media: DOMString, matches: bool) -> DomRoot<MediaQueryListEvent> {
let ev = MediaQueryListEvent::new_initialized(global, media, matches);
{
let event = ev.upcast::<Event>();
@@ -51,7 +51,7 @@ impl MediaQueryListEvent {
pub fn Constructor(window: &Window, type_: DOMString,
init: &MediaQueryListEventInit)
- -> Fallible<Root<MediaQueryListEvent>> {
+ -> Fallible<DomRoot<MediaQueryListEvent>> {
let global = window.upcast::<GlobalScope>();
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 7987032f42d..cab9e245f8a 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<MessageEvent> {
+ pub fn new_uninitialized(global: &GlobalScope) -> DomRoot<MessageEvent> {
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<MessageEvent> {
+ lastEventId: DOMString) -> DomRoot<MessageEvent> {
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<MessageEvent> {
+ -> DomRoot<MessageEvent> {
let ev = MessageEvent::new_initialized(global, data, origin, lastEventId);
{
let event = ev.upcast::<Event>();
@@ -66,7 +66,7 @@ impl MessageEvent {
pub fn Constructor(global: &GlobalScope,
type_: DOMString,
init: RootedTraceableBox<MessageEventBinding::MessageEventInit>)
- -> Fallible<Root<MessageEvent>> {
+ -> Fallible<DomRoot<MessageEvent>> {
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 b27255e85b2..ecef40321e5 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<Plugin> {
+ fn EnabledPlugin(&self) -> DomRoot<Plugin> {
unreachable!()
}
}
diff --git a/components/script/dom/mimetypearray.rs b/components/script/dom/mimetypearray.rs
index 6b87bb60b3f..7a195e3fe7f 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<MimeTypeArray> {
+ pub fn new(global: &GlobalScope) -> DomRoot<MimeTypeArray> {
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<Root<MimeType>> {
+ fn Item(&self, _index: u32) -> Option<DomRoot<MimeType>> {
None
}
// https://html.spec.whatwg.org/multipage/#dom-mimetypearray-nameditem
- fn NamedItem(&self, _name: DOMString) -> Option<Root<MimeType>> {
+ fn NamedItem(&self, _name: DOMString) -> Option<DomRoot<MimeType>> {
None
}
// https://html.spec.whatwg.org/multipage/#dom-mimetypearray-item
- fn IndexedGetter(&self, _index: u32) -> Option<Root<MimeType>> {
+ fn IndexedGetter(&self, _index: u32) -> Option<DomRoot<MimeType>> {
None
}
// check-tidy: no specs after this line
- fn NamedGetter(&self, _name: DOMString) -> Option<Root<MimeType>> {
+ fn NamedGetter(&self, _name: DOMString) -> Option<DomRoot<MimeType>> {
None
}
diff --git a/components/script/dom/mod.rs b/components/script/dom/mod.rs
index deede3622d0..6866efd17d0 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<T>`.
+//! * a `T::new` static method that returns `DomRoot<T>`.
//!
//! (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 e3f4cdab91d..2fa79f43386 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<MouseEvent> {
+ pub fn new_uninitialized(window: &Window) -> DomRoot<MouseEvent> {
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<MouseEvent> {
+ related_target: Option<&EventTarget>) -> DomRoot<MouseEvent> {
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<Root<MouseEvent>> {
+ init: &MouseEventBinding::MouseEventInit) -> Fallible<DomRoot<MouseEvent>> {
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<Root<EventTarget>> {
+ fn GetRelatedTarget(&self) -> Option<DomRoot<EventTarget>> {
self.related_target.get()
}
diff --git a/components/script/dom/mutationobserver.rs b/components/script/dom/mutationobserver.rs
index 6a411b7833f..72996a78289 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<MutationCallback>,
- record_queue: DomRefCell<Vec<Root<MutationRecord>>>,
+ record_queue: DomRefCell<Vec<DomRoot<MutationRecord>>>,
}
pub enum Mutation<'a> {
@@ -37,7 +37,7 @@ pub enum Mutation<'a> {
#[derive(HeapSizeOf, JSTraceable)]
pub struct RegisteredObserver {
- observer: Root<MutationObserver>,
+ observer: DomRoot<MutationObserver>,
options: ObserverOptions,
}
@@ -53,7 +53,7 @@ pub struct ObserverOptions {
}
impl MutationObserver {
- fn new(global: &Window, callback: Rc<MutationCallback>) -> Root<MutationObserver> {
+ fn new(global: &Window, callback: Rc<MutationCallback>) -> DomRoot<MutationObserver> {
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<MutationCallback>) -> Fallible<Root<MutationObserver>> {
+ pub fn Constructor(global: &Window, callback: Rc<MutationCallback>) -> Fallible<DomRoot<MutationObserver>> {
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 &notify_list {
- let queue: Vec<Root<MutationRecord>> = mo.record_queue.borrow().clone();
+ let queue: Vec<DomRoot<MutationRecord>> = 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<MutationObserver>, Option<DOMString>)> = vec![];
+ let mut interestedObservers: Vec<(DomRoot<MutationObserver>, Option<DOMString>)> = 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 bbb42dd1f28..a3b38182147 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<DOMString>) -> Root<MutationRecord> {
+ old_value: Option<DOMString>) -> DomRoot<MutationRecord> {
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<MutationRecord> {
+ prev_sibling: Option<&Node>) -> DomRoot<MutationRecord> {
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<Node> {
- Root::from_ref(&*self.target)
+ fn Target(&self) -> DomRoot<Node> {
+ 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<NodeList> {
+ fn AddedNodes(&self) -> DomRoot<NodeList> {
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<NodeList> {
+ fn RemovedNodes(&self) -> DomRoot<NodeList> {
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<Root<Node>> {
- self.prev_sibling.as_ref().map(|node| Root::from_ref(&**node))
+ fn GetPreviousSibling(&self) -> Option<DomRoot<Node>> {
+ self.prev_sibling.as_ref().map(|node| DomRoot::from_ref(&**node))
}
// https://dom.spec.whatwg.org/#dom-mutationrecord-previoussibling
- fn GetNextSibling(&self) -> Option<Root<Node>> {
- self.next_sibling.as_ref().map(|node| Root::from_ref(&**node))
+ fn GetNextSibling(&self) -> Option<DomRoot<Node>> {
+ 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 9c2c0c163ad..023665371cf 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<NamedNodeMap> {
+ pub fn new(window: &Window, elem: &Element) -> DomRoot<NamedNodeMap> {
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<Root<Attr>> {
- self.owner.attrs().get(index as usize).map(|js| Root::from_ref(&**js))
+ fn Item(&self, index: u32) -> Option<DomRoot<Attr>> {
+ 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<Root<Attr>> {
+ fn GetNamedItem(&self, name: DOMString) -> Option<DomRoot<Attr>> {
self.owner.get_attribute_by_name(name)
}
// https://dom.spec.whatwg.org/#dom-namednodemap-getnameditemns
fn GetNamedItemNS(&self, namespace: Option<DOMString>, local_name: DOMString)
- -> Option<Root<Attr>> {
+ -> Option<DomRoot<Attr>> {
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<Option<Root<Attr>>> {
+ fn SetNamedItem(&self, attr: &Attr) -> Fallible<Option<DomRoot<Attr>>> {
self.owner.SetAttributeNode(attr)
}
// https://dom.spec.whatwg.org/#dom-namednodemap-setnameditemns
- fn SetNamedItemNS(&self, attr: &Attr) -> Fallible<Option<Root<Attr>>> {
+ fn SetNamedItemNS(&self, attr: &Attr) -> Fallible<Option<DomRoot<Attr>>> {
self.SetNamedItem(attr)
}
// https://dom.spec.whatwg.org/#dom-namednodemap-removenameditem
- fn RemoveNamedItem(&self, name: DOMString) -> Fallible<Root<Attr>> {
+ fn RemoveNamedItem(&self, name: DOMString) -> Fallible<DomRoot<Attr>> {
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<DOMString>, local_name: DOMString)
- -> Fallible<Root<Attr>> {
+ -> Fallible<DomRoot<Attr>> {
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<Root<Attr>> {
+ fn IndexedGetter(&self, index: u32) -> Option<DomRoot<Attr>> {
self.Item(index)
}
// check-tidy: no specs after this line
- fn NamedGetter(&self, name: DOMString) -> Option<Root<Attr>> {
+ fn NamedGetter(&self, name: DOMString) -> Option<DomRoot<Attr>> {
self.GetNamedItem(name)
}
diff --git a/components/script/dom/navigator.rs b/components/script/dom/navigator.rs
index c24b4972e37..5d3e41dc421 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<Navigator> {
+ pub fn new(window: &Window) -> DomRoot<Navigator> {
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<Bluetooth> {
+ fn Bluetooth(&self) -> DomRoot<Bluetooth> {
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<PluginArray> {
+ fn Plugins(&self) -> DomRoot<PluginArray> {
self.plugins.or_init(|| PluginArray::new(&self.global()))
}
// https://html.spec.whatwg.org/multipage/#dom-navigator-mimetypes
- fn MimeTypes(&self) -> Root<MimeTypeArray> {
+ fn MimeTypes(&self) -> DomRoot<MimeTypeArray> {
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<ServiceWorkerContainer> {
+ fn ServiceWorker(&self) -> DomRoot<ServiceWorkerContainer> {
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<GamepadList> {
+ fn GetGamepads(&self) -> DomRoot<GamepadList> {
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<Permissions> {
+ fn Permissions(&self) -> DomRoot<Permissions> {
self.permissions.or_init(|| Permissions::new(&self.global()))
}
@@ -151,7 +151,7 @@ impl NavigatorMethods for Navigator {
}
impl Navigator {
- pub fn Vr(&self) -> Root<VR> {
+ pub fn Vr(&self) -> DomRoot<VR> {
self.vr.or_init(|| VR::new(&self.global()))
}
}
diff --git a/components/script/dom/node.rs b/components/script/dom/node.rs
index 28f1979a53e..a620d09433d 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<Root<Element>> {
+ pub fn as_custom_element(&self) -> Option<DomRoot<Element>> {
self.downcast::<Element>()
.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<Node>;
+ type Item = DomRoot<Node>;
- fn next(&mut self) -> Option<Root<Node>> {
+ fn next(&mut self) -> Option<DomRoot<Node>> {
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<Node> = Root::upcast(self.owner_doc());
+ let doc: DomRoot<Node> = 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<Item=Root<Node>> {
+ pub fn inclusively_following_siblings(&self) -> impl Iterator<Item=DomRoot<Node>> {
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<Item=Root<Node>> {
+ pub fn inclusively_preceding_siblings(&self) -> impl Iterator<Item=DomRoot<Node>> {
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<Item=Root<Node>> {
+ pub fn following_siblings(&self) -> impl Iterator<Item=DomRoot<Node>> {
SimpleNodeIterator {
current: self.GetNextSibling(),
next_node: |n| n.GetNextSibling(),
}
}
- pub fn preceding_siblings(&self) -> impl Iterator<Item=Root<Node>> {
+ pub fn preceding_siblings(&self) -> impl Iterator<Item=DomRoot<Node>> {
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<Item=Root<Node>> {
+ pub fn descending_last_children(&self) -> impl Iterator<Item=DomRoot<Node>> {
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<Option<Root<Element>>> {
+ pub fn query_selector(&self, selectors: DOMString) -> Fallible<Option<DomRoot<Element>>> {
// 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<Root<NodeList>> {
+ pub fn query_selector_all(&self, selectors: DOMString) -> Fallible<DomRoot<NodeList>> {
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<Item=Root<Node>> {
+ pub fn ancestors(&self) -> impl Iterator<Item=DomRoot<Node>> {
SimpleNodeIterator {
current: self.GetParentNode(),
next_node: |n| n.GetParentNode(),
}
}
- pub fn inclusive_ancestors(&self) -> impl Iterator<Item=Root<Node>> {
+ pub fn inclusive_ancestors(&self) -> impl Iterator<Item=DomRoot<Node>> {
SimpleNodeIterator {
- current: Some(Root::from_ref(self)),
+ current: Some(DomRoot::from_ref(self)),
next_node: |n| n.GetParentNode(),
}
}
- pub fn owner_doc(&self) -> Root<Document> {
+ pub fn owner_doc(&self) -> DomRoot<Document> {
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<Item=Root<Node>> {
+ pub fn children(&self) -> impl Iterator<Item=DomRoot<Node>> {
SimpleNodeIterator {
current: self.GetFirstChild(),
next_node: |n| n.GetNextSibling(),
}
}
- pub fn rev_children(&self) -> impl Iterator<Item=Root<Node>> {
+ pub fn rev_children(&self) -> impl Iterator<Item=DomRoot<Node>> {
SimpleNodeIterator {
current: self.GetLastChild(),
next_node: |n| n.GetPreviousSibling(),
}
}
- pub fn child_elements(&self) -> impl Iterator<Item=Root<Element>> {
- self.children().filter_map(Root::downcast as fn(_) -> _).peekable()
+ pub fn child_elements(&self) -> impl Iterator<Item=DomRoot<Element>> {
+ 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<F, G, I>(&self, index: i32, get_items: F, new_child: G) -> Fallible<Root<HTMLElement>>
- where F: Fn() -> Root<HTMLCollection>,
- G: Fn() -> Root<I>,
+ pub fn insert_cell_or_row<F, G, I>(&self, index: i32, get_items: F, new_child: G) -> Fallible<DomRoot<HTMLElement>>
+ where F: Fn() -> DomRoot<HTMLCollection>,
+ G: Fn() -> DomRoot<I>,
I: DerivedFrom<Node> + DerivedFrom<HTMLElement> + DomObject,
{
if index < -1 {
@@ -897,7 +897,7 @@ impl Node {
} else {
let items = get_items();
let node = match items.elements_iter()
- .map(Root::upcast::<Node>)
+ .map(DomRoot::upcast::<Node>)
.map(Some)
.chain(iter::once(None))
.nth(index as usize) {
@@ -908,12 +908,12 @@ impl Node {
}
}
- Ok(Root::upcast::<HTMLElement>(tr))
+ Ok(DomRoot::upcast::<HTMLElement>(tr))
}
/// Used by `HTMLTableSectionElement::DeleteRow` and `HTMLTableRowElement::DeleteCell`
pub fn delete_cell_or_row<F, G>(&self, index: i32, get_items: F, is_delete_type: G) -> ErrorResult
- where F: Fn() -> Root<HTMLCollection>,
+ where F: Fn() -> DomRoot<HTMLCollection>,
G: Fn(&Element) -> bool
{
let element = match index {
@@ -921,7 +921,7 @@ impl Node {
-1 => {
let last_child = self.upcast::<Node>().GetLastChild();
match last_child.and_then(|node| node.inclusively_preceding_siblings()
- .filter_map(Root::downcast::<Element>)
+ .filter_map(DomRoot::downcast::<Element>)
.filter(|elem| is_delete_type(elem))
.next()) {
Some(element) => element,
@@ -950,7 +950,7 @@ impl Node {
}
}
- pub fn get_cssom_stylesheet(&self) -> Option<Root<CSSStyleSheet>> {
+ pub fn get_cssom_stylesheet(&self) -> Option<DomRoot<CSSStyleSheet>> {
if let Some(node) = self.downcast::<HTMLStyleElement>() {
node.get_cssom_stylesheet()
} else if let Some(node) = self.downcast::<HTMLLinkElement>() {
@@ -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<I>(mut nodes: I, not_in: &[NodeOrString]) -> Option<Root<Node>>
- where I: Iterator<Item=Root<Node>>
+fn first_node_not_in<I>(mut nodes: I, not_in: &[NodeOrString]) -> Option<DomRoot<Node>>
+ where I: Iterator<Item=DomRoot<Node>>
{
nodes.find(|node| {
not_in.iter().all(|n| {
@@ -982,7 +982,7 @@ fn first_node_not_in<I>(mut nodes: I, not_in: &[NodeOrString]) -> Option<Root<No
/// returns it.
#[allow(unsafe_code)]
pub unsafe fn from_untrusted_node_address(_runtime: *mut JSRuntime, candidate: UntrustedNodeAddress)
- -> Root<Node> {
+ -> DomRoot<Node> {
// 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<Node>` 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<Node> {
//
pub struct FollowingNodeIterator {
- current: Option<Root<Node>>,
- root: Root<Node>,
+ current: Option<DomRoot<Node>>,
+ root: DomRoot<Node>,
}
impl FollowingNodeIterator {
/// Skips iterating the children of the current node
- pub fn next_skipping_children(&mut self) -> Option<Root<Node>> {
+ pub fn next_skipping_children(&mut self) -> Option<DomRoot<Node>> {
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<Node>) -> Option<Root<Node>> {
+ fn next_skipping_children_impl(&mut self, current: DomRoot<Node>) -> Option<DomRoot<Node>> {
if self.root == current {
self.current = None;
return None;
@@ -1240,10 +1240,10 @@ impl FollowingNodeIterator {
}
impl Iterator for FollowingNodeIterator {
- type Item = Root<Node>;
+ type Item = DomRoot<Node>;
// https://dom.spec.whatwg.org/#concept-tree-following
- fn next(&mut self) -> Option<Root<Node>> {
+ fn next(&mut self) -> Option<DomRoot<Node>> {
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<Node>>,
- root: Root<Node>,
+ current: Option<DomRoot<Node>>,
+ root: DomRoot<Node>,
}
impl Iterator for PrecedingNodeIterator {
- type Item = Root<Node>;
+ type Item = DomRoot<Node>;
// https://dom.spec.whatwg.org/#concept-tree-preceding
- fn next(&mut self) -> Option<Root<Node>> {
+ fn next(&mut self) -> Option<DomRoot<Node>> {
let current = match self.current.take() {
None => return None,
Some(current) => current,
@@ -1291,16 +1291,16 @@ impl Iterator for PrecedingNodeIterator {
}
struct SimpleNodeIterator<I>
- where I: Fn(&Node) -> Option<Root<Node>>
+ where I: Fn(&Node) -> Option<DomRoot<Node>>
{
- current: Option<Root<Node>>,
+ current: Option<DomRoot<Node>>,
next_node: I,
}
impl<I> Iterator for SimpleNodeIterator<I>
- where I: Fn(&Node) -> Option<Root<Node>>
+ where I: Fn(&Node) -> Option<DomRoot<Node>>
{
- type Item = Root<Node>;
+ type Item = DomRoot<Node>;
fn next(&mut self) -> Option<Self::Item> {
let current = self.current.take();
@@ -1310,19 +1310,19 @@ impl<I> Iterator for SimpleNodeIterator<I>
}
pub struct TreeIterator {
- current: Option<Root<Node>>,
+ current: Option<DomRoot<Node>>,
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<Root<Node>> {
+ pub fn next_skipping_children(&mut self) -> Option<DomRoot<Node>> {
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<Node>) -> Option<Root<Node>> {
+ fn next_skipping_children_impl(&mut self, current: DomRoot<Node>) -> Option<DomRoot<Node>> {
for ancestor in current.inclusive_ancestors() {
if self.depth == 0 {
break;
@@ -1349,10 +1349,10 @@ impl TreeIterator {
}
impl Iterator for TreeIterator {
- type Item = Root<Node>;
+ type Item = DomRoot<Node>;
// https://dom.spec.whatwg.org/#concept-tree-order
- fn next(&mut self) -> Option<Root<Node>> {
+ fn next(&mut self) -> Option<DomRoot<Node>> {
let current = match self.current.take() {
None => return None,
Some(current) => current,
@@ -1380,8 +1380,8 @@ impl Node {
pub fn reflect_node<N>(
node: Box<N>,
document: &Document,
- wrap_fn: unsafe extern "Rust" fn(*mut JSContext, &GlobalScope, Box<N>) -> Root<N>)
- -> Root<N>
+ wrap_fn: unsafe extern "Rust" fn(*mut JSContext, &GlobalScope, Box<N>) -> DomRoot<N>)
+ -> DomRoot<N>
where N: DerivedFrom<Node> + 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<Root<Node>> {
+ -> Fallible<DomRoot<Node>> {
// 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::<Element>) {
+ for descendant in kid.traverse_preorder().filter_map(DomRoot::downcast::<Element>) {
// 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<Root<Node>> {
+ fn pre_remove(child: &Node, parent: &Node) -> Fallible<DomRoot<Node>> {
// 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<Node> {
+ clone_children: CloneChildrenFlag) -> DomRoot<Node> {
// 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<Node> = match node.type_id() {
+ let copy: DomRoot<Node> = match node.type_id() {
NodeTypeId::DocumentType => {
let doctype = node.downcast::<DocumentType>().unwrap();
let doctype = DocumentType::new(doctype.name().clone(),
Some(doctype.public_id().clone()),
Some(doctype.system_id().clone()),
&document);
- Root::upcast::<Node>(doctype)
+ DomRoot::upcast::<Node>(doctype)
},
NodeTypeId::DocumentFragment => {
let doc_fragment = DocumentFragment::new(&document);
- Root::upcast::<Node>(doc_fragment)
+ DomRoot::upcast::<Node>(doc_fragment)
},
NodeTypeId::CharacterData(_) => {
let cdata = node.downcast::<CharacterData>().unwrap();
@@ -1823,7 +1823,7 @@ impl Node {
None, DocumentActivity::Inactive,
DocumentSource::NotFromParser, loader,
None, None);
- Root::upcast::<Node>(document)
+ DomRoot::upcast::<Node>(document)
},
NodeTypeId::Element(..) => {
let element = node.downcast::<Element>().unwrap();
@@ -1837,14 +1837,14 @@ impl Node {
&document,
ElementCreator::ScriptCreated,
CustomElementCreationMode::Asynchronous);
- Root::upcast::<Node>(element)
+ DomRoot::upcast::<Node>(element)
},
};
// Step 3.
let document = match copy.downcast::<Document>() {
- 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<T: Iterator<Item=Root<Node>>>(iterator: T) -> DOMString {
+ pub fn collect_text_contents<T: Iterator<Item=DomRoot<Node>>>(iterator: T) -> DOMString {
let mut content = String::new();
for node in iterator {
if let Some(ref text) = node.downcast::<Text>() {
@@ -1976,7 +1976,7 @@ impl NodeMethods for Node {
}
// https://dom.spec.whatwg.org/#dom-node-ownerdocument
- fn GetOwnerDocument(&self) -> Option<Root<Document>> {
+ fn GetOwnerDocument(&self) -> Option<DomRoot<Document>> {
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<Node> {
+ fn GetRootNode(&self) -> DomRoot<Node> {
self.inclusive_ancestors().last().unwrap()
}
// https://dom.spec.whatwg.org/#dom-node-parentnode
- fn GetParentNode(&self) -> Option<Root<Node>> {
+ fn GetParentNode(&self) -> Option<DomRoot<Node>> {
self.parent_node.get()
}
// https://dom.spec.whatwg.org/#dom-node-parentelement
- fn GetParentElement(&self) -> Option<Root<Element>> {
- self.GetParentNode().and_then(Root::downcast)
+ fn GetParentElement(&self) -> Option<DomRoot<Element>> {
+ 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<NodeList> {
+ fn ChildNodes(&self) -> DomRoot<NodeList> {
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<Root<Node>> {
+ fn GetFirstChild(&self) -> Option<DomRoot<Node>> {
self.first_child.get()
}
// https://dom.spec.whatwg.org/#dom-node-lastchild
- fn GetLastChild(&self) -> Option<Root<Node>> {
+ fn GetLastChild(&self) -> Option<DomRoot<Node>> {
self.last_child.get()
}
// https://dom.spec.whatwg.org/#dom-node-previoussibling
- fn GetPreviousSibling(&self) -> Option<Root<Node>> {
+ fn GetPreviousSibling(&self) -> Option<DomRoot<Node>> {
self.prev_sibling.get()
}
// https://dom.spec.whatwg.org/#dom-node-nextsibling
- fn GetNextSibling(&self) -> Option<Root<Node>> {
+ fn GetNextSibling(&self) -> Option<DomRoot<Node>> {
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<Root<Node>> {
+ fn InsertBefore(&self, node: &Node, child: Option<&Node>) -> Fallible<DomRoot<Node>> {
Node::pre_insert(node, self, child)
}
// https://dom.spec.whatwg.org/#dom-node-appendchild
- fn AppendChild(&self, node: &Node) -> Fallible<Root<Node>> {
+ fn AppendChild(&self, node: &Node) -> Fallible<DomRoot<Node>> {
Node::pre_insert(node, self, None)
}
// https://dom.spec.whatwg.org/#concept-node-replace
- fn ReplaceChild(&self, node: &Node, child: &Node) -> Fallible<Root<Node>> {
+ fn ReplaceChild(&self, node: &Node, child: &Node) -> Fallible<DomRoot<Node>> {
// 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<Root<Node>> {
+ -> Fallible<DomRoot<Node>> {
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<Node> {
+ fn CloneNode(&self, deep: bool) -> DomRoot<Node> {
Node::clone(self, None, if deep {
CloneChildrenFlag::CloneChildren
} else {
@@ -2499,13 +2499,13 @@ impl NodeMethods for Node {
}
}
-pub fn document_from_node<T: DerivedFrom<Node> + DomObject>(derived: &T) -> Root<Document> {
+pub fn document_from_node<T: DerivedFrom<Node> + DomObject>(derived: &T) -> DomRoot<Document> {
derived.upcast().owner_doc()
}
-pub fn window_from_node<T: DerivedFrom<Node> + DomObject>(derived: &T) -> Root<Window> {
+pub fn window_from_node<T: DerivedFrom<Node> + DomObject>(derived: &T) -> DomRoot<Window> {
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<Root<Node>> {
+ pub fn modified_edge_element(&self) -> Option<DomRoot<Node>> {
match *self {
// Add/remove at start of container: Return the first following element.
ChildrenMutation::Prepend { next, .. } |
@@ -2807,7 +2807,7 @@ impl<T> VecPreOrderInsertionHelper<T> for Vec<Dom<T>>
let elem_node = elem.upcast::<Node>();
let mut head: usize = 0;
for node in tree_root.traverse_preorder() {
- let head_node = Root::upcast::<Node>(Root::from_ref(&*self[head]));
+ let head_node = DomRoot::upcast::<Node>(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 ec18066a978..3ee09742e67 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<NodeIterator> {
+ filter: Filter) -> DomRoot<NodeIterator> {
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<Rc<NodeFilter>>) -> Root<NodeIterator> {
+ node_filter: Option<Rc<NodeFilter>>) -> DomRoot<NodeIterator> {
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<Node> {
- Root::from_ref(&*self.root_node)
+ fn Root(&self) -> DomRoot<Node> {
+ 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<Node> {
+ fn ReferenceNode(&self) -> DomRoot<Node> {
self.reference_node.get()
}
@@ -94,7 +94,7 @@ impl NodeIteratorMethods for NodeIterator {
}
// https://dom.spec.whatwg.org/#dom-nodeiterator-nextnode
- fn NextNode(&self) -> Fallible<Option<Root<Node>>> {
+ fn NextNode(&self) -> Fallible<Option<DomRoot<Node>>> {
// 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<Option<Root<Node>>> {
+ fn PreviousNode(&self) -> Fallible<Option<DomRoot<Node>>> {
// 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 191cc1f30cd..d6c0a394c93 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<NodeList> {
+ pub fn new(window: &Window, list_type: NodeListType) -> DomRoot<NodeList> {
reflect_dom_object(box NodeList::new_inherited(list_type),
window,
NodeListBinding::Wrap)
}
- pub fn new_simple_list<T>(window: &Window, iter: T) -> Root<NodeList>
- where T: Iterator<Item=Root<Node>> {
+ pub fn new_simple_list<T>(window: &Window, iter: T) -> DomRoot<NodeList>
+ where T: Iterator<Item=DomRoot<Node>> {
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> {
+ pub fn new_simple_list_slice(window: &Window, slice: &[&Node]) -> DomRoot<NodeList> {
NodeList::new(window, NodeListType::Simple(slice.iter().map(|r| Dom::from_ref(*r)).collect()))
}
- pub fn new_child_list(window: &Window, node: &Node) -> Root<NodeList> {
+ pub fn new_child_list(window: &Window, node: &Node) -> DomRoot<NodeList> {
NodeList::new(window, NodeListType::Children(ChildrenList::new(node)))
}
- pub fn empty(window: &Window) -> Root<NodeList> {
+ pub fn empty(window: &Window) -> DomRoot<NodeList> {
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<Root<Node>> {
+ fn Item(&self, index: u32) -> Option<DomRoot<Node>> {
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<Root<Node>> {
+ fn IndexedGetter(&self, index: u32) -> Option<DomRoot<Node>> {
self.Item(index)
}
}
@@ -103,7 +103,7 @@ impl NodeList {
}
}
- pub fn iter<'a>(&'a self) -> impl Iterator<Item=Root<Node>> + 'a {
+ pub fn iter<'a>(&'a self) -> impl Iterator<Item=DomRoot<Node>> + '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<Root<Node>> {
+ pub fn item(&self, index: u32) -> Option<DomRoot<Node>> {
// 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 4ee04dde09d..936c262eb52 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<PageTransitionEvent> {
+ pub fn new_uninitialized(window: &Window) -> DomRoot<PageTransitionEvent> {
reflect_dom_object(box PageTransitionEvent::new_inherited(),
window,
PageTransitionEventBinding::Wrap)
@@ -42,7 +42,7 @@ impl PageTransitionEvent {
bubbles: bool,
cancelable: bool,
persisted: bool)
- -> Root<PageTransitionEvent> {
+ -> DomRoot<PageTransitionEvent> {
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<Root<PageTransitionEvent>> {
+ -> Fallible<DomRoot<PageTransitionEvent>> {
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 261e9b95322..b5c47b2c08f 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<PaintRenderingContext2D> {
+ pub fn new(global: &PaintWorkletGlobalScope) -> DomRoot<PaintRenderingContext2D> {
reflect_dom_object(box PaintRenderingContext2D::new_inherited(global),
global,
PaintRenderingContext2DBinding::Wrap)
@@ -304,7 +304,7 @@ impl PaintRenderingContext2DMethods for PaintRenderingContext2D {
y0: Finite<f64>,
x1: Finite<f64>,
y1: Finite<f64>)
- -> Root<CanvasGradient> {
+ -> DomRoot<CanvasGradient> {
self.context.CreateLinearGradient(x0, y0, x1, y1)
}
@@ -316,7 +316,7 @@ impl PaintRenderingContext2DMethods for PaintRenderingContext2D {
x1: Finite<f64>,
y1: Finite<f64>,
r1: Finite<f64>)
- -> Fallible<Root<CanvasGradient>> {
+ -> Fallible<DomRoot<CanvasGradient>> {
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<Root<CanvasPattern>> {
+ -> Fallible<DomRoot<CanvasPattern>> {
self.context.CreatePattern(image, repetition)
}
diff --git a/components/script/dom/paintsize.rs b/components/script/dom/paintsize.rs
index 5943b97d6f0..72ebc988468 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<f32, CSSPixel>) -> Root<PaintSize> {
+ pub fn new(global: &PaintWorkletGlobalScope, size: TypedSize2D<f32, CSSPixel>) -> DomRoot<PaintSize> {
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 24bd7e7d940..322b6e5a5d8 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<PaintWorkletGlobalScope> {
+ -> DomRoot<PaintWorkletGlobalScope> {
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 5df6f1bc9a8..0aabbb6fc35 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<DOMString>, entry_type: Option<DOMString>)
- -> Vec<Root<PerformanceEntry>> {
+ -> Vec<DomRoot<PerformanceEntry>> {
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::<Vec<Root<PerformanceEntry>>>();
+ ).map(|e| e.clone()).collect::<Vec<DomRoot<PerformanceEntry>>>();
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<PerformanceEntry>;
- type IntoIter = ::std::vec::IntoIter<Root<PerformanceEntry>>;
+ type Item = DomRoot<PerformanceEntry>;
+ type IntoIter = ::std::vec::IntoIter<DomRoot<PerformanceEntry>>;
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<DOMPerformanceObserver>,
+ observer: DomRoot<DOMPerformanceObserver>,
entry_types: Vec<DOMString>,
}
@@ -139,7 +139,7 @@ impl Performance {
pub fn new(global: &GlobalScope,
navigation_start: u64,
- navigation_start_precise: f64) -> Root<Performance> {
+ navigation_start_precise: f64) -> DomRoot<Performance> {
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<Root<DOMPerformanceObserver>> =
+ let observers: Vec<DomRoot<DOMPerformanceObserver>> =
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<PerformanceTiming> {
+ fn Timing(&self) -> DomRoot<PerformanceTiming> {
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<Root<PerformanceEntry>> {
+ fn GetEntries(&self) -> Vec<DomRoot<PerformanceEntry>> {
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<Root<PerformanceEntry>> {
+ fn GetEntriesByType(&self, entry_type: DOMString) -> Vec<DomRoot<PerformanceEntry>> {
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<DOMString>)
- -> Vec<Root<PerformanceEntry>> {
+ -> Vec<DomRoot<PerformanceEntry>> {
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 12d3934ccea..01b8eb6ee95 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<PerformanceEntry> {
+ duration: f64) -> DomRoot<PerformanceEntry> {
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 86b45f67a40..4393eff6d0f 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<PerformanceObserverCallback>,
entries: DOMPerformanceEntryList)
- -> Root<PerformanceObserver> {
+ -> DomRoot<PerformanceObserver> {
let observer = PerformanceObserver::new_inherited(callback, DomRefCell::new(entries));
reflect_dom_object(box observer, global, PerformanceObserverBinding::Wrap)
}
pub fn Constructor(global: &GlobalScope, callback: Rc<PerformanceObserverCallback>)
- -> Fallible<Root<PerformanceObserver>> {
+ -> Fallible<DomRoot<PerformanceObserver>> {
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 558ad749e5d..70f329952d8 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<PerformanceObserverEntryList> {
+ -> DomRoot<PerformanceObserverEntryList> {
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<Root<PerformanceEntry>> {
+ fn GetEntries(&self) -> Vec<DomRoot<PerformanceEntry>> {
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<Root<PerformanceEntry>> {
+ fn GetEntriesByType(&self, entry_type: DOMString) -> Vec<DomRoot<PerformanceEntry>> {
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<DOMString>)
- -> Vec<Root<PerformanceEntry>> {
+ -> Vec<DomRoot<PerformanceEntry>> {
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 505444c33db..b798d93a140 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<PerformancePaintTiming> {
+ start_time: f64) -> DomRoot<PerformancePaintTiming> {
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 c4dff76e218..d0833d76f64 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<PerformanceTiming> {
+ -> DomRoot<PerformanceTiming> {
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 1ff8fc301b7..74fc675008e 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<Permissions> {
+ pub fn new(global: &GlobalScope) -> DomRoot<Permissions> {
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 505f4ad346b..13efaf65a0a 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<PermissionStatus> {
+ pub fn new(global: &GlobalScope, query: &PermissionDescriptor) -> DomRoot<PermissionStatus> {
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 d16aba43e90..ebdd5478280 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<Root<MimeType>> {
+ fn Item(&self, _index: u32) -> Option<DomRoot<MimeType>> {
unreachable!()
}
// https://html.spec.whatwg.org/multipage/#dom-plugin-nameditem
- fn NamedItem(&self, _name: DOMString) -> Option<Root<MimeType>> {
+ fn NamedItem(&self, _name: DOMString) -> Option<DomRoot<MimeType>> {
unreachable!()
}
// https://html.spec.whatwg.org/multipage/#dom-plugin-item
- fn IndexedGetter(&self, _index: u32) -> Option<Root<MimeType>> {
+ fn IndexedGetter(&self, _index: u32) -> Option<DomRoot<MimeType>> {
unreachable!()
}
// check-tidy: no specs after this line
- fn NamedGetter(&self, _name: DOMString) -> Option<Root<MimeType>> {
+ fn NamedGetter(&self, _name: DOMString) -> Option<DomRoot<MimeType>> {
unreachable!()
}
diff --git a/components/script/dom/pluginarray.rs b/components/script/dom/pluginarray.rs
index 2ddd0449b6c..c77b763eb85 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<PluginArray> {
+ pub fn new(global: &GlobalScope) -> DomRoot<PluginArray> {
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<Root<Plugin>> {
+ fn Item(&self, _index: u32) -> Option<DomRoot<Plugin>> {
None
}
// https://html.spec.whatwg.org/multipage/#dom-pluginarray-nameditem
- fn NamedItem(&self, _name: DOMString) -> Option<Root<Plugin>> {
+ fn NamedItem(&self, _name: DOMString) -> Option<DomRoot<Plugin>> {
None
}
// https://html.spec.whatwg.org/multipage/#dom-pluginarray-item
- fn IndexedGetter(&self, _index: u32) -> Option<Root<Plugin>> {
+ fn IndexedGetter(&self, _index: u32) -> Option<DomRoot<Plugin>> {
None
}
// check-tidy: no specs after this line
- fn NamedGetter(&self, _name: DOMString) -> Option<Root<Plugin>> {
+ fn NamedGetter(&self, _name: DOMString) -> Option<DomRoot<Plugin>> {
None
}
diff --git a/components/script/dom/popstateevent.rs b/components/script/dom/popstateevent.rs
index e07c1faa71f..0a962dfe5be 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<PopStateEvent> {
+ pub fn new_uninitialized(window: &Window) -> DomRoot<PopStateEvent> {
reflect_dom_object(box PopStateEvent::new_inherited(),
window,
PopStateEventBinding::Wrap)
@@ -45,7 +45,7 @@ impl PopStateEvent {
bubbles: bool,
cancelable: bool,
state: HandleValue)
- -> Root<PopStateEvent> {
+ -> DomRoot<PopStateEvent> {
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<PopStateEventBinding::PopStateEventInit>)
- -> Fallible<Root<PopStateEvent>> {
+ -> Fallible<DomRoot<PopStateEvent>> {
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 c70e191976e..1cdb5eb1c4c 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<ProcessingInstruction> {
+ pub fn new(target: DOMString, data: DOMString, document: &Document) -> DomRoot<ProcessingInstruction> {
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 72898430f6b..1ad4acacc47 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<ProgressEvent> {
+ pub fn new_uninitialized(global: &GlobalScope) -> DomRoot<ProgressEvent> {
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<ProgressEvent> {
+ length_computable: bool, loaded: u64, total: u64) -> DomRoot<ProgressEvent> {
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<Root<ProgressEvent>> {
+ -> Fallible<DomRoot<ProgressEvent>> {
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 756b9b84022..56c65c9a801 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<Box<Callback>>,
reject: Option<Box<Callback>>)
- -> Root<PromiseNativeHandler> {
+ -> DomRoot<PromiseNativeHandler> {
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 cd892108ee3..d9c3a010c34 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<RadioNodeList> {
+ pub fn new(window: &Window, list_type: NodeListType) -> DomRoot<RadioNodeList> {
reflect_dom_object(box RadioNodeList::new_inherited(list_type),
window,
RadioNodeListBinding::Wrap)
}
- pub fn new_simple_list<T>(window: &Window, iter: T) -> Root<RadioNodeList>
- where T: Iterator<Item=Root<Node>> {
+ pub fn new_simple_list<T>(window: &Window, iter: T) -> DomRoot<RadioNodeList>
+ where T: Iterator<Item=DomRoot<Node>> {
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<Root<Node>> {
+ fn IndexedGetter(&self, index: u32) -> Option<DomRoot<Node>> {
self.node_list.IndexedGetter(index)
}
}
diff --git a/components/script/dom/range.rs b/components/script/dom/range.rs
index 79091beff55..b6a05b31881 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<Range> {
+ pub fn new_with_doc(document: &Document) -> DomRoot<Range> {
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<Range> {
+ -> DomRoot<Range> {
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<Root<Range>> {
+ pub fn Constructor(window: &Window) -> Fallible<DomRoot<Range>> {
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<Root<Node>>,
- Option<Root<Node>>,
- Vec<Root<Node>>)> {
+ fn contained_children(&self) -> Fallible<(Option<DomRoot<Node>>,
+ Option<DomRoot<Node>>,
+ Vec<DomRoot<Node>>)> {
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<Root<Node>> =
+ let contained_children: Vec<DomRoot<Node>> =
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<Node> {
+ fn StartContainer(&self) -> DomRoot<Node> {
self.start.node.get()
}
@@ -201,7 +201,7 @@ impl RangeMethods for Range {
}
// https://dom.spec.whatwg.org/#dom-range-endcontainer
- fn EndContainer(&self) -> Root<Node> {
+ fn EndContainer(&self) -> DomRoot<Node> {
self.end.node.get()
}
@@ -216,7 +216,7 @@ impl RangeMethods for Range {
}
// https://dom.spec.whatwg.org/#dom-range-commonancestorcontainer
- fn CommonAncestorContainer(&self) -> Root<Node> {
+ fn CommonAncestorContainer(&self) -> DomRoot<Node> {
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<Range> {
+ fn CloneRange(&self) -> DomRoot<Range> {
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<Root<DocumentFragment>> {
+ fn CloneContents(&self) -> Fallible<DomRoot<DocumentFragment>> {
// 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<Root<DocumentFragment>> {
+ fn ExtractContents(&self) -> Fallible<DomRoot<DocumentFragment>> {
// 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::<Text>() {
Some(text) => {
split_text = text.SplitText(start_offset)?;
- let new_reference = Root::upcast::<Node>(split_text);
+ let new_reference = DomRoot::upcast::<Node>(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<Node>, u32) {
- let mut reference_node = Root::from_ref(start_node);
+ fn compute_reference(start_node: &Node, end_node: &Node) -> (DomRoot<Node>, 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::<Text>);
+ .filter_map(DomRoot::downcast::<Text>);
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<Root<DocumentFragment>> {
+ fn CreateContextualFragment(&self, fragment: DOMString) -> Fallible<DomRoot<DocumentFragment>> {
// 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::<Element>(node).unwrap()),
+ NodeTypeId::Element(_) => Some(DomRoot::downcast::<Element>(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 6f7f5518c57..68cb961c085 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<Request> {
+ url: ServoUrl) -> DomRoot<Request> {
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<RequestInit>)
- -> Fallible<Root<Request>> {
+ -> Fallible<DomRoot<Request>> {
// 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<T>`, and therefore it is difficult
+ // `r.Headers()` is a `DomRoot<T>`, 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<Request> {
+ net_request: NetTraitsRequest) -> DomRoot<Request> {
let r = Request::new(global,
net_request.current_url());
*r.request.borrow_mut() = net_request;
r
}
- fn clone_from(r: &Request) -> Fallible<Root<Request>> {
+ fn clone_from(r: &Request) -> Fallible<DomRoot<Request>> {
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<Headers> {
+ fn Headers(&self) -> DomRoot<Headers> {
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<Root<Request>> {
+ fn Clone(&self) -> Fallible<DomRoot<Request>> {
// 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 269803feaa2..a874aac77e6 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<Response> {
+ pub fn new(global: &GlobalScope) -> DomRoot<Response> {
reflect_dom_object(box Response::new_inherited(), global, ResponseBinding::Wrap)
}
pub fn Constructor(global: &GlobalScope, body: Option<BodyInit>, init: &ResponseBinding::ResponseInit)
- -> Fallible<Root<Response>> {
+ -> Fallible<DomRoot<Response>> {
// 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<Response> {
+ pub fn Error(global: &GlobalScope) -> DomRoot<Response> {
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<Root<Response>> {
+ pub fn Redirect(global: &GlobalScope, url: USVString, status: u16) -> Fallible<DomRoot<Response>> {
// 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<Headers> {
+ fn Headers(&self) -> DomRoot<Headers> {
self.headers_reflector.or_init(|| Headers::for_response(&self.global()))
}
// https://fetch.spec.whatwg.org/#dom-response-clone
- fn Clone(&self) -> Fallible<Root<Response>> {
+ fn Clone(&self) -> Fallible<DomRoot<Response>> {
// 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 e1ff7589dbd..88a9025f76f 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<Screen> {
+ pub fn new(window: &Window) -> DomRoot<Screen> {
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 4078daabf4f..95c37d27c8e 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<ServiceWorker> {
+ skip_waiting: bool) -> DomRoot<ServiceWorker> {
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 e4cb7c3a255..9c853be2403 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<ServiceWorkerContainer> {
+ pub fn new(global: &GlobalScope) -> DomRoot<ServiceWorkerContainer> {
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<Root<ServiceWorker>> {
+ fn GetController(&self) -> Option<DomRoot<ServiceWorker>> {
self.client.get_controller()
}
diff --git a/components/script/dom/serviceworkerglobalscope.rs b/components/script/dom/serviceworkerglobalscope.rs
index b7b44328bc7..5e4ad439c90 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<ServiceWorkerMsg>,
scope_url: ServoUrl)
- -> Root<ServiceWorkerGlobalScope> {
+ -> DomRoot<ServiceWorkerGlobalScope> {
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::<WorkerGlobalScope>(GlobalScope::from_context(cx))
+ DomRoot::downcast::<WorkerGlobalScope>(GlobalScope::from_context(cx))
.expect("global is not a worker scope");
assert!(worker.is::<ServiceWorkerGlobalScope>());
diff --git a/components/script/dom/serviceworkerregistration.rs b/components/script/dom/serviceworkerregistration.rs
index 7a824509b62..aab04390943 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<ServiceWorkerRegistration> {
+ scope: ServoUrl) -> DomRoot<ServiceWorkerRegistration> {
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<Root<ServiceWorker>> {
+ pub fn get_newest_worker(&self) -> Option<DomRoot<ServiceWorker>> {
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<Root<ServiceWorker>> {
- self.installing.as_ref().map(|sw| Root::from_ref(&**sw))
+ fn GetInstalling(&self) -> Option<DomRoot<ServiceWorker>> {
+ self.installing.as_ref().map(|sw| DomRoot::from_ref(&**sw))
}
// https://w3c.github.io/ServiceWorker/#service-worker-registration-active-attribute
- fn GetActive(&self) -> Option<Root<ServiceWorker>> {
- self.active.as_ref().map(|sw| Root::from_ref(&**sw))
+ fn GetActive(&self) -> Option<DomRoot<ServiceWorker>> {
+ self.active.as_ref().map(|sw| DomRoot::from_ref(&**sw))
}
// https://w3c.github.io/ServiceWorker/#service-worker-registration-waiting-attribute
- fn GetWaiting(&self) -> Option<Root<ServiceWorker>> {
- self.waiting.as_ref().map(|sw| Root::from_ref(&**sw))
+ fn GetWaiting(&self) -> Option<DomRoot<ServiceWorker>> {
+ 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 19c163616cf..05df90c5c84 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<HTMLScriptElement>> {
+ pub fn feed(&mut self, input: &mut BufferQueue) -> Result<(), DomRoot<HTMLScriptElement>> {
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::<Document>().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::<HTMLTemplateElement>().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::<HTMLFormElement>(Root::from_ref(&**form))
+ let form = DomRoot::downcast::<HTMLFormElement>(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 54635c15bb0..86c2b551940 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<HTMLScriptElement>> {
+ pub fn feed(&mut self, input: &mut BufferQueue) -> Result<(), DomRoot<HTMLScriptElement>> {
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<S: Serializer>(node: &Element, serializer: &mut S) -> io::Result<
enum SerializationCommand {
- OpenElement(Root<Element>),
- CloseElement(Root<Element>),
- SerializeNonelement(Root<Node>),
+ OpenElement(DomRoot<Element>),
+ CloseElement(DomRoot<Element>),
+ SerializeNonelement(DomRoot<Node>),
}
struct SerializationIterator {
stack: Vec<SerializationCommand>,
}
-fn rev_children_iter(n: &Node) -> impl Iterator<Item=Root<Node>>{
+fn rev_children_iter(n: &Node) -> impl Iterator<Item=DomRoot<Node>>{
match n.downcast::<HTMLTemplateElement>() {
Some(t) => t.Content().upcast::<Node>().rev_children(),
None => n.rev_children(),
@@ -173,8 +173,8 @@ impl SerializationIterator {
fn push_node(&mut self, n: &Node) {
match n.downcast::<Element>() {
- 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 3bc3a98baba..b458bc047be 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<Item=Root<Node>> {
+ pub fn parse_html_fragment(context: &Element, input: DOMString) -> impl Iterator<Item=DomRoot<Node>> {
let context_node = context.upcast::<Node>();
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<Self> {
+ -> DomRoot<Self> {
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<F>(&self, mut feed: F)
- where F: FnMut(&mut Tokenizer) -> Result<(), Root<HTMLScriptElement>>,
+ where F: FnMut(&mut Tokenizer) -> Result<(), DomRoot<HTMLScriptElement>>,
{
loop {
assert!(!self.suspended.get());
@@ -469,17 +469,17 @@ impl ServoParser {
}
struct FragmentParsingResult<I>
- where I: Iterator<Item=Root<Node>>
+ where I: Iterator<Item=DomRoot<Node>>
{
inner: I,
}
impl<I> Iterator for FragmentParsingResult<I>
- where I: Iterator<Item=Root<Node>>
+ where I: Iterator<Item=DomRoot<Node>>
{
- type Item = Root<Node>;
+ type Item = DomRoot<Node>;
- fn next(&mut self) -> Option<Root<Node>> {
+ fn next(&mut self) -> Option<DomRoot<Node>> {
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<HTMLScriptElement>> {
+ fn feed(&mut self, input: &mut BufferQueue) -> Result<(), DomRoot<HTMLScriptElement>> {
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::<Node>(doc.GetBody().unwrap());
+ let doc_body = DomRoot::upcast::<Node>(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::<Node>(img)).expect("Appending failed");
+ doc_body.AppendChild(&DomRoot::upcast::<Node>(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<Dom<N
let text = reference_child
.and_then(Node::GetPreviousSibling)
.or_else(|| parent.GetLastChild())
- .and_then(Root::downcast::<Text>);
+ .and_then(DomRoot::downcast::<Text>);
if let Some(text) = text {
text.upcast::<CharacterData>().append_data(&t);
@@ -834,7 +834,7 @@ impl TreeSink for Sink {
}
let node = target;
- let form = Root::downcast::<HTMLFormElement>(Root::from_ref(&**form))
+ let form = DomRoot::downcast::<HTMLFormElement>(DomRoot::from_ref(&**form))
.expect("Owner must be a form element");
let elem = node.downcast::<Element>();
@@ -945,7 +945,7 @@ impl TreeSink for Sink {
}
fn pop(&mut self, node: &Dom<Node>) {
- 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 12c9131daa5..fe74d627349 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<HTMLScriptElement>> {
+ pub fn feed(&mut self, input: &mut BufferQueue) -> Result<(), DomRoot<HTMLScriptElement>> {
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 ba4ac955e6d..56d5e832870 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<Storage> {
+ pub fn new(global: &Window, storage_type: StorageType) -> DomRoot<Storage> {
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 f5f8bc5577f..382cdc612b4 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<StorageEvent> {
+ url: DOMString) -> DomRoot<StorageEvent> {
reflect_dom_object(box StorageEvent::new_inherited(None, None, None, url, None),
window,
StorageEventBinding::Wrap)
@@ -58,7 +58,7 @@ impl StorageEvent {
oldValue: Option<DOMString>,
newValue: Option<DOMString>,
url: DOMString,
- storageArea: Option<&Storage>) -> Root<StorageEvent> {
+ storageArea: Option<&Storage>) -> DomRoot<StorageEvent> {
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<Root<StorageEvent>> {
+ init: &StorageEventBinding::StorageEventInit) -> Fallible<DomRoot<StorageEvent>> {
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<Root<Storage>> {
+ fn GetStorageArea(&self) -> Option<DomRoot<Storage>> {
self.storage_area.get()
}
diff --git a/components/script/dom/stylepropertymapreadonly.rs b/components/script/dom/stylepropertymapreadonly.rs
index 624664df75f..4002a68c0d4 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<Entries>(global: &GlobalScope, entries: Entries) -> Root<StylePropertyMapReadOnly> where
+ pub fn from_iter<Entries>(global: &GlobalScope, entries: Entries) -> DomRoot<StylePropertyMapReadOnly> where
Entries: IntoIterator<Item=(Atom, String)>,
{
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<Root<CSSStyleValue>> {
+ fn Get(&self, property: DOMString) -> Option<DomRoot<CSSStyleValue>> {
// 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 731431ca94f..6315fe19ccd 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<DOMString>,
- title: Option<DOMString>) -> Root<StyleSheet> {
+ title: Option<DOMString>) -> DomRoot<StyleSheet> {
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 7a479fe4c17..15c524e83a3 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<Document>) -> Root<StyleSheetList> {
+ pub fn new(window: &Window, document: Dom<Document>) -> DomRoot<StyleSheetList> {
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<Root<StyleSheet>> {
+ fn Item(&self, index: u32) -> Option<DomRoot<StyleSheet>> {
// 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<Root<StyleSheet>> {
+ fn IndexedGetter(&self, index: u32) -> Option<DomRoot<StyleSheet>> {
self.Item(index)
}
}
diff --git a/components/script/dom/svgsvgelement.rs b/components/script/dom/svgsvgelement.rs
index e223d7f0b79..b7ee599b102 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<Prefix>,
- document: &Document) -> Root<SVGSVGElement> {
+ document: &Document) -> DomRoot<SVGSVGElement> {
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 23309f28dd5..3f76dab2247 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<TestBinding> {
+ pub fn new(global: &GlobalScope) -> DomRoot<TestBinding> {
reflect_dom_object(box TestBinding::new_inherited(),
global, TestBindingBinding::Wrap)
}
- pub fn Constructor(global: &GlobalScope) -> Fallible<Root<TestBinding>> {
+ pub fn Constructor(global: &GlobalScope) -> Fallible<DomRoot<TestBinding>> {
Ok(TestBinding::new(global))
}
#[allow(unused_variables)]
- pub fn Constructor_(global: &GlobalScope, nums: Vec<f64>) -> Fallible<Root<TestBinding>> {
+ pub fn Constructor_(global: &GlobalScope, nums: Vec<f64>) -> Fallible<DomRoot<TestBinding>> {
Ok(TestBinding::new(global))
}
#[allow(unused_variables)]
- pub fn Constructor__(global: &GlobalScope, num: f64) -> Fallible<Root<TestBinding>> {
+ pub fn Constructor__(global: &GlobalScope, num: f64) -> Fallible<DomRoot<TestBinding>> {
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<Blob> {
+ fn InterfaceAttribute(&self) -> DomRoot<Blob> {
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<USVString> { Some(USVString("".to_owned())) }
fn SetUsvstringAttributeNullable(&self, _: Option<USVString>) {}
fn SetBinaryRenamedAttribute(&self, _: DOMString) {}
- fn ForwardedAttribute(&self) -> Root<TestBinding> { Root::from_ref(self) }
+ fn ForwardedAttribute(&self) -> DomRoot<TestBinding> { 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<TestEnum> { Some(TestEnum::_empty) }
- fn GetInterfaceAttributeNullable(&self) -> Option<Root<Blob>> {
+ fn GetInterfaceAttributeNullable(&self) -> Option<DomRoot<Blob>> {
Some(Blob::new(&self.global(), BlobImpl::new_from_bytes(vec![]), "".to_owned()))
}
fn SetInterfaceAttributeNullable(&self, _: Option<&Blob>) {}
- fn GetInterfaceAttributeWeak(&self) -> Option<Root<URL>> {
+ fn GetInterfaceAttributeWeak(&self) -> Option<DomRoot<URL>> {
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<Blob> {
+ fn ReceiveInterface(&self) -> DomRoot<Blob> {
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<i32> { vec![1] }
- fn ReceiveInterfaceSequence(&self) -> Vec<Root<Blob>> {
+ fn ReceiveInterfaceSequence(&self) -> Vec<DomRoot<Blob>> {
vec![Blob::new(&self.global(), BlobImpl::new_from_bytes(vec![]), "".to_owned())]
}
@@ -312,7 +312,7 @@ impl TestBindingMethods for TestBinding {
fn ReceiveNullableUsvstring(&self) -> Option<USVString> { Some(USVString("".to_owned())) }
fn ReceiveNullableByteString(&self) -> Option<ByteString> { Some(ByteString::new(vec!())) }
fn ReceiveNullableEnum(&self) -> Option<TestEnum> { Some(TestEnum::_empty) }
- fn ReceiveNullableInterface(&self) -> Option<Root<Blob>> {
+ fn ReceiveNullableInterface(&self) -> Option<DomRoot<Blob>> {
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<EventListener>) {}
fn PassSequence(&self, _: Vec<i32>) {}
fn PassStringSequence(&self, _: Vec<DOMString>) {}
- fn PassInterfaceSequence(&self, _: Vec<Root<Blob>>) {}
+ fn PassInterfaceSequence(&self, _: Vec<DomRoot<Blob>>) {}
fn PassNullableBoolean(&self, _: Option<bool>) {}
fn PassNullableByte(&self, _: Option<i8>) {}
@@ -651,14 +651,14 @@ impl TestBindingMethods for TestBinding {
fn PassMozMapOfNullableInts(&self, _: MozMap<Option<i32>>) {}
fn PassOptionalMozMapOfNullableInts(&self, _: Option<MozMap<Option<i32>>>) {}
fn PassOptionalNullableMozMapOfNullableInts(&self, _: Option<Option<MozMap<Option<i32>> >>) {}
- fn PassCastableObjectMozMap(&self, _: MozMap<Root<TestBinding>>) {}
- fn PassNullableCastableObjectMozMap(&self, _: MozMap<Option<Root<TestBinding>>>) {}
- fn PassCastableObjectNullableMozMap(&self, _: Option<MozMap<Root<TestBinding>>>) {}
- fn PassNullableCastableObjectNullableMozMap(&self, _: Option<MozMap<Option<Root<TestBinding>>>>) {}
+ fn PassCastableObjectMozMap(&self, _: MozMap<DomRoot<TestBinding>>) {}
+ fn PassNullableCastableObjectMozMap(&self, _: MozMap<Option<DomRoot<TestBinding>>>) {}
+ fn PassCastableObjectNullableMozMap(&self, _: Option<MozMap<DomRoot<TestBinding>>>) {}
+ fn PassNullableCastableObjectNullableMozMap(&self, _: Option<MozMap<Option<DomRoot<TestBinding>>>>) {}
fn PassOptionalMozMap(&self, _: Option<MozMap<i32>>) {}
fn PassOptionalNullableMozMap(&self, _: Option<Option<MozMap<i32>>>) {}
fn PassOptionalNullableMozMapWithDefaultValue(&self, _: Option<MozMap<i32>>) {}
- fn PassOptionalObjectMozMap(&self, _: Option<MozMap<Root<TestBinding>>>) {}
+ fn PassOptionalObjectMozMap(&self, _: Option<MozMap<DomRoot<TestBinding>>>) {}
fn PassStringMozMap(&self, _: MozMap<DOMString>) {}
fn PassByteStringMozMap(&self, _: MozMap<ByteString>) {}
fn PassMozMapOfMozMaps(&self, _: MozMap<MozMap<i32>>) {}
@@ -776,10 +776,10 @@ impl TestBindingMethods for TestBinding {
fn Panic(&self) { panic!("explicit panic from script") }
- fn EntryGlobal(&self) -> Root<GlobalScope> {
+ fn EntryGlobal(&self) -> DomRoot<GlobalScope> {
GlobalScope::entry()
}
- fn IncumbentGlobal(&self) -> Root<GlobalScope> {
+ fn IncumbentGlobal(&self) -> DomRoot<GlobalScope> {
GlobalScope::incumbent().unwrap()
}
}
diff --git a/components/script/dom/testbindingiterable.rs b/components/script/dom/testbindingiterable.rs
index a412c5e288d..9f9354b8815 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<TestBindingIterable> {
+ fn new(global: &GlobalScope) -> DomRoot<TestBindingIterable> {
reflect_dom_object(box TestBindingIterable {
reflector: Reflector::new(),
vals: DomRefCell::new(vec![]),
}, global, TestBindingIterableBinding::Wrap)
}
- pub fn Constructor(global: &GlobalScope) -> Fallible<Root<TestBindingIterable>> {
+ pub fn Constructor(global: &GlobalScope) -> Fallible<DomRoot<TestBindingIterable>> {
Ok(TestBindingIterable::new(global))
}
}
diff --git a/components/script/dom/testbindingpairiterable.rs b/components/script/dom/testbindingpairiterable.rs
index 106fb5e850b..5fae49893aa 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<TestBindingPairIterable> {
+ fn new(global: &GlobalScope) -> DomRoot<TestBindingPairIterable> {
reflect_dom_object(box TestBindingPairIterable {
reflector: Reflector::new(),
map: DomRefCell::new(vec![]),
}, global, TestBindingPairIterableBinding::TestBindingPairIterableWrap)
}
- pub fn Constructor(global: &GlobalScope) -> Fallible<Root<TestBindingPairIterable>> {
+ pub fn Constructor(global: &GlobalScope) -> Fallible<DomRoot<TestBindingPairIterable>> {
Ok(TestBindingPairIterable::new(global))
}
}
diff --git a/components/script/dom/testrunner.rs b/components/script/dom/testrunner.rs
index 1036f7ea065..972bc729723 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<TestRunner> {
+ pub fn new(global: &GlobalScope) -> DomRoot<TestRunner> {
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 31d1e3853c1..04ed5ffc3c4 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<TestWorklet> {
+ fn new(window: &Window) -> DomRoot<TestWorklet> {
let worklet = Worklet::new(window, WorkletGlobalScopeType::Test);
reflect_dom_object(box TestWorklet::new_inherited(&*worklet), window, Wrap)
}
- pub fn Constructor(window: &Window) -> Fallible<Root<TestWorklet>> {
+ pub fn Constructor(window: &Window) -> Fallible<DomRoot<TestWorklet>> {
Ok(TestWorklet::new(window))
}
}
diff --git a/components/script/dom/testworkletglobalscope.rs b/components/script/dom/testworkletglobalscope.rs
index ed29e8a4f30..54b2c299df7 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<TestWorkletGlobalScope>
+ -> DomRoot<TestWorkletGlobalScope>
{
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 800b9288c14..2e37edc1a8d 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<Text> {
+ pub fn new(text: DOMString, document: &Document) -> DomRoot<Text> {
Node::reflect_node(box Text::new_inherited(text, document),
document, TextBinding::Wrap)
}
- pub fn Constructor(window: &Window, text: DOMString) -> Fallible<Root<Text>> {
+ pub fn Constructor(window: &Window, text: DOMString) -> Fallible<DomRoot<Text>> {
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<Root<Text>> {
+ fn SplitText(&self, offset: u32) -> Fallible<DomRoot<Text>> {
let cdata = self.upcast::<CharacterData>();
// Step 1.
let length = cdata.Length();
diff --git a/components/script/dom/textdecoder.rs b/components/script/dom/textdecoder.rs
index 48dc364c489..56e32ed5245 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<Root<TextDecoder>> {
+ fn make_range_error() -> Fallible<DomRoot<TextDecoder>> {
Err(Error::Range("The given encoding is not supported.".to_owned()))
}
- pub fn new(global: &GlobalScope, encoding: EncodingRef, fatal: bool) -> Root<TextDecoder> {
+ pub fn new(global: &GlobalScope, encoding: EncodingRef, fatal: bool) -> DomRoot<TextDecoder> {
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<Root<TextDecoder>> {
+ -> Fallible<DomRoot<TextDecoder>> {
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 cb557861d1c..76502452238 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<TextEncoder> {
+ pub fn new(global: &GlobalScope) -> DomRoot<TextEncoder> {
reflect_dom_object(box TextEncoder::new_inherited(),
global,
TextEncoderBinding::Wrap)
}
// https://encoding.spec.whatwg.org/#dom-textencoder
- pub fn Constructor(global: &GlobalScope) -> Fallible<Root<TextEncoder>> {
+ pub fn Constructor(global: &GlobalScope) -> Fallible<DomRoot<TextEncoder>> {
Ok(TextEncoder::new(global))
}
}
diff --git a/components/script/dom/touch.rs b/components/script/dom/touch.rs
index d526e607d8d..e12fce6379c 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<f64>, screen_y: Finite<f64>,
client_x: Finite<f64>, client_y: Finite<f64>,
- page_x: Finite<f64>, page_y: Finite<f64>) -> Root<Touch> {
+ page_x: Finite<f64>, page_y: Finite<f64>) -> DomRoot<Touch> {
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<EventTarget> {
+ fn Target(&self) -> DomRoot<EventTarget> {
self.target.get()
}
diff --git a/components/script/dom/touchevent.rs b/components/script/dom/touchevent.rs
index 92ff9bf0424..6a33b7f244e 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<TouchEvent> {
+ target_touches: &TouchList) -> DomRoot<TouchEvent> {
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<TouchEvent> {
+ meta_key: bool) -> DomRoot<TouchEvent> {
let ev = TouchEvent::new_uninitialized(window, touches, changed_touches, target_touches);
ev.upcast::<UIEvent>().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<TouchList> {
+ fn Touches(&self) -> DomRoot<TouchList> {
self.touches.get()
}
/// https://w3c.github.io/touch-events/#widl-TouchEvent-targetTouches
- fn TargetTouches(&self) -> Root<TouchList> {
+ fn TargetTouches(&self) -> DomRoot<TouchList> {
self.target_touches.get()
}
/// https://w3c.github.io/touch-events/#widl-TouchEvent-changedTouches
- fn ChangedTouches(&self) -> Root<TouchList> {
+ fn ChangedTouches(&self) -> DomRoot<TouchList> {
self.changed_touches.get()
}
diff --git a/components/script/dom/touchlist.rs b/components/script/dom/touchlist.rs
index c07b583619e..8881bec0faa 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<TouchList> {
+ pub fn new(window: &Window, touches: &[&Touch]) -> DomRoot<TouchList> {
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<Root<Touch>> {
- self.touches.get(index as usize).map(|js| Root::from_ref(&**js))
+ fn Item(&self, index: u32) -> Option<DomRoot<Touch>> {
+ 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<Root<Touch>> {
+ fn IndexedGetter(&self, index: u32) -> Option<DomRoot<Touch>> {
self.Item(index)
}
}
diff --git a/components/script/dom/transitionevent.rs b/components/script/dom/transitionevent.rs
index 30870fba978..7a3caea99ad 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<TransitionEvent> {
+ init: &TransitionEventInit) -> DomRoot<TransitionEvent> {
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<Root<TransitionEvent>> {
+ init: &TransitionEventInit) -> Fallible<DomRoot<TransitionEvent>> {
Ok(TransitionEvent::new(window, Atom::from(type_), init))
}
}
diff --git a/components/script/dom/treewalker.rs b/components/script/dom/treewalker.rs
index 61a085aaa53..b4cead438ff 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<TreeWalker> {
+ filter: Filter) -> DomRoot<TreeWalker> {
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<Rc<NodeFilter>>) -> Root<TreeWalker> {
+ node_filter: Option<Rc<NodeFilter>>) -> DomRoot<TreeWalker> {
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<Node> {
- Root::from_ref(&*self.root_node)
+ fn Root(&self) -> DomRoot<Node> {
+ 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<Node> {
+ fn CurrentNode(&self) -> DomRoot<Node> {
self.current_node.get()
}
@@ -92,7 +92,7 @@ impl TreeWalkerMethods for TreeWalker {
}
// https://dom.spec.whatwg.org/#dom-treewalker-parentnode
- fn ParentNode(&self) -> Fallible<Option<Root<Node>>> {
+ fn ParentNode(&self) -> Fallible<Option<DomRoot<Node>>> {
// "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<Option<Root<Node>>> {
+ fn FirstChild(&self) -> Fallible<Option<DomRoot<Node>>> {
// "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<Option<Root<Node>>> {
+ fn LastChild(&self) -> Fallible<Option<DomRoot<Node>>> {
// "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<Option<Root<Node>>> {
+ fn PreviousSibling(&self) -> Fallible<Option<DomRoot<Node>>> {
// "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<Option<Root<Node>>> {
+ fn NextSibling(&self) -> Fallible<Option<DomRoot<Node>>> {
// "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<Option<Root<Node>>> {
+ fn PreviousNode(&self) -> Fallible<Option<DomRoot<Node>>> {
// "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<Option<Root<Node>>> {
+ fn NextNode(&self) -> Fallible<Option<DomRoot<Node>>> {
// "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<F, G>(&self,
next_child: F,
next_sibling: G)
- -> Fallible<Option<Root<Node>>>
- where F: Fn(&Node) -> Option<Root<Node>>,
- G: Fn(&Node) -> Option<Root<Node>>
+ -> Fallible<Option<DomRoot<Node>>>
+ where F: Fn(&Node) -> Option<DomRoot<Node>>,
+ G: Fn(&Node) -> Option<DomRoot<Node>>
{
// "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<F, G>(&self,
next_child: F,
next_sibling: G)
- -> Fallible<Option<Root<Node>>>
- where F: Fn(&Node) -> Option<Root<Node>>,
- G: Fn(&Node) -> Option<Root<Node>>
+ -> Fallible<Option<DomRoot<Node>>>
+ where F: Fn(&Node) -> Option<DomRoot<Node>>,
+ G: Fn(&Node) -> Option<DomRoot<Node>>
{
// "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<Root<Node>> {
+ -> Option<DomRoot<Node>> {
// "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<Node>;
+ type Item = DomRoot<Node>;
- fn next(&mut self) -> Option<Root<Node>> {
+ fn next(&mut self) -> Option<DomRoot<Node>> {
match self.NextNode() {
Ok(node) => node,
Err(_) =>
diff --git a/components/script/dom/uievent.rs b/components/script/dom/uievent.rs
index d799b979245..6d54a48a0cd 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<UIEvent> {
+ pub fn new_uninitialized(window: &Window) -> DomRoot<UIEvent> {
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<UIEvent> {
+ detail: i32) -> DomRoot<UIEvent> {
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<Root<UIEvent>> {
+ init: &UIEventBinding::UIEventInit) -> Fallible<DomRoot<UIEvent>> {
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<Root<Window>> {
+ fn GetView(&self) -> Option<DomRoot<Window>> {
self.view.get()
}
diff --git a/components/script/dom/url.rs b/components/script/dom/url.rs
index 73832c4e5a4..9134f0cc104 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<URL> {
+ pub fn new(global: &GlobalScope, url: ServoUrl) -> DomRoot<URL> {
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<USVString>)
- -> Fallible<Root<URL>> {
+ -> Fallible<DomRoot<URL>> {
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<URLSearchParams> {
+ fn SearchParams(&self) -> DomRoot<URLSearchParams> {
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 6ac19c05db7..c5eef3d7837 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<URLSearchParams> {
+ pub fn new(global: &GlobalScope, url: Option<&URL>) -> DomRoot<URLSearchParams> {
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<USVStringOrURLSearchParams>) ->
- Fallible<Root<URLSearchParams>> {
+ Fallible<DomRoot<URLSearchParams>> {
// 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 80dead5c66f..d99eba8c109 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<ValidityState> {
+ pub fn new(window: &Window, element: &Element) -> DomRoot<ValidityState> {
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 ea77bde63f8..d4b0429ebac 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<VR> {
+ pub fn new(global: &GlobalScope) -> DomRoot<VR> {
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<Root<VRDisplay>> = self.displays.borrow().iter()
- .map(|d| Root::from_ref(&**d))
+ // convert from Dom to DomRoot
+ let displays: Vec<DomRoot<VRDisplay>> = 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<Root<VRDisplay>> {
+ fn find_display(&self, display_id: u32) -> Option<DomRoot<VRDisplay>> {
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<VRDisplay> {
+ fn sync_display(&self, display: &WebVRDisplayData) -> DomRoot<VRDisplay> {
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<Root<Gamepad>> {
+ fn find_gamepad(&self, gamepad_id: u32) -> Option<DomRoot<Gamepad>> {
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<WebVRGamepadData>, 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<Root<Gamepad>> {
+ pub fn get_gamepads(&self) -> Vec<DomRoot<Gamepad>> {
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 81399b894e9..d8457d46800 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<VRDisplay> {
+ pub fn new(global: &GlobalScope, display: WebVRDisplayData) -> DomRoot<VRDisplay> {
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<VRDisplayCapabilities> {
- Root::from_ref(&*self.capabilities.get())
+ fn Capabilities(&self) -> DomRoot<VRDisplayCapabilities> {
+ DomRoot::from_ref(&*self.capabilities.get())
}
// https://w3c.github.io/webvr/#dom-vrdisplay-stageparameters
- fn GetStageParameters(&self) -> Option<Root<VRStageParameters>> {
- self.stage_params.get().map(|s| Root::from_ref(&*s))
+ fn GetStageParameters(&self) -> Option<DomRoot<VRStageParameters>> {
+ self.stage_params.get().map(|s| DomRoot::from_ref(&*s))
}
// https://w3c.github.io/webvr/#dom-vrdisplay-geteyeparameters
- fn GetEyeParameters(&self, eye: VREye) -> Root<VREyeParameters> {
+ fn GetEyeParameters(&self, eye: VREye) -> DomRoot<VREyeParameters> {
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<VRPose> {
+ fn GetPose(&self) -> DomRoot<VRPose> {
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::<Event>().fire(self.global().upcast::<EventTarget>());
}
@@ -630,7 +630,7 @@ fn parse_bounds(src: &Option<Vec<Finite<f32>>>, dst: &mut [f32; 4]) -> Result<()
fn validate_layer(cx: *mut JSContext,
layer: &VRLayer)
- -> Result<(WebVRLayer, Root<WebGLRenderingContext>), &'static str> {
+ -> Result<(WebVRLayer, DomRoot<WebGLRenderingContext>), &'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 340a2942820..bf16b0cbf4f 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<VRDisplayCapabilities> {
+ pub fn new(capabilities: WebVRDisplayCapabilities, global: &GlobalScope) -> DomRoot<VRDisplayCapabilities> {
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 b7c2a940f6d..26072b499c5 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<VRDisplayEventReason>)
- -> Root<VRDisplayEvent> {
+ -> DomRoot<VRDisplayEvent> {
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<VRDisplayEvent> {
+ -> DomRoot<VRDisplayEvent> {
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<Root<VRDisplayEvent>> {
+ -> Fallible<DomRoot<VRDisplayEvent>> {
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<VRDisplay> {
- Root::from_ref(&*self.display)
+ fn Display(&self) -> DomRoot<VRDisplay> {
+ 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 337f70d2b46..5db556cdf07 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<VREyeParameters> {
+ pub fn new(parameters: WebVREyeParameters, global: &GlobalScope) -> DomRoot<VREyeParameters> {
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<VRFieldOfView> {
- Root::from_ref(&*self.fov)
+ fn FieldOfView(&self) -> DomRoot<VRFieldOfView> {
+ 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 93f72bc77b5..389c2edeef4 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<VRFieldOfView> {
+ pub fn new(global: &GlobalScope, fov: WebVRFieldOfView) -> DomRoot<VRFieldOfView> {
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 c7ccf84f10e..4ed95a2a4b4 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<VRFrameData> {
+ fn new(global: &GlobalScope) -> DomRoot<VRFrameData> {
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<Root<VRFrameData>> {
+ pub fn Constructor(window: &Window) -> Fallible<DomRoot<VRFrameData>> {
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<VRPose> {
- Root::from_ref(&*self.pose)
+ fn Pose(&self) -> DomRoot<VRPose> {
+ DomRoot::from_ref(&*self.pose)
}
}
diff --git a/components/script/dom/vrpose.rs b/components/script/dom/vrpose.rs
index fb41149cd83..d80a4c5a049 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<VRPose> {
+ pub fn new(global: &GlobalScope, pose: &webvr::VRPose) -> DomRoot<VRPose> {
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 c2731d1193b..d7287249a89 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<VRStageParameters> {
+ pub fn new(parameters: WebVRStageParameters, global: &GlobalScope) -> DomRoot<VRStageParameters> {
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 1d2ccb34d9f..3740db14751 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<OESStandardDerivatives> {
+ fn new(ctx: &WebGLRenderingContext) -> DomRoot<OESStandardDerivatives> {
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 c048b2d7f84..967df546cc9 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<OESTextureFloat> {
+ fn new(ctx: &WebGLRenderingContext) -> DomRoot<OESTextureFloat> {
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 12d04195a59..2a730f2e85f 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<OESTextureFloatLinear> {
+ fn new(ctx: &WebGLRenderingContext) -> DomRoot<OESTextureFloatLinear> {
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 15a9fad531e..f5db59e097d 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<OESTextureHalfFloat> {
+ fn new(ctx: &WebGLRenderingContext) -> DomRoot<OESTextureHalfFloat> {
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 afaeedd5a0c..52f15ada5c2 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<OESTextureHalfFloatLinear> {
+ fn new(ctx: &WebGLRenderingContext) -> DomRoot<OESTextureHalfFloatLinear> {
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 00c9d1abdda..cf2f3ab0f50 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<Root<WebGLVertexArrayObjectOES>> {
+ fn CreateVertexArrayOES(&self) -> Option<DomRoot<WebGLVertexArrayObjectOES>> {
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<OESVertexArrayObject> {
+ fn new(ctx: &WebGLRenderingContext) -> DomRoot<OESVertexArrayObject> {
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 cdbe9f2e2e8..8433b345328 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<WebGLVertexArrayObjectOES> {
+ pub fn new(global: &GlobalScope, id: WebGLVertexArrayId) -> DomRoot<WebGLVertexArrayObjectOES> {
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<Root<WebGLBuffer>> {
- self.bound_attrib_buffers.borrow().iter().map(|(_, b)| Root::from_ref(&**b)).collect()
+ pub fn bound_attrib_buffers(&self) -> Vec<DomRoot<WebGLBuffer>> {
+ 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<Item=(u32, &'a WebGLBuffer)> {
*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<Root<WebGLBuffer>> {
+ pub fn bound_buffer_element_array(&self) -> Option<DomRoot<WebGLBuffer>> {
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 7cb4e5b4d25..6b4a2815347 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<Self::Extension>;
+ fn new(ctx: &WebGLRenderingContext) -> DomRoot<Self::Extension>;
/// 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 ebadaf9a612..8f340b7835d 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<T>(&self) -> Option<Root<T::Extension>>
+ pub fn get_dom_object<T>(&self) -> Option<DomRoot<T::Extension>>
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 fa4d1112a3c..7b4452ad7dc 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<T> WebGLExtensionWrapper for TypedWebGLExtensionWrapper<T>
}
impl<T> TypedWebGLExtensionWrapper<T> where T: WebGLExtension + JSTraceable + HeapSizeOf + 'static {
- pub fn dom_object(&self) -> Option<Root<T::Extension>> {
+ pub fn dom_object(&self) -> Option<DomRoot<T::Extension>> {
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 7392dae0ae1..5be0c6f44fd 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<WebGLTexture>,
+ pub texture: DomRoot<WebGLTexture>,
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<WebGLTexture>,
+ pub texture: DomRoot<WebGLTexture>,
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 596729b15fe..6712e61fea4 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<WebGLActiveInfo> {
+ pub fn new(window: &Window, size: i32, ty: u32, name: DOMString) -> DomRoot<WebGLActiveInfo> {
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 63859fb9afe..4510a74fd1b 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<Root<WebGLBuffer>> {
+ -> Option<DomRoot<WebGLBuffer>> {
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<WebGLBuffer> {
+ -> DomRoot<WebGLBuffer> {
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 494740a9697..3e28af76d6e 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<WebGLContextEvent> {
+ pub fn new_uninitialized(window: &Window) -> DomRoot<WebGLContextEvent> {
// 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<WebGLContextEvent> {
+ status_message: DOMString) -> DomRoot<WebGLContextEvent> {
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<Root<WebGLContextEvent>> {
+ init: &WebGLContextEventInit) -> Fallible<DomRoot<WebGLContextEvent>> {
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 35698c5a4d2..211a4a5d8b9 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<Root<WebGLFramebuffer>> {
+ -> Option<DomRoot<WebGLFramebuffer>> {
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<WebGLFramebuffer> {
+ -> DomRoot<WebGLFramebuffer> {
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 39262c2f5bd..50c61397bb8 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<Root<WebGLProgram>> {
+ -> Option<DomRoot<WebGLProgram>> {
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<WebGLProgram> {
+ -> DomRoot<WebGLProgram> {
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<Root<WebGLActiveInfo>> {
+ pub fn get_active_uniform(&self, index: u32) -> WebGLResult<DomRoot<WebGLActiveInfo>> {
if self.is_deleted() {
return Err(WebGLError::InvalidValue);
}
@@ -233,7 +233,7 @@ impl WebGLProgram {
}
/// glGetActiveAttrib
- pub fn get_active_attrib(&self, index: u32) -> WebGLResult<Root<WebGLActiveInfo>> {
+ pub fn get_active_attrib(&self, index: u32) -> WebGLResult<DomRoot<WebGLActiveInfo>> {
if self.is_deleted() {
return Err(WebGLError::InvalidValue);
}
diff --git a/components/script/dom/webglrenderbuffer.rs b/components/script/dom/webglrenderbuffer.rs
index be324d5e905..89151a07f8d 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<Root<WebGLRenderbuffer>> {
+ -> Option<DomRoot<WebGLRenderbuffer>> {
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<WebGLRenderbuffer> {
+ -> DomRoot<WebGLRenderbuffer> {
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 dd0c802ab09..6ff48147144 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<i32>, attrs: GLContextAttributes)
- -> Option<Root<WebGLRenderingContext>> {
+ -> Option<DomRoot<WebGLRenderingContext>> {
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<Root<WebGLTexture>> {
+ pub fn bound_texture_for_target(&self, target: &TexImageTarget) -> Option<DomRoot<WebGLTexture>> {
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<Root<WebGLBuffer>> {
+ pub fn bound_buffer_element_array(&self) -> Option<DomRoot<WebGLBuffer>> {
self.bound_buffer_element_array.get()
}
@@ -992,7 +992,7 @@ impl WebGLRenderingContext {
}
fn tex_sub_image_2d(&self,
- texture: Root<WebGLTexture>,
+ texture: DomRoot<WebGLTexture>,
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<HTMLCanvasElement> {
- Root::from_ref(&*self.canvas)
+ fn Canvas(&self) -> DomRoot<HTMLCanvasElement> {
+ 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<Root<WebGLBuffer>> {
+ fn CreateBuffer(&self) -> Option<DomRoot<WebGLBuffer>> {
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<Root<WebGLFramebuffer>> {
+ fn CreateFramebuffer(&self) -> Option<DomRoot<WebGLFramebuffer>> {
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<Root<WebGLRenderbuffer>> {
+ fn CreateRenderbuffer(&self) -> Option<DomRoot<WebGLRenderbuffer>> {
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<Root<WebGLTexture>> {
+ fn CreateTexture(&self) -> Option<DomRoot<WebGLTexture>> {
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<Root<WebGLProgram>> {
+ fn CreateProgram(&self) -> Option<DomRoot<WebGLProgram>> {
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<Root<WebGLShader>> {
+ fn CreateShader(&self, shader_type: u32) -> Option<DomRoot<WebGLShader>> {
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<Root<WebGLActiveInfo>> {
+ fn GetActiveUniform(&self, program: Option<&WebGLProgram>, index: u32) -> Option<DomRoot<WebGLActiveInfo>> {
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<Root<WebGLActiveInfo>> {
+ fn GetActiveAttrib(&self, program: Option<&WebGLProgram>, index: u32) -> Option<DomRoot<WebGLActiveInfo>> {
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<Root<WebGLShaderPrecisionFormat>> {
+ -> Option<DomRoot<WebGLShaderPrecisionFormat>> {
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<Root<WebGLUniformLocation>> {
+ name: DOMString) -> Option<DomRoot<WebGLUniformLocation>> {
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 54f2a743446..2a48ca21e73 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<Root<WebGLShader>> {
+ -> Option<DomRoot<WebGLShader>> {
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<WebGLShader> {
+ -> DomRoot<WebGLShader> {
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 befad009bb5..5ea5d8e83cf 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<WebGLShaderPrecisionFormat> {
+ precision: i32) -> DomRoot<WebGLShaderPrecisionFormat> {
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 fe323b53efd..ec8dee28172 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<Root<WebGLTexture>> {
+ -> Option<DomRoot<WebGLTexture>> {
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<WebGLTexture> {
+ -> DomRoot<WebGLTexture> {
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 ded74593c67..080dda92d8b 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<WebGLUniformLocation> {
+ -> DomRoot<WebGLUniformLocation> {
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 132c616ae49..49a77dd3db5 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<WebSocket> {
+ fn new(global: &GlobalScope, url: ServoUrl) -> DomRoot<WebSocket> {
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<StringOrStringSequence>)
- -> Fallible<Root<WebSocket>> {
+ -> Fallible<DomRoot<WebSocket>> {
// 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 10e0299b0ae..7a7b628cecc 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<WindowProxy> {
+ pub fn window_proxy(&self) -> DomRoot<WindowProxy> {
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<Root<WindowProxy>> {
+ pub fn undiscarded_window_proxy(&self) -> Option<DomRoot<WindowProxy>> {
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<Worklet> {
+ fn new_paint_worklet(&self) -> DomRoot<Worklet> {
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<Document> {
+ fn Document(&self) -> DomRoot<Document> {
self.document.get().expect("Document accessed before initialization.")
}
// https://html.spec.whatwg.org/multipage/#dom-history
- fn History(&self) -> Root<History> {
+ fn History(&self) -> DomRoot<History> {
self.history.or_init(|| History::new(self))
}
// https://html.spec.whatwg.org/multipage/#dom-window-customelements
- fn CustomElements(&self) -> Root<CustomElementRegistry> {
+ fn CustomElements(&self) -> DomRoot<CustomElementRegistry> {
self.custom_element_registry.or_init(|| CustomElementRegistry::new(self))
}
// https://html.spec.whatwg.org/multipage/#dom-location
- fn Location(&self) -> Root<Location> {
+ fn Location(&self) -> DomRoot<Location> {
self.location.or_init(|| Location::new(self))
}
// https://html.spec.whatwg.org/multipage/#dom-sessionstorage
- fn SessionStorage(&self) -> Root<Storage> {
+ fn SessionStorage(&self) -> DomRoot<Storage> {
self.session_storage.or_init(|| Storage::new(self, StorageType::Session))
}
// https://html.spec.whatwg.org/multipage/#dom-localstorage
- fn LocalStorage(&self) -> Root<Storage> {
+ fn LocalStorage(&self) -> DomRoot<Storage> {
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<Crypto> {
+ fn Crypto(&self) -> DomRoot<Crypto> {
self.upcast::<GlobalScope>().crypto()
}
// https://html.spec.whatwg.org/multipage/#dom-frameelement
- fn GetFrameElement(&self) -> Option<Root<Element>> {
+ fn GetFrameElement(&self) -> Option<DomRoot<Element>> {
// 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<Navigator> {
+ fn Navigator(&self) -> DomRoot<Navigator> {
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<WindowProxy> {
+ fn Window(&self) -> DomRoot<WindowProxy> {
self.window_proxy()
}
// https://html.spec.whatwg.org/multipage/#dom-self
- fn Self_(&self) -> Root<WindowProxy> {
+ fn Self_(&self) -> DomRoot<WindowProxy> {
self.window_proxy()
}
// https://html.spec.whatwg.org/multipage/#dom-frames
- fn Frames(&self) -> Root<WindowProxy> {
+ fn Frames(&self) -> DomRoot<WindowProxy> {
self.window_proxy()
}
// https://html.spec.whatwg.org/multipage/#dom-parent
- fn GetParent(&self) -> Option<Root<WindowProxy>> {
+ fn GetParent(&self) -> Option<DomRoot<WindowProxy>> {
// 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<Root<WindowProxy>> {
+ fn GetTop(&self) -> Option<DomRoot<WindowProxy>> {
// 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<Performance> {
+ fn Performance(&self) -> DomRoot<Performance> {
self.performance.or_init(|| {
let global_scope = self.upcast::<GlobalScope>();
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<Screen> {
+ fn Screen(&self) -> DomRoot<Screen> {
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<DOMString>) -> Root<CSSStyleDeclaration> {
+ pseudo: Option<DOMString>) -> DomRoot<CSSStyleDeclaration> {
// 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<MediaQueryList> {
+ fn MatchMedia(&self, query: DOMString) -> DomRoot<MediaQueryList> {
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<Worklet> {
+ fn PaintWorklet(&self) -> DomRoot<Worklet> {
self.paint_worklet.or_init(|| self.new_paint_worklet())
}
- fn TestRunner(&self) -> Root<TestRunner> {
+ fn TestRunner(&self) -> DomRoot<TestRunner> {
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<Root<Element>>, Rect<Au>) {
+ pub fn offset_parent_query(&self, node: TrustedNodeAddress) -> (Option<DomRoot<Element>>, Rect<Au>) {
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<Root<Window>> {
+ pub fn IndexedGetter(&self, _index: u32, _found: &mut bool) -> Option<DomRoot<Window>> {
None
}
@@ -1822,7 +1822,7 @@ impl Window {
webgl_chan: WebGLChan,
webvr_chan: Option<IpcSender<WebVRMsg>>,
microtask_queue: Rc<MicrotaskQueue>,
- ) -> Root<Self> {
+ ) -> DomRoot<Self> {
let layout_rpc: Box<LayoutRPC + Send> = {
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 3c8a340d0f7..3d5faba1ad3 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<WindowProxy>
+ -> DomRoot<WindowProxy>
{
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<WindowProxy>
+ -> DomRoot<WindowProxy>
{
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<Root<Window>> {
+ -> Option<DomRoot<Window>> {
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 31e65c563b3..d437b19c148 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<AtomicBool>) -> Root<Worker> {
+ closing: Arc<AtomicBool>) -> DomRoot<Worker> {
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<Root<Worker>> {
+ pub fn Constructor(global: &GlobalScope, script_url: DOMString) -> Fallible<DomRoot<Worker>> {
// 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 252be0f3bf1..ca7e2c3b7a9 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<WorkerGlobalScope> {
- Root::from_ref(self)
+ fn Self_(&self) -> DomRoot<WorkerGlobalScope> {
+ DomRoot::from_ref(self)
}
// https://html.spec.whatwg.org/multipage/#dom-workerglobalscope-location
- fn Location(&self) -> Root<WorkerLocation> {
+ fn Location(&self) -> DomRoot<WorkerLocation> {
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<WorkerNavigator> {
+ fn Navigator(&self) -> DomRoot<WorkerNavigator> {
self.navigator.or_init(|| WorkerNavigator::new(self))
}
// https://html.spec.whatwg.org/multipage/#dfn-Crypto
- fn Crypto(&self) -> Root<Crypto> {
+ fn Crypto(&self) -> DomRoot<Crypto> {
self.upcast::<GlobalScope>().crypto()
}
@@ -316,7 +316,7 @@ impl WorkerGlobalScopeMethods for WorkerGlobalScope {
}
// https://w3c.github.io/hr-time/#the-performance-attribute
- fn Performance(&self) -> Root<Performance> {
+ fn Performance(&self) -> DomRoot<Performance> {
self.performance.or_init(|| {
let global_scope = self.upcast::<GlobalScope>();
Performance::new(global_scope,
diff --git a/components/script/dom/workerlocation.rs b/components/script/dom/workerlocation.rs
index d7ceda40531..ca7d30d4d3c 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<WorkerLocation> {
+ pub fn new(global: &WorkerGlobalScope, url: ServoUrl) -> DomRoot<WorkerLocation> {
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 d2d99be1264..e11347c34c6 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<WorkerNavigator> {
+ pub fn new(global: &WorkerGlobalScope) -> DomRoot<WorkerNavigator> {
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<Permissions> {
+ fn Permissions(&self) -> DomRoot<Permissions> {
self.permissions.or_init(|| Permissions::new(&self.global()))
}
}
diff --git a/components/script/dom/worklet.rs b/components/script/dom/worklet.rs
index b83de5e462d..4f13fac1b1a 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<Worklet> {
+ pub fn new(window: &Window, global_type: WorkletGlobalScopeType) -> DomRoot<Worklet> {
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<WorkletGlobalScope>
+ -> DomRoot<WorkletGlobalScope>
{
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 64c8f0793a6..adae76e22bb 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<WorkletGlobalScope>
+ -> DomRoot<WorkletGlobalScope>
{
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 182cf65f2e2..f5ef640abce 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<XMLDocument> {
+ -> DomRoot<XMLDocument> {
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<Root<Location>> {
+ fn GetLocation(&self) -> Option<DomRoot<Location>> {
self.upcast::<Document>().GetLocation()
}
diff --git a/components/script/dom/xmlhttprequest.rs b/components/script/dom/xmlhttprequest.rs
index 16c14cb2e5b..4b9b2b45a4c 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<XMLHttpRequest> {
+ pub fn new(global: &GlobalScope) -> DomRoot<XMLHttpRequest> {
reflect_dom_object(box XMLHttpRequest::new_inherited(global),
global,
XMLHttpRequestBinding::Wrap)
}
// https://xhr.spec.whatwg.org/#constructors
- pub fn Constructor(global: &GlobalScope) -> Fallible<Root<XMLHttpRequest>> {
+ pub fn Constructor(global: &GlobalScope) -> Fallible<DomRoot<XMLHttpRequest>> {
Ok(XMLHttpRequest::new(global))
}
@@ -289,7 +289,7 @@ impl XMLHttpRequestMethods for XMLHttpRequest {
fn Open_(&self, method: ByteString, url: USVString, async: bool,
username: Option<USVString>, password: Option<USVString>) -> ErrorResult {
// Step 1
- if let Some(window) = Root::downcast::<Window>(self.global()) {
+ if let Some(window) = DomRoot::downcast::<Window>(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<XMLHttpRequestUpload> {
- Root::from_ref(&*self.upload)
+ fn Upload(&self) -> DomRoot<XMLHttpRequestUpload> {
+ 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::<Window>(self.global()) {
+ if let Some(win) = DomRoot::downcast::<Window>(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<Option<Root<Document>>> {
+ fn GetResponseXML(&self) -> Fallible<Option<DomRoot<Document>>> {
// TODO(#2823): Until [Exposed] is implemented, this attribute needs to return null
// explicitly in the worker scope.
if self.global().is::<WorkerGlobalScope>() {
@@ -1088,7 +1088,7 @@ impl XMLHttpRequest {
}
// https://xhr.spec.whatwg.org/#blob-response
- fn blob_response(&self) -> Root<Blob> {
+ fn blob_response(&self) -> DomRoot<Blob> {
// 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<Root<Document>> {
+ fn document_response(&self) -> Option<DomRoot<Document>> {
// 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<Document>;
+ let temp_doc: DomRoot<Document>;
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<Document> {
+ fn document_text_html(&self) -> DomRoot<Document> {
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<Document> {
+ fn handle_xml(&self) -> DomRoot<Document> {
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<Document> {
+ fn new_doc(&self, is_html_document: IsHTMLDocument) -> DomRoot<Document> {
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 e390caa5a05..7c6a1a4f513 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<XMLHttpRequestUpload> {
+ pub fn new(global: &GlobalScope) -> DomRoot<XMLHttpRequestUpload> {
reflect_dom_object(box XMLHttpRequestUpload::new_inherited(),
global,
XMLHttpRequestUploadBinding::Wrap)
diff --git a/components/script/fetch.rs b/components/script/fetch.rs
index babd4c7e942..7a6f63f7b40 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<Response>, m: Metadata) {
+fn fill_headers_with_metadata(r: DomRoot<Response>, 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 476a551c25c..f0ec5d44ae5 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<F>(&self, target_provider: F)
- where F: Fn(PipelineId) -> Option<Root<GlobalScope>>
+ where F: Fn(PipelineId) -> Option<DomRoot<GlobalScope>>
{
if self.performing_a_microtask_checkpoint.get() {
return;
diff --git a/components/script/script_thread.rs b/components/script/script_thread.rs
index 5957b3a8857..4b9984845e8 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<Root<Document>> {
- self.map.remove(&pipeline_id).map(|ref doc| Root::from_ref(&**doc))
+ pub fn remove(&mut self, pipeline_id: PipelineId) -> Option<DomRoot<Document>> {
+ 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<Root<Document>> {
- self.map.get(&pipeline_id).map(|doc| Root::from_ref(&**doc))
+ pub fn find_document(&self, pipeline_id: PipelineId) -> Option<DomRoot<Document>> {
+ self.map.get(&pipeline_id).map(|doc| DomRoot::from_ref(&**doc))
}
- pub fn find_window(&self, pipeline_id: PipelineId) -> Option<Root<Window>> {
- self.find_document(pipeline_id).map(|doc| Root::from_ref(doc.window()))
+ pub fn find_window(&self, pipeline_id: PipelineId) -> Option<DomRoot<Window>> {
+ self.find_document(pipeline_id).map(|doc| DomRoot::from_ref(doc.window()))
}
- pub fn find_global(&self, pipeline_id: PipelineId) -> Option<Root<GlobalScope>> {
- self.find_window(pipeline_id).map(|window| Root::from_ref(window.upcast()))
+ pub fn find_global(&self, pipeline_id: PipelineId) -> Option<DomRoot<GlobalScope>> {
+ 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<Root<HTMLIFrameElement>>
+ -> Option<DomRoot<HTMLIFrameElement>>
{
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<Document>);
+ type Item = (PipelineId, DomRoot<Document>);
- fn next(&mut self) -> Option<(PipelineId, Root<Document>)> {
- self.iter.next().map(|(id, doc)| (*id, Root::from_ref(&**doc)))
+ fn next(&mut self) -> Option<(PipelineId, DomRoot<Document>)> {
+ self.iter.next().map(|(id, doc)| (*id, DomRoot::from_ref(&**doc)))
}
}
@@ -616,10 +616,10 @@ impl ScriptThread {
})
}
- pub fn get_mutation_observers() -> Vec<Root<MutationObserver>> {
+ pub fn get_mutation_observers() -> Vec<DomRoot<MutationObserver>> {
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<Metadata>)
- -> Option<Root<ServoParser>> {
+ -> Option<DomRoot<ServoParser>> {
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<Root<Document>> {
+ pub fn find_document(id: PipelineId) -> Option<DomRoot<Document>> {
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<Root<WindowProxy>> {
+ pub fn find_window_proxy(id: BrowsingContextId) -> Option<DomRoot<WindowProxy>> {
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<Metadata>) -> Option<Root<ServoParser>> {
+ metadata: Option<Metadata>) -> Option<DomRoot<ServoParser>> {
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<Root<ServiceWorkerRegistration>> {
+ pub fn handle_get_registration(&self, scope_url: &ServoUrl) -> Option<DomRoot<ServiceWorkerRegistration>> {
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<Root<WindowProxy>>
+ -> Option<DomRoot<WindowProxy>>
{
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<WindowProxy>
+ -> DomRoot<WindowProxy>
{
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<ServoParser> {
+ fn load(&self, metadata: Metadata, incomplete: InProgressLoad) -> DomRoot<ServoParser> {
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::<Node>()
.inclusive_ancestors()
- .filter_map(Root::downcast::<HTMLAnchorElement>)
+ .filter_map(DomRoot::downcast::<HTMLAnchorElement>)
.next() {
let status = anchor.upcast::<Element>()
.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::<Node>()
.inclusive_ancestors()
- .filter_map(Root::downcast::<HTMLAnchorElement>)
+ .filter_map(DomRoot::downcast::<HTMLAnchorElement>)
.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 66ee6fe4eb4..39dba228ba3 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<Root<Node>> {
+ -> Option<DomRoot<Node>> {
documents.find_document(pipeline).and_then(|document|
document.upcast::<Node>().traverse_preorder().find(|candidate| candidate.unique_id() == node_id)
)