mirror of
https://github.com/servo/servo.git
synced 2025-10-18 09:19:16 +01:00
add pipeline.rs, modularized pipelines communicating with constellation
This commit is contained in:
parent
fdb0d820a4
commit
fba7ec423c
19 changed files with 528 additions and 317 deletions
|
@ -16,6 +16,7 @@ use std::cast;
|
|||
use std::i32;
|
||||
use std::libc;
|
||||
use std::libc::c_uint;
|
||||
use std::comm;
|
||||
use std::ptr;
|
||||
use std::ptr::null;
|
||||
use std::result;
|
||||
|
@ -229,13 +230,9 @@ extern fn HTMLImageElement_getWidth(cx: *JSContext, _argc: c_uint, vp: *mut JSVa
|
|||
let width = match node.type_id() {
|
||||
ElementNodeTypeId(HTMLImageElementTypeId) => {
|
||||
let script_context = task_from_context(cx);
|
||||
match (*script_context).query_layout(ContentBoxQuery(node)) {
|
||||
Ok(rect) => {
|
||||
match rect {
|
||||
ContentBoxResponse(rect) => rect.size.width.to_px(),
|
||||
_ => fail!(~"unexpected layout reply")
|
||||
}
|
||||
}
|
||||
let (port, chan) = comm::stream();
|
||||
match (*script_context).query_layout(ContentBoxQuery(node, chan), port) {
|
||||
Ok(ContentBoxResponse(rect)) => rect.size.width.to_px(),
|
||||
Err(()) => 0
|
||||
}
|
||||
// TODO: if nothing is being rendered(?), return zero dimensions
|
||||
|
|
|
@ -71,7 +71,7 @@ pub fn _obj_toString(cx: *JSContext, className: *libc::c_char) -> *JSString {
|
|||
return ptr::null();
|
||||
}
|
||||
|
||||
let result = ~"[object " + name + ~"]";
|
||||
let result = ~"[object " + name + "]";
|
||||
for result.iter().enumerate().advance |(i, c)| {
|
||||
*chars.offset(i) = c as jschar;
|
||||
}
|
||||
|
@ -86,4 +86,4 @@ pub fn _obj_toString(cx: *JSContext, className: *libc::c_char) -> *JSString {
|
|||
|
||||
pub fn GetExpandoObject(_proxy: *JSObject) -> *JSObject {
|
||||
ptr::null()
|
||||
}
|
||||
}
|
||||
|
|
|
@ -21,12 +21,12 @@ use js::glue::{PROPERTY_STUB, STRICT_PROPERTY_STUB, ENUMERATE_STUB, CONVERT_STUB
|
|||
use js::jsapi::{JS_AlreadyHasOwnProperty, JS_NewObject, JS_NewFunction};
|
||||
use js::jsapi::{JS_DefineProperties, JS_WrapValue, JS_ForwardGetPropertyTo};
|
||||
use js::jsapi::{JS_EncodeString, JS_free, JS_GetStringCharsAndLength};
|
||||
use js::jsapi::{JS_GetClass, JS_GetPrototype, JS_LinkConstructorAndPrototype};
|
||||
use js::jsapi::{JS_GetClass, JS_LinkConstructorAndPrototype};
|
||||
use js::jsapi::{JS_GetFunctionPrototype, JS_InternString, JS_GetFunctionObject};
|
||||
use js::jsapi::{JS_HasPropertyById, JS_GetPrototype, JS_GetGlobalForObject};
|
||||
use js::jsapi::{JS_NewStringCopyN, JS_DefineFunctions, JS_DefineProperty};
|
||||
use js::jsapi::{JS_ValueToString, JS_GetReservedSlot, JS_SetReservedSlot};
|
||||
use js::jsapi::{JSContext, JSVal, JSObject, JSBool, jsid, JSClass, JSNative};
|
||||
use js::jsapi::{JSContext, JSObject, JSBool, jsid, JSClass, JSNative};
|
||||
use js::jsapi::{JSFunctionSpec, JSPropertySpec, JSVal, JSPropertyDescriptor};
|
||||
use js::jsfriendapi::bindgen::JS_NewObjectWithUniqueType;
|
||||
use js::rust::Compartment;
|
||||
|
@ -83,7 +83,7 @@ extern fn InterfaceObjectToString(cx: *JSContext, _argc: uint, vp: *mut JSVal) -
|
|||
}
|
||||
|
||||
let name = jsval_to_str(cx, *v).get();
|
||||
let retval = str(~"function " + name + ~"() {\n [native code]\n}");
|
||||
let retval = str(~"function " + name + "() {\n [native code]\n}");
|
||||
*vp = domstring_to_jsval(cx, &retval);
|
||||
return 1;
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue