aboutsummaryrefslogtreecommitdiffstats
path: root/components/script/dom/document.rs
diff options
context:
space:
mode:
Diffstat (limited to 'components/script/dom/document.rs')
-rw-r--r--components/script/dom/document.rs46
1 files changed, 23 insertions, 23 deletions
diff --git a/components/script/dom/document.rs b/components/script/dom/document.rs
index 0a94f9f5504..4559bb0981c 100644
--- a/components/script/dom/document.rs
+++ b/components/script/dom/document.rs
@@ -391,8 +391,7 @@ impl Document {
None => false,
Some(elements) => {
let position = elements.iter()
- .map(|elem| elem.root())
- .position(|element| element.r() == to_unregister)
+ .position(|element| &**element == to_unregister)
.expect("This element should be in registered.");
elements.remove(position);
elements.is_empty()
@@ -428,7 +427,7 @@ impl Document {
let root = root.upcast::<Node>();
for node in root.traverse_preorder() {
if let Some(elem) = node.downcast() {
- if (*elements)[head].root().r() == elem {
+ if &*(*elements)[head] == elem {
head += 1;
}
if new_node == node.r() || head == elements.len() {
@@ -685,8 +684,7 @@ impl Document {
// under the mouse.
for target in prev_mouse_over_targets.iter() {
if !mouse_over_targets.contains(target) {
- let target = target.root();
- let target_ref = target.r();
+ let target_ref = &**target;
if target_ref.get_hover_state() {
target_ref.set_hover_state(false);
@@ -749,27 +747,27 @@ impl Document {
},
};
let target = el.upcast::<EventTarget>();
- let window = self.window.root();
+ let window = &*self.window;
let client_x = Finite::wrap(point.x as f64);
let client_y = Finite::wrap(point.y as f64);
let page_x = Finite::wrap(point.x as f64 + window.PageXOffset() as f64);
let page_y = Finite::wrap(point.y as f64 + window.PageYOffset() as f64);
- let touch = Touch::new(window.r(), identifier, target,
+ let touch = Touch::new(window, identifier, target,
client_x, client_y, // TODO: Get real screen coordinates?
client_x, client_y,
page_x, page_y);
let mut touches = RootedVec::new();
touches.push(JS::from_rooted(&touch));
- let touches = TouchList::new(window.r(), touches.r());
+ let touches = TouchList::new(window, touches.r());
- let event = TouchEvent::new(window.r(),
+ let event = TouchEvent::new(window,
event_name,
EventBubbles::Bubbles,
EventCancelable::Cancelable,
- Some(window.r()),
+ Some(window),
0i32,
&touches, &touches, &touches,
// FIXME: modifier keys
@@ -777,9 +775,9 @@ impl Document {
let event = event.upcast::<Event>();
let result = event.fire(target);
- window.r().reflow(ReflowGoal::ForDisplay,
- ReflowQueryType::NoQuery,
- ReflowReason::MouseEvent);
+ window.reflow(ReflowGoal::ForDisplay,
+ ReflowQueryType::NoQuery,
+ ReflowReason::MouseEvent);
result
}
@@ -1089,13 +1087,15 @@ impl Document {
}
let mut deferred_scripts = self.deferred_scripts.borrow_mut();
while !deferred_scripts.is_empty() {
- let script = deferred_scripts[0].root();
- // Part of substep 1.
- if !script.is_ready_to_be_executed() {
- return;
+ {
+ let script = &*deferred_scripts[0];
+ // Part of substep 1.
+ if !script.is_ready_to_be_executed() {
+ return;
+ }
+ // Substep 2.
+ script.execute();
}
- // Substep 2.
- script.execute();
// Substep 3.
deferred_scripts.remove(0);
// Substep 4 (implicit).
@@ -1110,7 +1110,7 @@ impl Document {
// Execute the first in-order asap-executed script if it's ready, repeat as required.
// Re-borrowing the list for each step because it can also be borrowed under execute.
while self.asap_in_order_scripts_list.borrow().len() > 0 {
- let script = self.asap_in_order_scripts_list.borrow()[0].root();
+ let script = Root::from_ref(&*self.asap_in_order_scripts_list.borrow()[0]);
if !script.r().is_ready_to_be_executed() {
break;
}
@@ -1121,7 +1121,7 @@ impl Document {
let mut idx = 0;
// Re-borrowing the set for each step because it can also be borrowed under execute.
while idx < self.asap_scripts_set.borrow().len() {
- let script = self.asap_scripts_set.borrow()[idx].root();
+ let script = Root::from_ref(&*self.asap_scripts_set.borrow()[idx]);
if !script.r().is_ready_to_be_executed() {
idx += 1;
continue;
@@ -1332,7 +1332,7 @@ impl Document {
}
pub fn get_element_by_id(&self, id: &Atom) -> Option<Root<Element>> {
- self.idmap.borrow().get(&id).map(|ref elements| (*elements)[0].root())
+ self.idmap.borrow().get(&id).map(|ref elements| Root::from_ref(&*(*elements)[0]))
}
pub fn record_element_state_change(&self, el: &Element, which: ElementState) {
@@ -1925,7 +1925,7 @@ impl DocumentMethods for Document {
// https://html.spec.whatwg.org/multipage/#dom-document-defaultview
fn DefaultView(&self) -> Root<Window> {
- self.window.root()
+ Root::from_ref(&*self.window)
}
// https://html.spec.whatwg.org/multipage/#dom-document-cookie