aboutsummaryrefslogtreecommitdiffstats
path: root/src/components/script/dom/clientrectlist.rs
diff options
context:
space:
mode:
authorMs2ger <ms2ger@gmail.com>2013-10-23 20:05:14 +0200
committerMs2ger <ms2ger@gmail.com>2013-10-23 20:44:22 +0200
commit6af555ab237f98db1abf1a1a023723407ef39c87 (patch)
tree680dfc1c49ed07860ed69fb9927bd08302533c64 /src/components/script/dom/clientrectlist.rs
parentf75568e9395b712805d25339d50fb5cfd361c2c4 (diff)
downloadservo-6af555ab237f98db1abf1a1a023723407ef39c87.tar.gz
servo-6af555ab237f98db1abf1a1a023723407ef39c87.zip
Cleanup ClientRectList binding.
Diffstat (limited to 'src/components/script/dom/clientrectlist.rs')
-rw-r--r--src/components/script/dom/clientrectlist.rs36
1 files changed, 18 insertions, 18 deletions
diff --git a/src/components/script/dom/clientrectlist.rs b/src/components/script/dom/clientrectlist.rs
index 1c6b7870fd6..d956964ff01 100644
--- a/src/components/script/dom/clientrectlist.rs
+++ b/src/components/script/dom/clientrectlist.rs
@@ -3,29 +3,32 @@
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
use dom::bindings::codegen::ClientRectListBinding;
-use dom::bindings::utils::{Reflectable, Reflector};
+use dom::bindings::utils::{Reflectable, Reflector, reflect_dom_object};
use dom::clientrect::ClientRect;
-use script_task::page_from_context;
+use dom::window::Window;
use js::jsapi::{JSObject, JSContext};
pub struct ClientRectList {
reflector_: Reflector,
- rects: ~[@mut ClientRect]
+ rects: ~[@mut ClientRect],
+ window: @mut Window,
}
impl ClientRectList {
- pub fn new(rects: ~[@mut ClientRect], cx: *JSContext, scope: *JSObject) -> @mut ClientRectList {
- let list = @mut ClientRectList {
+ pub fn new_inherited(window: @mut Window,
+ rects: ~[@mut ClientRect]) -> ClientRectList {
+ ClientRectList {
reflector_: Reflector::new(),
- rects: rects
- };
- list.init_wrapper(cx, scope);
- list
+ rects: rects,
+ window: window,
+ }
}
- pub fn init_wrapper(@mut self, cx: *JSContext, scope: *JSObject) {
- self.wrap_object_shared(cx, scope);
+ pub fn new(window: @mut Window,
+ rects: ~[@mut ClientRect]) -> @mut ClientRectList {
+ reflect_dom_object(@mut ClientRectList::new_inherited(window, rects),
+ window, ClientRectListBinding::Wrap)
}
pub fn Length(&self) -> u32 {
@@ -55,14 +58,11 @@ impl Reflectable for ClientRectList {
&mut self.reflector_
}
- fn wrap_object_shared(@mut self, cx: *JSContext, scope: *JSObject) -> *JSObject {
- ClientRectListBinding::Wrap(cx, scope, self)
+ fn wrap_object_shared(@mut self, _cx: *JSContext, _scope: *JSObject) -> *JSObject {
+ unreachable!();
}
- fn GetParentObject(&self, cx: *JSContext) -> Option<@mut Reflectable> {
- let page = page_from_context(cx);
- unsafe {
- Some((*page).frame.get_ref().window as @mut Reflectable)
- }
+ fn GetParentObject(&self, _cx: *JSContext) -> Option<@mut Reflectable> {
+ Some(self.window as @mut Reflectable)
}
}