From 0e3c54c1911ba2c3bf305ee04f04fcd9bf2fc2fe Mon Sep 17 00:00:00 2001 From: Anthony Ramine Date: Mon, 25 Sep 2017 23:30:24 +0200 Subject: Rename dom::bindings::js to dom::bindings::root --- components/script/dom/domstringmap.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'components/script/dom/domstringmap.rs') diff --git a/components/script/dom/domstringmap.rs b/components/script/dom/domstringmap.rs index d529ca25cf8..50c81c9d3b5 100644 --- a/components/script/dom/domstringmap.rs +++ b/components/script/dom/domstringmap.rs @@ -5,8 +5,8 @@ use dom::bindings::codegen::Bindings::DOMStringMapBinding; use dom::bindings::codegen::Bindings::DOMStringMapBinding::DOMStringMapMethods; use dom::bindings::error::ErrorResult; -use dom::bindings::js::{JS, Root}; use dom::bindings::reflector::{Reflector, reflect_dom_object}; +use dom::bindings::root::{JS, Root}; use dom::bindings::str::DOMString; use dom::htmlelement::HTMLElement; use dom::node::window_from_node; -- cgit v1.2.3 From 7be32fb2371a14ba61b008a37e79761f66c073c7 Mon Sep 17 00:00:00 2001 From: Anthony Ramine Date: Mon, 25 Sep 2017 23:56:32 +0200 Subject: Rename JS to Dom --- components/script/dom/domstringmap.rs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'components/script/dom/domstringmap.rs') diff --git a/components/script/dom/domstringmap.rs b/components/script/dom/domstringmap.rs index 50c81c9d3b5..ae7387c2825 100644 --- a/components/script/dom/domstringmap.rs +++ b/components/script/dom/domstringmap.rs @@ -6,7 +6,7 @@ use dom::bindings::codegen::Bindings::DOMStringMapBinding; use dom::bindings::codegen::Bindings::DOMStringMapBinding::DOMStringMapMethods; use dom::bindings::error::ErrorResult; use dom::bindings::reflector::{Reflector, reflect_dom_object}; -use dom::bindings::root::{JS, Root}; +use dom::bindings::root::{Dom, Root}; use dom::bindings::str::DOMString; use dom::htmlelement::HTMLElement; use dom::node::window_from_node; @@ -15,14 +15,14 @@ use dom_struct::dom_struct; #[dom_struct] pub struct DOMStringMap { reflector_: Reflector, - element: JS, + element: Dom, } impl DOMStringMap { fn new_inherited(element: &HTMLElement) -> DOMStringMap { DOMStringMap { reflector_: Reflector::new(), - element: JS::from_ref(element), + element: Dom::from_ref(element), } } -- cgit v1.2.3 From f87c2a8d7616112ca924e30292db2d244cf87eec Mon Sep 17 00:00:00 2001 From: Anthony Ramine Date: Tue, 26 Sep 2017 01:53:40 +0200 Subject: Rename Root to DomRoot In a later PR, DomRoot will become a type alias of Root>, where Root will be able to handle all the things that need to be rooted that have a stable traceable address that doesn't move for the whole lifetime of the root. Stay tuned. --- components/script/dom/domstringmap.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'components/script/dom/domstringmap.rs') 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 { + pub fn new(element: &HTMLElement) -> DomRoot { let window = window_from_node(element); reflect_dom_object(box DOMStringMap::new_inherited(element), &*window, -- cgit v1.2.3 From aa15dc269f41503d81ad44cd7e85d69e6f4aeac7 Mon Sep 17 00:00:00 2001 From: Simon Sapin Date: Mon, 16 Oct 2017 14:35:30 +0200 Subject: Remove use of unstable box syntax. http://www.robohornet.org gives a score of 101.36 on master, and 102.68 with this PR. The latter is slightly better, but probably within noise level. So it looks like this PR does not affect DOM performance. This is expected since `Box::new` is defined as: ```rust impl Box { #[inline(always)] pub fn new(x: T) -> Box { box x } } ``` With inlining, it should compile to the same as box syntax. --- components/script/dom/domstringmap.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'components/script/dom/domstringmap.rs') diff --git a/components/script/dom/domstringmap.rs b/components/script/dom/domstringmap.rs index c349a9d5259..c64375e0bdb 100644 --- a/components/script/dom/domstringmap.rs +++ b/components/script/dom/domstringmap.rs @@ -28,7 +28,7 @@ impl DOMStringMap { pub fn new(element: &HTMLElement) -> DomRoot { let window = window_from_node(element); - reflect_dom_object(box DOMStringMap::new_inherited(element), + reflect_dom_object(Box::new(DOMStringMap::new_inherited(element)), &*window, DOMStringMapBinding::Wrap) } -- cgit v1.2.3 From c37a345dc9f4dda6ea29c42f96f6c7201c42cbac Mon Sep 17 00:00:00 2001 From: chansuke Date: Tue, 18 Sep 2018 23:24:15 +0900 Subject: Format script component --- components/script/dom/domstringmap.rs | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) (limited to 'components/script/dom/domstringmap.rs') diff --git a/components/script/dom/domstringmap.rs b/components/script/dom/domstringmap.rs index c64375e0bdb..514781c9a1d 100644 --- a/components/script/dom/domstringmap.rs +++ b/components/script/dom/domstringmap.rs @@ -28,9 +28,11 @@ impl DOMStringMap { pub fn new(element: &HTMLElement) -> DomRoot { let window = window_from_node(element); - reflect_dom_object(Box::new(DOMStringMap::new_inherited(element)), - &*window, - DOMStringMapBinding::Wrap) + reflect_dom_object( + Box::new(DOMStringMap::new_inherited(element)), + &*window, + DOMStringMapBinding::Wrap, + ) } } @@ -53,6 +55,10 @@ impl DOMStringMapMethods for DOMStringMap { // https://html.spec.whatwg.org/multipage/#the-domstringmap-interface:supported-property-names fn SupportedPropertyNames(&self) -> Vec { - self.element.supported_prop_names_custom_attr().iter().cloned().collect() + self.element + .supported_prop_names_custom_attr() + .iter() + .cloned() + .collect() } } -- cgit v1.2.3 From 45f7199eee82c66637ec68287eafa40a651001c4 Mon Sep 17 00:00:00 2001 From: Simon Sapin Date: Thu, 1 Nov 2018 23:45:06 +0100 Subject: `cargo fix --edition` --- components/script/dom/domstringmap.rs | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) (limited to 'components/script/dom/domstringmap.rs') diff --git a/components/script/dom/domstringmap.rs b/components/script/dom/domstringmap.rs index 514781c9a1d..d62b4fd49f9 100644 --- a/components/script/dom/domstringmap.rs +++ b/components/script/dom/domstringmap.rs @@ -2,14 +2,14 @@ * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ -use 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, DomRoot}; -use dom::bindings::str::DOMString; -use dom::htmlelement::HTMLElement; -use dom::node::window_from_node; +use crate::dom::bindings::codegen::Bindings::DOMStringMapBinding; +use crate::dom::bindings::codegen::Bindings::DOMStringMapBinding::DOMStringMapMethods; +use crate::dom::bindings::error::ErrorResult; +use crate::dom::bindings::reflector::{Reflector, reflect_dom_object}; +use crate::dom::bindings::root::{Dom, DomRoot}; +use crate::dom::bindings::str::DOMString; +use crate::dom::htmlelement::HTMLElement; +use crate::dom::node::window_from_node; use dom_struct::dom_struct; #[dom_struct] -- cgit v1.2.3 From 9e92eb205a2a12fe0be883e42cb7f82deebc9031 Mon Sep 17 00:00:00 2001 From: Pyfisch Date: Tue, 6 Nov 2018 20:38:02 +0100 Subject: Reorder imports --- components/script/dom/domstringmap.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'components/script/dom/domstringmap.rs') diff --git a/components/script/dom/domstringmap.rs b/components/script/dom/domstringmap.rs index d62b4fd49f9..10da1af9299 100644 --- a/components/script/dom/domstringmap.rs +++ b/components/script/dom/domstringmap.rs @@ -5,7 +5,7 @@ use crate::dom::bindings::codegen::Bindings::DOMStringMapBinding; use crate::dom::bindings::codegen::Bindings::DOMStringMapBinding::DOMStringMapMethods; use crate::dom::bindings::error::ErrorResult; -use crate::dom::bindings::reflector::{Reflector, reflect_dom_object}; +use crate::dom::bindings::reflector::{reflect_dom_object, Reflector}; use crate::dom::bindings::root::{Dom, DomRoot}; use crate::dom::bindings::str::DOMString; use crate::dom::htmlelement::HTMLElement; -- cgit v1.2.3 From a1a14459c141afc6ac6771b8a6c9ca374537edf2 Mon Sep 17 00:00:00 2001 From: Jan Andre Ikenmeyer Date: Mon, 19 Nov 2018 14:47:12 +0100 Subject: Update MPL license to https (part 3) --- components/script/dom/domstringmap.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'components/script/dom/domstringmap.rs') diff --git a/components/script/dom/domstringmap.rs b/components/script/dom/domstringmap.rs index 10da1af9299..a3603e0ee93 100644 --- a/components/script/dom/domstringmap.rs +++ b/components/script/dom/domstringmap.rs @@ -1,6 +1,6 @@ /* This Source Code Form is subject to the terms of the Mozilla Public * 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/. */ + * file, You can obtain one at https://mozilla.org/MPL/2.0/. */ use crate::dom::bindings::codegen::Bindings::DOMStringMapBinding; use crate::dom::bindings::codegen::Bindings::DOMStringMapBinding::DOMStringMapMethods; -- cgit v1.2.3 From 3ea6d87bcc37167464e856949a4b9b77d0e9318a Mon Sep 17 00:00:00 2001 From: YUAN LYU Date: Fri, 20 Mar 2020 22:14:18 -0400 Subject: Add trait DomObjectWrap to provide WRAP function --- components/script/dom/domstringmap.rs | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) (limited to 'components/script/dom/domstringmap.rs') diff --git a/components/script/dom/domstringmap.rs b/components/script/dom/domstringmap.rs index a3603e0ee93..9ff1071e85b 100644 --- a/components/script/dom/domstringmap.rs +++ b/components/script/dom/domstringmap.rs @@ -2,7 +2,6 @@ * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at https://mozilla.org/MPL/2.0/. */ -use crate::dom::bindings::codegen::Bindings::DOMStringMapBinding; use crate::dom::bindings::codegen::Bindings::DOMStringMapBinding::DOMStringMapMethods; use crate::dom::bindings::error::ErrorResult; use crate::dom::bindings::reflector::{reflect_dom_object, Reflector}; @@ -28,11 +27,7 @@ impl DOMStringMap { pub fn new(element: &HTMLElement) -> DomRoot { let window = window_from_node(element); - reflect_dom_object( - Box::new(DOMStringMap::new_inherited(element)), - &*window, - DOMStringMapBinding::Wrap, - ) + reflect_dom_object(Box::new(DOMStringMap::new_inherited(element)), &*window) } } -- cgit v1.2.3