mirror of
https://github.com/servo/servo.git
synced 2025-06-20 07:08:59 +01:00
Rewrite flow construction to be incrementalizable and parallelizable.
This replaces flow construction with a strict bottom-up tree traversal, allowing for parallelism. Each step of the traversal creates a flow or a `ConstructionItem`, similar to how Gecko works. {ib} splits are handled by not creating `InlineFlow`s until the containing block is reached. This should be able to be incrementalized by storing the `Flow` from layout to layout, and performing fixups during flow construction and/or wiping containing blocks in a previous pass.
This commit is contained in:
parent
37f9427b6c
commit
155befe10d
24 changed files with 1259 additions and 889 deletions
|
@ -863,26 +863,38 @@ pub fn CreateDOMGlobal(cx: *JSContext, class: *JSClass) -> *JSObject {
|
|||
}
|
||||
}
|
||||
|
||||
/// Returns the global object of the realm that the given JS object was created in.
|
||||
#[fixed_stack_segment]
|
||||
fn cx_for_dom_reflector(obj: *JSObject) -> *JSContext {
|
||||
fn global_object_for_js_object(obj: *JSObject) -> *Box<window::Window> {
|
||||
unsafe {
|
||||
let global = GetGlobalForObjectCrossCompartment(obj);
|
||||
let clasp = JS_GetClass(global);
|
||||
assert!(((*clasp).flags & (JSCLASS_IS_DOMJSCLASS | JSCLASS_IS_GLOBAL)) != 0);
|
||||
//XXXjdm either don't hardcode or sanity assert prototype stuff
|
||||
let win = unwrap_object::<*Box<window::Window>>(global, PrototypeList::id::Window, 1);
|
||||
match win {
|
||||
Ok(win) => {
|
||||
match (*win).data.page.js_info {
|
||||
Some(ref info) => info.js_context.ptr,
|
||||
None => fail!("no JS context for DOM global")
|
||||
}
|
||||
}
|
||||
Err(_) => fail!("found DOM global that doesn't unwrap to Window")
|
||||
// FIXME(jdm): Either don't hardcode or sanity assert prototype stuff.
|
||||
match unwrap_object::<*Box<window::Window>>(global, PrototypeList::id::Window, 1) {
|
||||
Ok(win) => win,
|
||||
Err(_) => fail!("found DOM global that doesn't unwrap to Window"),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#[fixed_stack_segment]
|
||||
fn cx_for_dom_reflector(obj: *JSObject) -> *JSContext {
|
||||
unsafe {
|
||||
let win = global_object_for_js_object(obj);
|
||||
match (*win).data.page.js_info {
|
||||
Some(ref info) => info.js_context.ptr,
|
||||
None => fail!("no JS context for DOM global")
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// Returns the global object of the realm that the given DOM object was created in.
|
||||
#[fixed_stack_segment]
|
||||
pub fn global_object_for_dom_object<T: Reflectable>(obj: &mut T) -> *Box<window::Window> {
|
||||
global_object_for_js_object(obj.reflector().get_jsobject())
|
||||
}
|
||||
|
||||
pub fn cx_for_dom_object<T: Reflectable>(obj: &mut T) -> *JSContext {
|
||||
cx_for_dom_reflector(obj.reflector().get_jsobject())
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue