Implement JSManaged for DOM objects.

This commit is contained in:
Josh Matthews 2013-11-30 21:04:49 +01:00
parent 061269f963
commit 625325434b
137 changed files with 3644 additions and 2778 deletions

View file

@ -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)
}