mirror of
https://github.com/servo/servo.git
synced 2025-06-24 09:04:33 +01:00
Implement JSManaged for DOM objects.
This commit is contained in:
parent
061269f963
commit
625325434b
137 changed files with 3644 additions and 2778 deletions
|
@ -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)
|
||||
}
|
||||
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue