diff options
author | Josh Matthews <josh@joshmatthews.net> | 2013-11-30 21:04:49 +0100 |
---|---|---|
committer | Josh Matthews <josh@joshmatthews.net> | 2014-02-24 15:16:42 -0500 |
commit | 625325434b5c7dc72e784a592f7e014c16cf1018 (patch) | |
tree | 9078f192cd7f41132a64124b7f70a3bb51e0936d /src/components/script/dom/clientrect.rs | |
parent | 061269f9639199a7419e2467ebbe3c28cac1e8ff (diff) | |
download | servo-625325434b5c7dc72e784a592f7e014c16cf1018.tar.gz servo-625325434b5c7dc72e784a592f7e014c16cf1018.zip |
Implement JSManaged for DOM objects.
Diffstat (limited to 'src/components/script/dom/clientrect.rs')
-rw-r--r-- | src/components/script/dom/clientrect.rs | 14 |
1 files changed, 8 insertions, 6 deletions
diff --git a/src/components/script/dom/clientrect.rs b/src/components/script/dom/clientrect.rs index 366c33fecbe..e4fd8716c26 100644 --- a/src/components/script/dom/clientrect.rs +++ b/src/components/script/dom/clientrect.rs @@ -3,21 +3,23 @@ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ use dom::bindings::codegen::ClientRectBinding; +use dom::bindings::js::JS; use dom::bindings::utils::{Reflectable, Reflector, reflect_dom_object}; use dom::window::Window; use servo_util::geometry::Au; +#[deriving(Encodable)] pub struct ClientRect { reflector_: Reflector, top: f32, bottom: f32, left: f32, right: f32, - window: @mut Window, + window: JS<Window>, } impl ClientRect { - pub fn new_inherited(window: @mut Window, + pub fn new_inherited(window: JS<Window>, top: Au, bottom: Au, left: Au, right: Au) -> ClientRect { ClientRect { @@ -30,11 +32,11 @@ impl ClientRect { } } - pub fn new(window: @mut Window, + pub fn new(window: &JS<Window>, top: Au, bottom: Au, - left: Au, right: Au) -> @mut ClientRect { - let rect = ClientRect::new_inherited(window, top, bottom, left, right); - reflect_dom_object(@mut rect, window, ClientRectBinding::Wrap) + left: Au, right: Au) -> JS<ClientRect> { + let rect = ClientRect::new_inherited(window.clone(), top, bottom, left, right); + reflect_dom_object(~rect, window.get(), ClientRectBinding::Wrap) } |