mirror of
https://github.com/servo/servo.git
synced 2025-06-24 17:14:33 +01:00
Remove all traces of WindowProxy. Implement basic browser context concept and outerizing of inner windows.
This commit is contained in:
parent
c760577aee
commit
94dffca1e1
24 changed files with 354 additions and 155 deletions
|
@ -6,6 +6,7 @@ use dom::bindings::codegen::WindowBinding;
|
|||
use dom::bindings::js::JS;
|
||||
use dom::bindings::trace::Untraceable;
|
||||
use dom::bindings::utils::{Reflectable, Reflector};
|
||||
use dom::browsercontext::BrowserContext;
|
||||
use dom::document::Document;
|
||||
use dom::element::Element;
|
||||
use dom::eventtarget::{EventTarget, WindowTypeId};
|
||||
|
@ -20,9 +21,8 @@ use servo_net::image_cache_task::ImageCacheTask;
|
|||
use servo_util::str::DOMString;
|
||||
use servo_util::task::{spawn_named};
|
||||
|
||||
use js::jsapi::{JSContext, JS_DefineProperty, JS_PropertyStub, JS_StrictPropertyStub};
|
||||
use js::jsval::{NullValue, ObjectValue, JSVal};
|
||||
use js::JSPROP_ENUMERATE;
|
||||
use js::jsapi::JSContext;
|
||||
use js::jsval::{NullValue, JSVal};
|
||||
|
||||
use collections::hashmap::HashMap;
|
||||
use std::cmp;
|
||||
|
@ -87,6 +87,7 @@ pub struct Window {
|
|||
next_timer_handle: i32,
|
||||
compositor: Untraceable<~ScriptListener>,
|
||||
timer_chan: Untraceable<Sender<TimerControlMsg>>,
|
||||
browser_context: Option<BrowserContext>,
|
||||
page: Rc<Page>,
|
||||
}
|
||||
|
||||
|
@ -290,6 +291,14 @@ impl Window {
|
|||
self.ClearTimeout(handle);
|
||||
}
|
||||
|
||||
pub fn Window(&self, abstract_self: &JS<Window>) -> JS<Window> {
|
||||
abstract_self.clone()
|
||||
}
|
||||
|
||||
pub fn Self(&self, abstract_self: &JS<Window>) -> JS<Window> {
|
||||
self.Window(abstract_self)
|
||||
}
|
||||
|
||||
pub fn damage_and_reflow(&self, damage: DocumentDamageLevel) {
|
||||
// FIXME This should probably be ReflowForQuery, not Display. All queries currently
|
||||
// currently rely on the display list, which means we can't destroy it by
|
||||
|
@ -304,6 +313,10 @@ impl Window {
|
|||
self.page().join_layout();
|
||||
}
|
||||
|
||||
pub fn init_browser_context(&mut self, doc: &JS<Document>) {
|
||||
self.browser_context = Some(BrowserContext::new(doc));
|
||||
}
|
||||
|
||||
pub fn new(cx: *JSContext,
|
||||
page: Rc<Page>,
|
||||
script_chan: ScriptChan,
|
||||
|
@ -335,25 +348,10 @@ impl Window {
|
|||
navigator: None,
|
||||
image_cache_task: image_cache_task,
|
||||
active_timers: ~HashMap::new(),
|
||||
next_timer_handle: 0
|
||||
next_timer_handle: 0,
|
||||
browser_context: None,
|
||||
};
|
||||
|
||||
let global = WindowBinding::Wrap(cx, win);
|
||||
let fn_names = ["window", "self"];
|
||||
for str in fn_names.iter() {
|
||||
(*str).to_c_str().with_ref(|name| {
|
||||
let object = global.reflector().get_jsobject();
|
||||
assert!(object.is_not_null());
|
||||
unsafe {
|
||||
JS_DefineProperty(cx, object, name,
|
||||
ObjectValue(&*object),
|
||||
Some(JS_PropertyStub),
|
||||
Some(JS_StrictPropertyStub),
|
||||
JSPROP_ENUMERATE);
|
||||
}
|
||||
})
|
||||
|
||||
}
|
||||
global
|
||||
WindowBinding::Wrap(cx, win)
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue