structural changes to support Iframes

This commit is contained in:
Tim Kuehn 2013-07-12 20:19:48 -07:00
parent eaa20edcd7
commit e9888b299c
30 changed files with 1416 additions and 835 deletions

View file

@ -7,12 +7,13 @@ use dom::window::Window;
use dom::bindings::codegen::EventBinding;
use dom::bindings::utils::{CacheableWrapper, BindingObject, DerivedWrapper};
use dom::bindings::utils::{DOMString, ErrorResult, WrapperCache};
use script_task::{task_from_context, global_script_context};
use geom::point::Point2D;
use js::glue::RUST_OBJECT_TO_JSVAL;
use js::jsapi::{JSObject, JSContext, JSVal};
use script_task::page_from_context;
use std::cast;
@ -45,12 +46,7 @@ impl Event_ {
}
}
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);
}
@ -131,9 +127,9 @@ impl CacheableWrapper for Event_ {
impl BindingObject for Event_ {
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
}
}
}