diff options
author | Tim Kuehn <tkuehn@cmu.edu> | 2013-07-12 20:19:48 -0700 |
---|---|---|
committer | Tim Kuehn <tkuehn@cmu.edu> | 2013-07-29 11:03:17 -0700 |
commit | e9888b299c0af0f57919535ec7cf4d30e23ece5a (patch) | |
tree | 275ab0246f9408545ee588bcd3d3863e5d525357 /src/components/script/dom/clientrectlist.rs | |
parent | eaa20edcd7c2097dd086014ae4193426fdf3fab6 (diff) | |
download | servo-e9888b299c0af0f57919535ec7cf4d30e23ece5a.tar.gz servo-e9888b299c0af0f57919535ec7cf4d30e23ece5a.zip |
structural changes to support Iframes
Diffstat (limited to 'src/components/script/dom/clientrectlist.rs')
-rw-r--r-- | src/components/script/dom/clientrectlist.rs | 17 |
1 files changed, 6 insertions, 11 deletions
diff --git a/src/components/script/dom/clientrectlist.rs b/src/components/script/dom/clientrectlist.rs index 2fdbc108f36..023b6ac37a6 100644 --- a/src/components/script/dom/clientrectlist.rs +++ b/src/components/script/dom/clientrectlist.rs @@ -5,7 +5,7 @@ use dom::bindings::codegen::ClientRectListBinding; use dom::bindings::utils::{WrapperCache, CacheableWrapper, BindingObject}; use dom::clientrect::ClientRect; -use script_task::{task_from_context, global_script_context}; +use script_task::page_from_context; use js::jsapi::{JSObject, JSContext}; @@ -17,21 +17,16 @@ pub struct ClientRectList { } impl ClientRectList { - pub fn new(rects: ~[@mut ClientRect]) -> @mut ClientRectList { + pub fn new(rects: ~[@mut ClientRect], cx: *JSContext, scope: *JSObject) -> @mut ClientRectList { let list = @mut ClientRectList { wrapper: WrapperCache::new(), rects: rects }; - list.init_wrapper(); + list.init_wrapper(cx, scope); list } - pub fn init_wrapper(@mut self) { - let script_context = global_script_context(); - let cx = script_context.js_compartment.cx.ptr; - let owner = script_context.root_frame.get_ref().window; - let cache = owner.get_wrappercache(); - let scope = cache.get_wrapper(); + pub fn init_wrapper(@mut self, cx: *JSContext, scope: *JSObject) { self.wrap_object_shared(cx, scope); } @@ -68,9 +63,9 @@ impl CacheableWrapper for ClientRectList { impl BindingObject for ClientRectList { fn GetParentObject(&self, cx: *JSContext) -> @mut CacheableWrapper { - let script_context = task_from_context(cx); + let page = page_from_context(cx); unsafe { - (*script_context).root_frame.get_ref().window as @mut CacheableWrapper + (*page).frame.get_ref().window as @mut CacheableWrapper } } } |