aboutsummaryrefslogtreecommitdiffstats
path: root/components/script/dom/window.rs
diff options
context:
space:
mode:
authorAnthony Ramine <n.oxyde@gmail.com>2015-10-07 14:55:02 +0200
committerAnthony Ramine <n.oxyde@gmail.com>2015-10-21 11:40:34 +0200
commit68014af78e8e3f5de4df0f6cc4d63b99c77478f5 (patch)
treef65b1a66ad8d7ce65042e37cf654da75e1766939 /components/script/dom/window.rs
parent13ea3ac413c511872784ccde416956217746553c (diff)
downloadservo-68014af78e8e3f5de4df0f6cc4d63b99c77478f5.tar.gz
servo-68014af78e8e3f5de4df0f6cc4d63b99c77478f5.zip
Clean up the cast calls
Diffstat (limited to 'components/script/dom/window.rs')
-rw-r--r--components/script/dom/window.rs9
1 files changed, 3 insertions, 6 deletions
diff --git a/components/script/dom/window.rs b/components/script/dom/window.rs
index 9ca6713991d..5a9233319c1 100644
--- a/components/script/dom/window.rs
+++ b/components/script/dom/window.rs
@@ -793,8 +793,7 @@ impl<'a, T: Reflectable> ScriptHelpers for &'a T {
impl Window {
pub fn clear_js_runtime(&self) {
- let document = self.Document();
- document.upcast::<Node>().teardown();
+ self.Document().upcast::<Node>().teardown();
// The above code may not catch all DOM objects
// (e.g. DOM objects removed from the tree that haven't
@@ -835,9 +834,7 @@ impl Window {
let body = self.Document().GetBody();
let (x, y) = match body {
Some(e) => {
- let node = e.upcast::<Node>();
- let content_size = node.get_bounding_content_box();
-
+ let content_size = e.upcast::<Node>().get_bounding_content_box();
let content_height = content_size.size.height.to_f64_px();
let content_width = content_size.size.width.to_f64_px();
(xfinite.max(0.0f64).min(content_width - width),
@@ -1055,7 +1052,7 @@ impl Window {
let js_runtime = js_runtime.as_ref().unwrap();
let element = response.node_address.and_then(|parent_node_address| {
let node = from_untrusted_node_address(js_runtime.rt(), parent_node_address);
- Root::downcast::<Element>(node)
+ Root::downcast(node)
});
(element, response.rect)
}