mirror of
https://github.com/servo/servo.git
synced 2025-08-05 21:50:18 +01:00
This batch of changes upgrades Servo to work with the Rust upgrade as of
April 10, 2014. The main changes are to privacy, to work around the issues with incorrect bounds on the libstd `Arc<Mutex<T>>`, and the various API changes strewn throughout the libraries.
This commit is contained in:
parent
4942cc76bd
commit
948daf2422
226 changed files with 1478 additions and 1407 deletions
|
@ -21,15 +21,15 @@ pub enum AttrSettingType {
|
|||
|
||||
#[deriving(Encodable)]
|
||||
pub struct Attr {
|
||||
reflector_: Reflector,
|
||||
local_name: DOMString,
|
||||
value: DOMString,
|
||||
name: DOMString,
|
||||
namespace: Namespace,
|
||||
prefix: Option<DOMString>,
|
||||
pub reflector_: Reflector,
|
||||
pub local_name: DOMString,
|
||||
pub value: DOMString,
|
||||
pub name: DOMString,
|
||||
pub namespace: Namespace,
|
||||
pub prefix: Option<DOMString>,
|
||||
|
||||
/// the element that owns this attribute.
|
||||
owner: JS<Element>,
|
||||
pub owner: JS<Element>,
|
||||
}
|
||||
|
||||
impl Reflectable for Attr {
|
||||
|
|
|
@ -11,9 +11,9 @@ use dom::window::Window;
|
|||
|
||||
#[deriving(Encodable)]
|
||||
pub struct AttrList {
|
||||
reflector_: Reflector,
|
||||
window: JS<Window>,
|
||||
owner: JS<Element>,
|
||||
pub reflector_: Reflector,
|
||||
pub window: JS<Window>,
|
||||
pub owner: JS<Element>,
|
||||
}
|
||||
|
||||
impl AttrList {
|
||||
|
|
|
@ -8,8 +8,8 @@ use js::jsapi::{JS_GetProperty, JSTracer, JS_CallTracer};
|
|||
use js::jsval::{JSVal, UndefinedValue};
|
||||
use js::JSTRACE_OBJECT;
|
||||
|
||||
use libc;
|
||||
use std::cast;
|
||||
use std::libc;
|
||||
use std::ptr;
|
||||
|
||||
use serialize::{Encodable, Encoder};
|
||||
|
@ -27,11 +27,11 @@ pub enum ExceptionHandling {
|
|||
|
||||
#[deriving(Clone,Eq)]
|
||||
pub struct CallbackInterface {
|
||||
callback: *JSObject
|
||||
pub callback: *JSObject
|
||||
}
|
||||
|
||||
impl<S: Encoder> Encodable<S> for CallbackInterface {
|
||||
fn encode(&self, s: &mut S) {
|
||||
impl<S: Encoder<E>, E> Encodable<S, E> for CallbackInterface {
|
||||
fn encode(&self, s: &mut S) -> Result<(), E> {
|
||||
unsafe {
|
||||
let tracer: *mut JSTracer = cast::transmute(s);
|
||||
"callback".to_c_str().with_ref(|name| {
|
||||
|
@ -40,7 +40,8 @@ impl<S: Encoder> Encodable<S> for CallbackInterface {
|
|||
(*tracer).debugPrintArg = name as *libc::c_void;
|
||||
JS_CallTracer(tracer as *JSTracer, self.callback, JSTRACE_OBJECT as u32);
|
||||
});
|
||||
}
|
||||
};
|
||||
Ok(())
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -98,8 +99,8 @@ pub fn WrapCallThisObject<T: 'static + CallbackContainer + Reflectable>(cx: *JSC
|
|||
}
|
||||
|
||||
pub struct CallSetup {
|
||||
cx: *JSContext,
|
||||
handling: ExceptionHandling
|
||||
pub cx: *JSContext,
|
||||
pub handling: ExceptionHandling
|
||||
}
|
||||
|
||||
impl CallSetup {
|
||||
|
|
|
@ -1394,7 +1394,7 @@ class CGImports(CGWrapper):
|
|||
'dead_code',
|
||||
]
|
||||
|
||||
statements = ['#[allow(%s)];' % ','.join(ignored_warnings)]
|
||||
statements = ['#![allow(%s)]' % ','.join(ignored_warnings)]
|
||||
statements.extend('use %s;' % i for i in sorted(imports))
|
||||
|
||||
CGWrapper.__init__(self, child,
|
||||
|
@ -4076,11 +4076,11 @@ class CGDictionary(CGThing):
|
|||
def struct(self):
|
||||
d = self.dictionary
|
||||
if d.parent:
|
||||
inheritance = " parent: %s::%s,\n" % (self.makeModuleName(d.parent),
|
||||
inheritance = " pub parent: %s::%s,\n" % (self.makeModuleName(d.parent),
|
||||
self.makeClassName(d.parent))
|
||||
else:
|
||||
inheritance = ""
|
||||
memberDecls = [" %s: %s," %
|
||||
memberDecls = [" pub %s: %s," %
|
||||
(self.makeMemberName(m[0].identifier.name), self.getMemberType(m))
|
||||
for m in self.memberInfo]
|
||||
|
||||
|
@ -4344,11 +4344,11 @@ class CGBindingRoot(CGThing):
|
|||
'dom::bindings::proxyhandler::{_obj_toString, defineProperty}',
|
||||
'dom::bindings::proxyhandler::{FillPropertyDescriptor, GetExpandoObject}',
|
||||
'dom::bindings::proxyhandler::{getPropertyDescriptor}',
|
||||
'libc',
|
||||
'servo_util::str::DOMString',
|
||||
'servo_util::vec::zip_copies',
|
||||
'std::cast',
|
||||
'std::cmp',
|
||||
'std::libc',
|
||||
'std::ptr',
|
||||
'std::slice',
|
||||
'std::str',
|
||||
|
@ -5282,7 +5282,7 @@ class GlobalGenRoots():
|
|||
def InheritTypes(config):
|
||||
|
||||
descriptors = config.getDescriptors(register=True, hasInterfaceObject=True)
|
||||
allprotos = [CGGeneric("#[allow(unused_imports)];\n"),
|
||||
allprotos = [CGGeneric("#![allow(unused_imports)]\n"),
|
||||
CGGeneric("use dom::types::*;\n"),
|
||||
CGGeneric("use dom::bindings::js::JS;\n"),
|
||||
CGGeneric("use dom::bindings::trace::JSTraceable;\n"),
|
||||
|
|
|
@ -18,8 +18,8 @@ use js::jsval::JSVal;
|
|||
use js::jsval::{UndefinedValue, NullValue, BooleanValue, Int32Value, UInt32Value};
|
||||
use js::jsval::{StringValue, ObjectValue};
|
||||
use js::glue::RUST_JS_NumberValue;
|
||||
use libc;
|
||||
use std::default::Default;
|
||||
use std::libc;
|
||||
|
||||
use dom::bindings::codegen::PrototypeList;
|
||||
|
||||
|
|
|
@ -11,7 +11,7 @@ use std::cast;
|
|||
use std::cell::RefCell;
|
||||
|
||||
pub struct JS<T> {
|
||||
priv ptr: RefCell<*mut T>
|
||||
ptr: RefCell<*mut T>
|
||||
}
|
||||
|
||||
impl<T> Eq for JS<T> {
|
||||
|
|
|
@ -13,8 +13,8 @@ use js::glue::{GetObjectProto, GetObjectParent, SetProxyExtra, GetProxyHandler};
|
|||
use js::glue::InvokeGetOwnPropertyDescriptor;
|
||||
use js::{JSPROP_GETTER, JSPROP_ENUMERATE, JSPROP_READONLY, JSRESOLVE_QUALIFIED};
|
||||
|
||||
use libc;
|
||||
use std::cast;
|
||||
use std::libc;
|
||||
use std::ptr;
|
||||
use std::str;
|
||||
use std::mem::size_of;
|
||||
|
|
|
@ -7,9 +7,9 @@ use dom::bindings::utils::{Reflectable, Reflector};
|
|||
|
||||
use js::jsapi::{JSObject, JSTracer, JS_CallTracer, JSTRACE_OBJECT};
|
||||
|
||||
use libc;
|
||||
use std::cast;
|
||||
use std::cell::RefCell;
|
||||
use std::libc;
|
||||
use std::ptr;
|
||||
use std::ptr::null;
|
||||
use serialize::{Encodable, Encoder};
|
||||
|
@ -19,20 +19,22 @@ use serialize::{Encodable, Encoder};
|
|||
// we are unfortunately required to use generic types everywhere and
|
||||
// unsafely cast to the concrete JSTracer we actually require.
|
||||
|
||||
fn get_jstracer<'a, S: Encoder>(s: &'a mut S) -> &'a mut JSTracer {
|
||||
fn get_jstracer<'a, S: Encoder<E>, E>(s: &'a mut S) -> &'a mut JSTracer {
|
||||
unsafe {
|
||||
cast::transmute(s)
|
||||
}
|
||||
}
|
||||
|
||||
impl<T: Reflectable+Encodable<S>, S: Encoder> Encodable<S> for JS<T> {
|
||||
fn encode(&self, s: &mut S) {
|
||||
impl<T: Reflectable+Encodable<S, E>, S: Encoder<E>, E> Encodable<S, E> for JS<T> {
|
||||
fn encode(&self, s: &mut S) -> Result<(), E> {
|
||||
trace_reflector(get_jstracer(s), "", self.reflector());
|
||||
Ok(())
|
||||
}
|
||||
}
|
||||
|
||||
impl<S: Encoder> Encodable<S> for Reflector {
|
||||
fn encode(&self, _s: &mut S) {
|
||||
impl<S: Encoder<E>, E> Encodable<S, E> for Reflector {
|
||||
fn encode(&self, _s: &mut S) -> Result<(), E> {
|
||||
Ok(())
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -61,7 +63,7 @@ pub fn trace_object(tracer: *mut JSTracer, description: &str, obj: *JSObject) {
|
|||
/// Use only with types that are not associated with a JS reflector and do not contain
|
||||
/// fields of types associated with JS reflectors.
|
||||
pub struct Untraceable<T> {
|
||||
priv inner: T,
|
||||
inner: T,
|
||||
}
|
||||
|
||||
impl<T> Untraceable<T> {
|
||||
|
@ -72,8 +74,9 @@ impl<T> Untraceable<T> {
|
|||
}
|
||||
}
|
||||
|
||||
impl<S: Encoder, T> Encodable<S> for Untraceable<T> {
|
||||
fn encode(&self, _s: &mut S) {
|
||||
impl<S: Encoder<E>, E, T> Encodable<S, E> for Untraceable<T> {
|
||||
fn encode(&self, _s: &mut S) -> Result<(), E> {
|
||||
Ok(())
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -93,7 +96,7 @@ impl<T> DerefMut<T> for Untraceable<T> {
|
|||
/// (such as RefCell). Wrap a field in Traceable and implement the Encodable trait
|
||||
/// for that new concrete type to achieve magic compiler-derived trace hooks.
|
||||
pub struct Traceable<T> {
|
||||
priv inner: T
|
||||
inner: T
|
||||
}
|
||||
|
||||
impl<T> Traceable<T> {
|
||||
|
@ -116,14 +119,16 @@ impl<T> DerefMut<T> for Traceable<T> {
|
|||
}
|
||||
}
|
||||
|
||||
impl<S: Encoder, T: Encodable<S>> Encodable<S> for Traceable<RefCell<T>> {
|
||||
fn encode(&self, s: &mut S) {
|
||||
self.borrow().encode(s)
|
||||
impl<S: Encoder<E>, E, T: Encodable<S, E>> Encodable<S, E> for Traceable<RefCell<T>> {
|
||||
fn encode(&self, s: &mut S) -> Result<(), E> {
|
||||
self.borrow().encode(s);
|
||||
Ok(())
|
||||
}
|
||||
}
|
||||
|
||||
impl<S: Encoder> Encodable<S> for Traceable<*JSObject> {
|
||||
fn encode(&self, s: &mut S) {
|
||||
trace_object(get_jstracer(s), "object", **self)
|
||||
impl<S: Encoder<E>, E> Encodable<S, E> for Traceable<*JSObject> {
|
||||
fn encode(&self, s: &mut S) -> Result<(), E> {
|
||||
trace_object(get_jstracer(s), "object", **self);
|
||||
Ok(())
|
||||
}
|
||||
}
|
||||
|
|
|
@ -12,10 +12,10 @@ use dom::window;
|
|||
use servo_util::str::DOMString;
|
||||
|
||||
use collections::hashmap::HashMap;
|
||||
use std::libc::c_uint;
|
||||
use libc;
|
||||
use libc::c_uint;
|
||||
use std::cast;
|
||||
use std::cmp::Eq;
|
||||
use std::libc;
|
||||
use std::ptr;
|
||||
use std::ptr::null;
|
||||
use std::slice;
|
||||
|
@ -49,8 +49,8 @@ use js;
|
|||
|
||||
#[deriving(Encodable)]
|
||||
pub struct GlobalStaticData {
|
||||
proxy_handlers: Untraceable<HashMap<uint, *libc::c_void>>,
|
||||
windowproxy_handler: Untraceable<*libc::c_void>,
|
||||
pub proxy_handlers: Untraceable<HashMap<uint, *libc::c_void>>,
|
||||
pub windowproxy_handler: Untraceable<*libc::c_void>,
|
||||
}
|
||||
|
||||
pub fn GlobalStaticData() -> GlobalStaticData {
|
||||
|
@ -190,19 +190,19 @@ pub enum ConstantVal {
|
|||
|
||||
#[deriving(Clone)]
|
||||
pub struct ConstantSpec {
|
||||
name: *libc::c_char,
|
||||
value: ConstantVal
|
||||
pub name: *libc::c_char,
|
||||
pub value: ConstantVal
|
||||
}
|
||||
|
||||
pub struct DOMClass {
|
||||
// A list of interfaces that this object implements, in order of decreasing
|
||||
// derivedness.
|
||||
interface_chain: [PrototypeList::id::ID, ..MAX_PROTO_CHAIN_LENGTH]
|
||||
pub interface_chain: [PrototypeList::id::ID, ..MAX_PROTO_CHAIN_LENGTH]
|
||||
}
|
||||
|
||||
pub struct DOMJSClass {
|
||||
base: js::Class,
|
||||
dom_class: DOMClass
|
||||
pub base: js::Class,
|
||||
pub dom_class: DOMClass
|
||||
}
|
||||
|
||||
pub fn GetProtoOrIfaceArray(global: *JSObject) -> **JSObject {
|
||||
|
@ -398,7 +398,7 @@ pub fn reflect_dom_object<T: Reflectable>
|
|||
|
||||
#[deriving(Eq)]
|
||||
pub struct Reflector {
|
||||
object: *JSObject,
|
||||
pub object: *JSObject,
|
||||
}
|
||||
|
||||
impl Reflector {
|
||||
|
@ -509,8 +509,8 @@ pub fn FindEnumStringIndex(cx: *JSContext,
|
|||
|
||||
Ok(values.iter().position(|value| {
|
||||
value.len() == length as uint &&
|
||||
range(0, length as int).all(|j| {
|
||||
value[j] as u16 == *chars.offset(j)
|
||||
range(0, length as uint).all(|j| {
|
||||
value[j] as u16 == *chars.offset(j as int)
|
||||
})
|
||||
}))
|
||||
}
|
||||
|
|
|
@ -11,8 +11,8 @@ use servo_util::str::DOMString;
|
|||
|
||||
#[deriving(Encodable)]
|
||||
pub struct Blob {
|
||||
reflector_: Reflector,
|
||||
window: JS<Window>
|
||||
pub reflector_: Reflector,
|
||||
pub window: JS<Window>
|
||||
}
|
||||
|
||||
impl Blob {
|
||||
|
|
|
@ -11,14 +11,14 @@ use dom::window::Window;
|
|||
use js::jsapi::JSObject;
|
||||
use js::glue::{WrapperNew, CreateWrapperProxyHandler, ProxyTraps};
|
||||
|
||||
use std::libc::c_void;
|
||||
use libc::c_void;
|
||||
use std::ptr;
|
||||
|
||||
#[deriving(Encodable)]
|
||||
pub struct BrowserContext {
|
||||
priv history: Vec<SessionHistoryEntry>,
|
||||
priv active_index: uint,
|
||||
priv window_proxy: Traceable<*JSObject>,
|
||||
history: Vec<SessionHistoryEntry>,
|
||||
active_index: uint,
|
||||
window_proxy: Traceable<*JSObject>,
|
||||
}
|
||||
|
||||
impl BrowserContext {
|
||||
|
@ -66,8 +66,8 @@ impl BrowserContext {
|
|||
|
||||
#[deriving(Encodable)]
|
||||
pub struct SessionHistoryEntry {
|
||||
priv document: JS<Document>,
|
||||
priv children: Vec<BrowserContext>
|
||||
document: JS<Document>,
|
||||
children: Vec<BrowserContext>
|
||||
}
|
||||
|
||||
impl SessionHistoryEntry {
|
||||
|
|
|
@ -15,8 +15,8 @@ use servo_util::str::DOMString;
|
|||
|
||||
#[deriving(Encodable)]
|
||||
pub struct CharacterData {
|
||||
node: Node,
|
||||
data: DOMString,
|
||||
pub node: Node,
|
||||
pub data: DOMString,
|
||||
}
|
||||
|
||||
impl CharacterDataDerived for EventTarget {
|
||||
|
|
|
@ -10,12 +10,12 @@ use servo_util::geometry::Au;
|
|||
|
||||
#[deriving(Encodable)]
|
||||
pub struct ClientRect {
|
||||
reflector_: Reflector,
|
||||
top: f32,
|
||||
bottom: f32,
|
||||
left: f32,
|
||||
right: f32,
|
||||
window: JS<Window>,
|
||||
pub reflector_: Reflector,
|
||||
pub top: f32,
|
||||
pub bottom: f32,
|
||||
pub left: f32,
|
||||
pub right: f32,
|
||||
pub window: JS<Window>,
|
||||
}
|
||||
|
||||
impl ClientRect {
|
||||
|
|
|
@ -10,9 +10,9 @@ use dom::window::Window;
|
|||
|
||||
#[deriving(Encodable)]
|
||||
pub struct ClientRectList {
|
||||
reflector_: Reflector,
|
||||
rects: ~[JS<ClientRect>],
|
||||
window: JS<Window>,
|
||||
pub reflector_: Reflector,
|
||||
pub rects: ~[JS<ClientRect>],
|
||||
pub window: JS<Window>,
|
||||
}
|
||||
|
||||
impl ClientRectList {
|
||||
|
@ -37,7 +37,7 @@ impl ClientRectList {
|
|||
|
||||
pub fn Item(&self, index: u32) -> Option<JS<ClientRect>> {
|
||||
if index < self.rects.len() as u32 {
|
||||
Some(self.rects[index].clone())
|
||||
Some(self.rects[index as uint].clone())
|
||||
} else {
|
||||
None
|
||||
}
|
||||
|
|
|
@ -16,7 +16,7 @@ use servo_util::str::DOMString;
|
|||
/// An HTML comment.
|
||||
#[deriving(Encodable)]
|
||||
pub struct Comment {
|
||||
characterdata: CharacterData,
|
||||
pub characterdata: CharacterData,
|
||||
}
|
||||
|
||||
impl CommentDerived for EventTarget {
|
||||
|
|
|
@ -10,7 +10,7 @@ use servo_util::str::DOMString;
|
|||
|
||||
#[deriving(Encodable)]
|
||||
pub struct Console {
|
||||
reflector_: Reflector
|
||||
pub reflector_: Reflector
|
||||
}
|
||||
|
||||
impl Console {
|
||||
|
|
|
@ -55,16 +55,16 @@ pub enum IsHTMLDocument {
|
|||
|
||||
#[deriving(Encodable)]
|
||||
pub struct Document {
|
||||
node: Node,
|
||||
reflector_: Reflector,
|
||||
window: JS<Window>,
|
||||
idmap: HashMap<DOMString, ~[JS<Element>]>,
|
||||
implementation: Option<JS<DOMImplementation>>,
|
||||
content_type: DOMString,
|
||||
encoding_name: DOMString,
|
||||
is_html_document: bool,
|
||||
url: Untraceable<Url>,
|
||||
quirks_mode: Untraceable<QuirksMode>,
|
||||
pub node: Node,
|
||||
pub reflector_: Reflector,
|
||||
pub window: JS<Window>,
|
||||
pub idmap: HashMap<DOMString, ~[JS<Element>]>,
|
||||
pub implementation: Option<JS<DOMImplementation>>,
|
||||
pub content_type: DOMString,
|
||||
pub encoding_name: DOMString,
|
||||
pub is_html_document: bool,
|
||||
pub url: Untraceable<Url>,
|
||||
pub quirks_mode: Untraceable<QuirksMode>,
|
||||
}
|
||||
|
||||
impl DocumentDerived for EventTarget {
|
||||
|
|
|
@ -14,7 +14,7 @@ use dom::window::Window;
|
|||
|
||||
#[deriving(Encodable)]
|
||||
pub struct DocumentFragment {
|
||||
node: Node,
|
||||
pub node: Node,
|
||||
}
|
||||
|
||||
impl DocumentFragmentDerived for EventTarget {
|
||||
|
|
|
@ -13,10 +13,10 @@ use servo_util::str::DOMString;
|
|||
/// The `DOCTYPE` tag.
|
||||
#[deriving(Encodable)]
|
||||
pub struct DocumentType {
|
||||
node: Node,
|
||||
name: DOMString,
|
||||
public_id: DOMString,
|
||||
system_id: DOMString,
|
||||
pub node: Node,
|
||||
pub name: DOMString,
|
||||
pub public_id: DOMString,
|
||||
pub system_id: DOMString,
|
||||
}
|
||||
|
||||
impl DocumentTypeDerived for EventTarget {
|
||||
|
|
|
@ -37,8 +37,8 @@ pub enum DOMErrorName {
|
|||
|
||||
#[deriving(Encodable)]
|
||||
pub struct DOMException {
|
||||
code: DOMErrorName,
|
||||
reflector_: Reflector
|
||||
pub code: DOMErrorName,
|
||||
pub reflector_: Reflector
|
||||
}
|
||||
|
||||
impl DOMException {
|
||||
|
|
|
@ -21,8 +21,8 @@ use servo_util::str::DOMString;
|
|||
|
||||
#[deriving(Encodable)]
|
||||
pub struct DOMImplementation {
|
||||
owner: JS<Window>,
|
||||
reflector_: Reflector,
|
||||
pub owner: JS<Window>,
|
||||
pub reflector_: Reflector,
|
||||
}
|
||||
|
||||
impl DOMImplementation {
|
||||
|
|
|
@ -13,8 +13,8 @@ use servo_util::str::DOMString;
|
|||
|
||||
#[deriving(Encodable)]
|
||||
pub struct DOMParser {
|
||||
owner: JS<Window>, //XXXjdm Document instead?
|
||||
reflector_: Reflector
|
||||
pub owner: JS<Window>, //XXXjdm Document instead?
|
||||
pub reflector_: Reflector
|
||||
}
|
||||
|
||||
impl DOMParser {
|
||||
|
|
|
@ -32,13 +32,13 @@ use std::cast;
|
|||
|
||||
#[deriving(Encodable)]
|
||||
pub struct Element {
|
||||
node: Node,
|
||||
local_name: DOMString, // TODO: This should be an atom, not a DOMString.
|
||||
namespace: Namespace,
|
||||
prefix: Option<DOMString>,
|
||||
attrs: ~[JS<Attr>],
|
||||
style_attribute: Option<style::PropertyDeclarationBlock>,
|
||||
attr_list: Option<JS<AttrList>>
|
||||
pub node: Node,
|
||||
pub local_name: DOMString, // TODO: This should be an atom, not a DOMString.
|
||||
pub namespace: Namespace,
|
||||
pub prefix: Option<DOMString>,
|
||||
pub attrs: ~[JS<Attr>],
|
||||
pub style_attribute: Option<style::PropertyDeclarationBlock>,
|
||||
pub attr_list: Option<JS<AttrList>>
|
||||
}
|
||||
|
||||
impl ElementDerived for EventTarget {
|
||||
|
@ -605,14 +605,14 @@ impl Element {
|
|||
let win = &doc.get().window;
|
||||
let node: JS<Node> = NodeCast::from(abstract_self);
|
||||
let rects = node.get_content_boxes();
|
||||
let rects = rects.map(|r| {
|
||||
let rects = rects.iter().map(|r| {
|
||||
ClientRect::new(
|
||||
win,
|
||||
r.origin.y,
|
||||
r.origin.y + r.size.height,
|
||||
r.origin.x,
|
||||
r.origin.x + r.size.width)
|
||||
});
|
||||
}).collect();
|
||||
|
||||
ClientRectList::new(win, rects)
|
||||
}
|
||||
|
|
|
@ -40,20 +40,20 @@ pub enum EventTypeId {
|
|||
|
||||
#[deriving(Encodable)]
|
||||
pub struct Event {
|
||||
type_id: EventTypeId,
|
||||
reflector_: Reflector,
|
||||
current_target: Option<JS<EventTarget>>,
|
||||
target: Option<JS<EventTarget>>,
|
||||
type_: DOMString,
|
||||
phase: EventPhase,
|
||||
canceled: bool,
|
||||
stop_propagation: bool,
|
||||
stop_immediate: bool,
|
||||
cancelable: bool,
|
||||
bubbles: bool,
|
||||
trusted: bool,
|
||||
dispatching: bool,
|
||||
initialized: bool,
|
||||
pub type_id: EventTypeId,
|
||||
pub reflector_: Reflector,
|
||||
pub current_target: Option<JS<EventTarget>>,
|
||||
pub target: Option<JS<EventTarget>>,
|
||||
pub type_: DOMString,
|
||||
pub phase: EventPhase,
|
||||
pub canceled: bool,
|
||||
pub stop_propagation: bool,
|
||||
pub stop_immediate: bool,
|
||||
pub cancelable: bool,
|
||||
pub bubbles: bool,
|
||||
pub trusted: bool,
|
||||
pub dispatching: bool,
|
||||
pub initialized: bool,
|
||||
}
|
||||
|
||||
impl Event {
|
||||
|
|
|
@ -29,15 +29,15 @@ pub enum EventTargetTypeId {
|
|||
|
||||
#[deriving(Eq,Encodable)]
|
||||
pub struct EventListenerEntry {
|
||||
phase: ListenerPhase,
|
||||
listener: EventListener
|
||||
pub phase: ListenerPhase,
|
||||
pub listener: EventListener
|
||||
}
|
||||
|
||||
#[deriving(Encodable)]
|
||||
pub struct EventTarget {
|
||||
type_id: EventTargetTypeId,
|
||||
reflector_: Reflector,
|
||||
handlers: HashMap<DOMString, ~[EventListenerEntry]>,
|
||||
pub type_id: EventTargetTypeId,
|
||||
pub reflector_: Reflector,
|
||||
pub handlers: HashMap<DOMString, ~[EventListenerEntry]>,
|
||||
}
|
||||
|
||||
impl EventTarget {
|
||||
|
|
|
@ -21,10 +21,10 @@ pub enum FormDatum {
|
|||
|
||||
#[deriving(Encodable)]
|
||||
pub struct FormData {
|
||||
data: HashMap<DOMString, FormDatum>,
|
||||
reflector_: Reflector,
|
||||
window: JS<Window>,
|
||||
form: Option<JS<HTMLFormElement>>
|
||||
pub data: HashMap<DOMString, FormDatum>,
|
||||
pub reflector_: Reflector,
|
||||
pub window: JS<Window>,
|
||||
pub form: Option<JS<HTMLFormElement>>
|
||||
}
|
||||
|
||||
impl FormData {
|
||||
|
|
|
@ -15,7 +15,7 @@ use servo_util::str::DOMString;
|
|||
|
||||
#[deriving(Encodable)]
|
||||
pub struct HTMLAnchorElement {
|
||||
htmlelement: HTMLElement
|
||||
pub htmlelement: HTMLElement
|
||||
}
|
||||
|
||||
impl HTMLAnchorElementDerived for EventTarget {
|
||||
|
|
|
@ -15,7 +15,7 @@ use servo_util::str::DOMString;
|
|||
|
||||
#[deriving(Encodable)]
|
||||
pub struct HTMLAppletElement {
|
||||
htmlelement: HTMLElement
|
||||
pub htmlelement: HTMLElement
|
||||
}
|
||||
|
||||
impl HTMLAppletElementDerived for EventTarget {
|
||||
|
|
|
@ -15,7 +15,7 @@ use servo_util::str::DOMString;
|
|||
|
||||
#[deriving(Encodable)]
|
||||
pub struct HTMLAreaElement {
|
||||
htmlelement: HTMLElement
|
||||
pub htmlelement: HTMLElement
|
||||
}
|
||||
|
||||
impl HTMLAreaElementDerived for EventTarget {
|
||||
|
|
|
@ -14,7 +14,7 @@ use servo_util::str::DOMString;
|
|||
|
||||
#[deriving(Encodable)]
|
||||
pub struct HTMLAudioElement {
|
||||
htmlmediaelement: HTMLMediaElement
|
||||
pub htmlmediaelement: HTMLMediaElement
|
||||
}
|
||||
|
||||
impl HTMLAudioElementDerived for EventTarget {
|
||||
|
|
|
@ -15,7 +15,7 @@ use servo_util::str::DOMString;
|
|||
|
||||
#[deriving(Encodable)]
|
||||
pub struct HTMLBaseElement {
|
||||
htmlelement: HTMLElement
|
||||
pub htmlelement: HTMLElement
|
||||
}
|
||||
|
||||
impl HTMLBaseElementDerived for EventTarget {
|
||||
|
|
|
@ -15,7 +15,7 @@ use servo_util::str::DOMString;
|
|||
|
||||
#[deriving(Encodable)]
|
||||
pub struct HTMLBodyElement {
|
||||
htmlelement: HTMLElement
|
||||
pub htmlelement: HTMLElement
|
||||
}
|
||||
|
||||
impl HTMLBodyElementDerived for EventTarget {
|
||||
|
|
|
@ -15,7 +15,7 @@ use servo_util::str::DOMString;
|
|||
|
||||
#[deriving(Encodable)]
|
||||
pub struct HTMLBRElement {
|
||||
htmlelement: HTMLElement,
|
||||
pub htmlelement: HTMLElement,
|
||||
}
|
||||
|
||||
impl HTMLBRElementDerived for EventTarget {
|
||||
|
|
|
@ -17,7 +17,7 @@ use servo_util::str::DOMString;
|
|||
|
||||
#[deriving(Encodable)]
|
||||
pub struct HTMLButtonElement {
|
||||
htmlelement: HTMLElement
|
||||
pub htmlelement: HTMLElement
|
||||
}
|
||||
|
||||
impl HTMLButtonElementDerived for EventTarget {
|
||||
|
|
|
@ -15,7 +15,7 @@ use servo_util::str::DOMString;
|
|||
|
||||
#[deriving(Encodable)]
|
||||
pub struct HTMLCanvasElement {
|
||||
htmlelement: HTMLElement,
|
||||
pub htmlelement: HTMLElement,
|
||||
}
|
||||
|
||||
impl HTMLCanvasElementDerived for EventTarget {
|
||||
|
|
|
@ -18,8 +18,10 @@ pub trait CollectionFilter {
|
|||
fn filter(&self, elem: &JS<Element>, root: &JS<Node>) -> bool;
|
||||
}
|
||||
|
||||
impl<S: Encoder> Encodable<S> for ~CollectionFilter {
|
||||
fn encode(&self, _s: &mut S) {}
|
||||
impl<S: Encoder<E>, E> Encodable<S, E> for ~CollectionFilter {
|
||||
fn encode(&self, _s: &mut S) -> Result<(), E> {
|
||||
Ok(())
|
||||
}
|
||||
}
|
||||
|
||||
#[deriving(Encodable)]
|
||||
|
@ -30,9 +32,9 @@ pub enum CollectionTypeId {
|
|||
|
||||
#[deriving(Encodable)]
|
||||
pub struct HTMLCollection {
|
||||
collection: CollectionTypeId,
|
||||
reflector_: Reflector,
|
||||
window: JS<Window>,
|
||||
pub collection: CollectionTypeId,
|
||||
pub reflector_: Reflector,
|
||||
pub window: JS<Window>,
|
||||
}
|
||||
|
||||
impl HTMLCollection {
|
||||
|
@ -100,7 +102,7 @@ impl HTMLCollection {
|
|||
}
|
||||
}
|
||||
let filter = ClassNameFilter {
|
||||
classes: split_html_space_chars(classes).map(|class| class.into_owned()).to_owned_vec()
|
||||
classes: split_html_space_chars(classes).map(|class| class.into_owned()).collect()
|
||||
};
|
||||
HTMLCollection::create(window, root, ~filter)
|
||||
}
|
||||
|
|
|
@ -15,7 +15,7 @@ use servo_util::str::DOMString;
|
|||
|
||||
#[deriving(Encodable)]
|
||||
pub struct HTMLDataElement {
|
||||
htmlelement: HTMLElement
|
||||
pub htmlelement: HTMLElement
|
||||
}
|
||||
|
||||
impl HTMLDataElementDerived for EventTarget {
|
||||
|
|
|
@ -15,7 +15,7 @@ use servo_util::str::DOMString;
|
|||
|
||||
#[deriving(Encodable)]
|
||||
pub struct HTMLDataListElement {
|
||||
htmlelement: HTMLElement
|
||||
pub htmlelement: HTMLElement
|
||||
}
|
||||
|
||||
impl HTMLDataListElementDerived for EventTarget {
|
||||
|
|
|
@ -15,7 +15,7 @@ use servo_util::str::DOMString;
|
|||
|
||||
#[deriving(Encodable)]
|
||||
pub struct HTMLDirectoryElement {
|
||||
htmlelement: HTMLElement
|
||||
pub htmlelement: HTMLElement
|
||||
}
|
||||
|
||||
impl HTMLDirectoryElementDerived for EventTarget {
|
||||
|
|
|
@ -15,7 +15,7 @@ use servo_util::str::DOMString;
|
|||
|
||||
#[deriving(Encodable)]
|
||||
pub struct HTMLDivElement {
|
||||
htmlelement: HTMLElement
|
||||
pub htmlelement: HTMLElement
|
||||
}
|
||||
|
||||
impl HTMLDivElementDerived for EventTarget {
|
||||
|
|
|
@ -15,7 +15,7 @@ use servo_util::str::DOMString;
|
|||
|
||||
#[deriving(Encodable)]
|
||||
pub struct HTMLDListElement {
|
||||
htmlelement: HTMLElement
|
||||
pub htmlelement: HTMLElement
|
||||
}
|
||||
|
||||
impl HTMLDListElementDerived for EventTarget {
|
||||
|
|
|
@ -19,7 +19,7 @@ use servo_util::str::DOMString;
|
|||
|
||||
#[deriving(Encodable)]
|
||||
pub struct HTMLElement {
|
||||
element: Element
|
||||
pub element: Element
|
||||
}
|
||||
|
||||
impl HTMLElementDerived for EventTarget {
|
||||
|
|
|
@ -15,7 +15,7 @@ use servo_util::str::DOMString;
|
|||
|
||||
#[deriving(Encodable)]
|
||||
pub struct HTMLEmbedElement {
|
||||
htmlelement: HTMLElement
|
||||
pub htmlelement: HTMLElement
|
||||
}
|
||||
|
||||
impl HTMLEmbedElementDerived for EventTarget {
|
||||
|
|
|
@ -18,7 +18,7 @@ use servo_util::str::{DOMString, StaticStringVec};
|
|||
|
||||
#[deriving(Encodable)]
|
||||
pub struct HTMLFieldSetElement {
|
||||
htmlelement: HTMLElement
|
||||
pub htmlelement: HTMLElement
|
||||
}
|
||||
|
||||
impl HTMLFieldSetElementDerived for EventTarget {
|
||||
|
|
|
@ -15,7 +15,7 @@ use servo_util::str::DOMString;
|
|||
|
||||
#[deriving(Encodable)]
|
||||
pub struct HTMLFontElement {
|
||||
htmlelement: HTMLElement
|
||||
pub htmlelement: HTMLElement
|
||||
}
|
||||
|
||||
impl HTMLFontElementDerived for EventTarget {
|
||||
|
|
|
@ -16,7 +16,7 @@ use servo_util::str::DOMString;
|
|||
|
||||
#[deriving(Encodable)]
|
||||
pub struct HTMLFormElement {
|
||||
htmlelement: HTMLElement
|
||||
pub htmlelement: HTMLElement
|
||||
}
|
||||
|
||||
impl HTMLFormElementDerived for EventTarget {
|
||||
|
|
|
@ -16,7 +16,7 @@ use servo_util::str::DOMString;
|
|||
|
||||
#[deriving(Encodable)]
|
||||
pub struct HTMLFrameElement {
|
||||
htmlelement: HTMLElement
|
||||
pub htmlelement: HTMLElement
|
||||
}
|
||||
|
||||
impl HTMLFrameElementDerived for EventTarget {
|
||||
|
|
|
@ -15,7 +15,7 @@ use servo_util::str::DOMString;
|
|||
|
||||
#[deriving(Encodable)]
|
||||
pub struct HTMLFrameSetElement {
|
||||
htmlelement: HTMLElement
|
||||
pub htmlelement: HTMLElement
|
||||
}
|
||||
|
||||
impl HTMLFrameSetElementDerived for EventTarget {
|
||||
|
|
|
@ -14,7 +14,7 @@ use servo_util::str::DOMString;
|
|||
|
||||
#[deriving(Encodable)]
|
||||
pub struct HTMLHeadElement {
|
||||
htmlelement: HTMLElement
|
||||
pub htmlelement: HTMLElement
|
||||
}
|
||||
|
||||
impl HTMLHeadElementDerived for EventTarget {
|
||||
|
|
|
@ -24,8 +24,8 @@ pub enum HeadingLevel {
|
|||
|
||||
#[deriving(Encodable)]
|
||||
pub struct HTMLHeadingElement {
|
||||
htmlelement: HTMLElement,
|
||||
level: HeadingLevel,
|
||||
pub htmlelement: HTMLElement,
|
||||
pub level: HeadingLevel,
|
||||
}
|
||||
|
||||
impl HTMLHeadingElementDerived for EventTarget {
|
||||
|
|
|
@ -15,7 +15,7 @@ use servo_util::str::DOMString;
|
|||
|
||||
#[deriving(Encodable)]
|
||||
pub struct HTMLHRElement {
|
||||
htmlelement: HTMLElement,
|
||||
pub htmlelement: HTMLElement,
|
||||
}
|
||||
|
||||
impl HTMLHRElementDerived for EventTarget {
|
||||
|
|
|
@ -15,7 +15,7 @@ use servo_util::str::DOMString;
|
|||
|
||||
#[deriving(Encodable)]
|
||||
pub struct HTMLHtmlElement {
|
||||
htmlelement: HTMLElement
|
||||
pub htmlelement: HTMLElement
|
||||
}
|
||||
|
||||
impl HTMLHtmlElementDerived for EventTarget {
|
||||
|
|
|
@ -33,10 +33,10 @@ enum SandboxAllowance {
|
|||
|
||||
#[deriving(Encodable)]
|
||||
pub struct HTMLIFrameElement {
|
||||
htmlelement: HTMLElement,
|
||||
pub htmlelement: HTMLElement,
|
||||
frame: Untraceable<Option<Url>>,
|
||||
size: Option<IFrameSize>,
|
||||
sandbox: Option<u8>
|
||||
pub size: Option<IFrameSize>,
|
||||
pub sandbox: Option<u8>
|
||||
}
|
||||
|
||||
impl HTMLIFrameElementDerived for EventTarget {
|
||||
|
@ -50,8 +50,8 @@ impl HTMLIFrameElementDerived for EventTarget {
|
|||
|
||||
#[deriving(Encodable)]
|
||||
pub struct IFrameSize {
|
||||
pipeline_id: PipelineId,
|
||||
subpage_id: SubpageId,
|
||||
pub pipeline_id: PipelineId,
|
||||
pub subpage_id: SubpageId,
|
||||
}
|
||||
|
||||
impl HTMLIFrameElement {
|
||||
|
|
|
@ -23,7 +23,7 @@ use url::Url;
|
|||
|
||||
#[deriving(Encodable)]
|
||||
pub struct HTMLImageElement {
|
||||
htmlelement: HTMLElement,
|
||||
pub htmlelement: HTMLElement,
|
||||
image: Untraceable<Option<Url>>,
|
||||
}
|
||||
|
||||
|
|
|
@ -15,7 +15,7 @@ use servo_util::str::DOMString;
|
|||
|
||||
#[deriving(Encodable)]
|
||||
pub struct HTMLInputElement {
|
||||
htmlelement: HTMLElement,
|
||||
pub htmlelement: HTMLElement,
|
||||
}
|
||||
|
||||
impl HTMLInputElementDerived for EventTarget {
|
||||
|
|
|
@ -14,7 +14,7 @@ use servo_util::str::DOMString;
|
|||
|
||||
#[deriving(Encodable)]
|
||||
pub struct HTMLLabelElement {
|
||||
htmlelement: HTMLElement,
|
||||
pub htmlelement: HTMLElement,
|
||||
}
|
||||
|
||||
impl HTMLLabelElementDerived for EventTarget {
|
||||
|
|
|
@ -15,7 +15,7 @@ use servo_util::str::DOMString;
|
|||
|
||||
#[deriving(Encodable)]
|
||||
pub struct HTMLLegendElement {
|
||||
htmlelement: HTMLElement,
|
||||
pub htmlelement: HTMLElement,
|
||||
}
|
||||
|
||||
impl HTMLLegendElementDerived for EventTarget {
|
||||
|
|
|
@ -15,7 +15,7 @@ use servo_util::str::DOMString;
|
|||
|
||||
#[deriving(Encodable)]
|
||||
pub struct HTMLLIElement {
|
||||
htmlelement: HTMLElement,
|
||||
pub htmlelement: HTMLElement,
|
||||
}
|
||||
|
||||
impl HTMLLIElementDerived for EventTarget {
|
||||
|
|
|
@ -15,7 +15,7 @@ use servo_util::str::DOMString;
|
|||
|
||||
#[deriving(Encodable)]
|
||||
pub struct HTMLLinkElement {
|
||||
htmlelement: HTMLElement,
|
||||
pub htmlelement: HTMLElement,
|
||||
}
|
||||
|
||||
impl HTMLLinkElementDerived for EventTarget {
|
||||
|
|
|
@ -14,7 +14,7 @@ use servo_util::str::DOMString;
|
|||
|
||||
#[deriving(Encodable)]
|
||||
pub struct HTMLMainElement {
|
||||
htmlelement: HTMLElement
|
||||
pub htmlelement: HTMLElement
|
||||
}
|
||||
|
||||
impl HTMLMainElementDerived for EventTarget {
|
||||
|
|
|
@ -16,7 +16,7 @@ use servo_util::str::DOMString;
|
|||
|
||||
#[deriving(Encodable)]
|
||||
pub struct HTMLMapElement {
|
||||
htmlelement: HTMLElement
|
||||
pub htmlelement: HTMLElement
|
||||
}
|
||||
|
||||
impl HTMLMapElementDerived for EventTarget {
|
||||
|
|
|
@ -14,7 +14,7 @@ use servo_util::str::DOMString;
|
|||
|
||||
#[deriving(Encodable)]
|
||||
pub struct HTMLMediaElement {
|
||||
htmlelement: HTMLElement,
|
||||
pub htmlelement: HTMLElement,
|
||||
}
|
||||
|
||||
impl HTMLMediaElementDerived for EventTarget {
|
||||
|
|
|
@ -15,7 +15,7 @@ use servo_util::str::DOMString;
|
|||
|
||||
#[deriving(Encodable)]
|
||||
pub struct HTMLMetaElement {
|
||||
htmlelement: HTMLElement,
|
||||
pub htmlelement: HTMLElement,
|
||||
}
|
||||
|
||||
impl HTMLMetaElementDerived for EventTarget {
|
||||
|
|
|
@ -15,7 +15,7 @@ use servo_util::str::DOMString;
|
|||
|
||||
#[deriving(Encodable)]
|
||||
pub struct HTMLMeterElement {
|
||||
htmlelement: HTMLElement
|
||||
pub htmlelement: HTMLElement
|
||||
}
|
||||
|
||||
impl HTMLMeterElementDerived for EventTarget {
|
||||
|
|
|
@ -15,7 +15,7 @@ use servo_util::str::DOMString;
|
|||
|
||||
#[deriving(Encodable)]
|
||||
pub struct HTMLModElement {
|
||||
htmlelement: HTMLElement
|
||||
pub htmlelement: HTMLElement
|
||||
}
|
||||
|
||||
impl HTMLModElementDerived for EventTarget {
|
||||
|
|
|
@ -28,7 +28,7 @@ use url::Url;
|
|||
|
||||
#[deriving(Encodable)]
|
||||
pub struct HTMLObjectElement {
|
||||
htmlelement: HTMLElement,
|
||||
pub htmlelement: HTMLElement,
|
||||
}
|
||||
|
||||
impl HTMLObjectElementDerived for EventTarget {
|
||||
|
|
|
@ -15,7 +15,7 @@ use servo_util::str::DOMString;
|
|||
|
||||
#[deriving(Encodable)]
|
||||
pub struct HTMLOListElement {
|
||||
htmlelement: HTMLElement,
|
||||
pub htmlelement: HTMLElement,
|
||||
}
|
||||
|
||||
impl HTMLOListElementDerived for EventTarget {
|
||||
|
|
|
@ -15,7 +15,7 @@ use servo_util::str::DOMString;
|
|||
|
||||
#[deriving(Encodable)]
|
||||
pub struct HTMLOptGroupElement {
|
||||
htmlelement: HTMLElement
|
||||
pub htmlelement: HTMLElement
|
||||
}
|
||||
|
||||
impl HTMLOptGroupElementDerived for EventTarget {
|
||||
|
|
|
@ -16,7 +16,7 @@ use servo_util::str::DOMString;
|
|||
|
||||
#[deriving(Encodable)]
|
||||
pub struct HTMLOptionElement {
|
||||
htmlelement: HTMLElement
|
||||
pub htmlelement: HTMLElement
|
||||
}
|
||||
|
||||
impl HTMLOptionElementDerived for EventTarget {
|
||||
|
|
|
@ -17,7 +17,7 @@ use servo_util::str::DOMString;
|
|||
|
||||
#[deriving(Encodable)]
|
||||
pub struct HTMLOutputElement {
|
||||
htmlelement: HTMLElement
|
||||
pub htmlelement: HTMLElement
|
||||
}
|
||||
|
||||
impl HTMLOutputElementDerived for EventTarget {
|
||||
|
|
|
@ -15,7 +15,7 @@ use servo_util::str::DOMString;
|
|||
|
||||
#[deriving(Encodable)]
|
||||
pub struct HTMLParagraphElement {
|
||||
htmlelement: HTMLElement
|
||||
pub htmlelement: HTMLElement
|
||||
}
|
||||
|
||||
impl HTMLParagraphElementDerived for EventTarget {
|
||||
|
|
|
@ -15,7 +15,7 @@ use servo_util::str::DOMString;
|
|||
|
||||
#[deriving(Encodable)]
|
||||
pub struct HTMLParamElement {
|
||||
htmlelement: HTMLElement
|
||||
pub htmlelement: HTMLElement
|
||||
}
|
||||
|
||||
impl HTMLParamElementDerived for EventTarget {
|
||||
|
|
|
@ -15,7 +15,7 @@ use servo_util::str::DOMString;
|
|||
|
||||
#[deriving(Encodable)]
|
||||
pub struct HTMLPreElement {
|
||||
htmlelement: HTMLElement,
|
||||
pub htmlelement: HTMLElement,
|
||||
}
|
||||
|
||||
impl HTMLPreElementDerived for EventTarget {
|
||||
|
|
|
@ -15,7 +15,7 @@ use servo_util::str::DOMString;
|
|||
|
||||
#[deriving(Encodable)]
|
||||
pub struct HTMLProgressElement {
|
||||
htmlelement: HTMLElement,
|
||||
pub htmlelement: HTMLElement,
|
||||
}
|
||||
|
||||
impl HTMLProgressElementDerived for EventTarget {
|
||||
|
|
|
@ -15,7 +15,7 @@ use servo_util::str::DOMString;
|
|||
|
||||
#[deriving(Encodable)]
|
||||
pub struct HTMLQuoteElement {
|
||||
htmlelement: HTMLElement,
|
||||
pub htmlelement: HTMLElement,
|
||||
}
|
||||
|
||||
impl HTMLQuoteElementDerived for EventTarget {
|
||||
|
|
|
@ -16,7 +16,7 @@ use servo_util::str::DOMString;
|
|||
|
||||
#[deriving(Encodable)]
|
||||
pub struct HTMLScriptElement {
|
||||
htmlelement: HTMLElement,
|
||||
pub htmlelement: HTMLElement,
|
||||
}
|
||||
|
||||
impl HTMLScriptElementDerived for EventTarget {
|
||||
|
|
|
@ -19,7 +19,7 @@ use servo_util::str::DOMString;
|
|||
|
||||
#[deriving(Encodable)]
|
||||
pub struct HTMLSelectElement {
|
||||
htmlelement: HTMLElement
|
||||
pub htmlelement: HTMLElement
|
||||
}
|
||||
|
||||
impl HTMLSelectElementDerived for EventTarget {
|
||||
|
|
|
@ -15,7 +15,7 @@ use servo_util::str::DOMString;
|
|||
|
||||
#[deriving(Encodable)]
|
||||
pub struct HTMLSourceElement {
|
||||
htmlelement: HTMLElement
|
||||
pub htmlelement: HTMLElement
|
||||
}
|
||||
|
||||
impl HTMLSourceElementDerived for EventTarget {
|
||||
|
|
|
@ -14,7 +14,7 @@ use servo_util::str::DOMString;
|
|||
|
||||
#[deriving(Encodable)]
|
||||
pub struct HTMLSpanElement {
|
||||
htmlelement: HTMLElement
|
||||
pub htmlelement: HTMLElement
|
||||
}
|
||||
|
||||
impl HTMLSpanElementDerived for EventTarget {
|
||||
|
|
|
@ -18,7 +18,7 @@ use servo_util::str::DOMString;
|
|||
|
||||
#[deriving(Encodable)]
|
||||
pub struct HTMLStyleElement {
|
||||
htmlelement: HTMLElement,
|
||||
pub htmlelement: HTMLElement,
|
||||
}
|
||||
|
||||
impl HTMLStyleElementDerived for EventTarget {
|
||||
|
|
|
@ -15,7 +15,7 @@ use servo_util::str::DOMString;
|
|||
|
||||
#[deriving(Encodable)]
|
||||
pub struct HTMLTableCaptionElement {
|
||||
htmlelement: HTMLElement
|
||||
pub htmlelement: HTMLElement
|
||||
}
|
||||
|
||||
impl HTMLTableCaptionElementDerived for EventTarget {
|
||||
|
|
|
@ -14,7 +14,7 @@ use servo_util::str::DOMString;
|
|||
|
||||
#[deriving(Encodable)]
|
||||
pub struct HTMLTableCellElement {
|
||||
htmlelement: HTMLElement,
|
||||
pub htmlelement: HTMLElement,
|
||||
}
|
||||
|
||||
impl HTMLTableCellElementDerived for EventTarget {
|
||||
|
|
|
@ -15,7 +15,7 @@ use servo_util::str::DOMString;
|
|||
|
||||
#[deriving(Encodable)]
|
||||
pub struct HTMLTableColElement {
|
||||
htmlelement: HTMLElement,
|
||||
pub htmlelement: HTMLElement,
|
||||
}
|
||||
|
||||
impl HTMLTableColElementDerived for EventTarget {
|
||||
|
|
|
@ -14,7 +14,7 @@ use servo_util::str::DOMString;
|
|||
|
||||
#[deriving(Encodable)]
|
||||
pub struct HTMLTableDataCellElement {
|
||||
htmltablecellelement: HTMLTableCellElement,
|
||||
pub htmltablecellelement: HTMLTableCellElement,
|
||||
}
|
||||
|
||||
impl HTMLTableDataCellElementDerived for EventTarget {
|
||||
|
|
|
@ -15,7 +15,7 @@ use servo_util::str::DOMString;
|
|||
|
||||
#[deriving(Encodable)]
|
||||
pub struct HTMLTableElement {
|
||||
htmlelement: HTMLElement,
|
||||
pub htmlelement: HTMLElement,
|
||||
}
|
||||
|
||||
impl HTMLTableElementDerived for EventTarget {
|
||||
|
|
|
@ -14,7 +14,7 @@ use servo_util::str::DOMString;
|
|||
|
||||
#[deriving(Encodable)]
|
||||
pub struct HTMLTableHeaderCellElement {
|
||||
htmltablecellelement: HTMLTableCellElement,
|
||||
pub htmltablecellelement: HTMLTableCellElement,
|
||||
}
|
||||
|
||||
impl HTMLTableHeaderCellElementDerived for EventTarget {
|
||||
|
|
|
@ -15,7 +15,7 @@ use servo_util::str::DOMString;
|
|||
|
||||
#[deriving(Encodable)]
|
||||
pub struct HTMLTableRowElement {
|
||||
htmlelement: HTMLElement,
|
||||
pub htmlelement: HTMLElement,
|
||||
}
|
||||
|
||||
impl HTMLTableRowElementDerived for EventTarget {
|
||||
|
|
|
@ -15,7 +15,7 @@ use servo_util::str::DOMString;
|
|||
|
||||
#[deriving(Encodable)]
|
||||
pub struct HTMLTableSectionElement {
|
||||
htmlelement: HTMLElement,
|
||||
pub htmlelement: HTMLElement,
|
||||
}
|
||||
|
||||
impl HTMLTableSectionElementDerived for EventTarget {
|
||||
|
|
|
@ -14,7 +14,7 @@ use servo_util::str::DOMString;
|
|||
|
||||
#[deriving(Encodable)]
|
||||
pub struct HTMLTemplateElement {
|
||||
htmlelement: HTMLElement,
|
||||
pub htmlelement: HTMLElement,
|
||||
}
|
||||
|
||||
impl HTMLTemplateElementDerived for EventTarget {
|
||||
|
|
|
@ -15,7 +15,7 @@ use servo_util::str::DOMString;
|
|||
|
||||
#[deriving(Encodable)]
|
||||
pub struct HTMLTextAreaElement {
|
||||
htmlelement: HTMLElement,
|
||||
pub htmlelement: HTMLElement,
|
||||
}
|
||||
|
||||
impl HTMLTextAreaElementDerived for EventTarget {
|
||||
|
|
|
@ -15,7 +15,7 @@ use servo_util::str::DOMString;
|
|||
|
||||
#[deriving(Encodable)]
|
||||
pub struct HTMLTimeElement {
|
||||
htmlelement: HTMLElement
|
||||
pub htmlelement: HTMLElement
|
||||
}
|
||||
|
||||
impl HTMLTimeElementDerived for EventTarget {
|
||||
|
|
|
@ -15,7 +15,7 @@ use servo_util::str::DOMString;
|
|||
|
||||
#[deriving(Encodable)]
|
||||
pub struct HTMLTitleElement {
|
||||
htmlelement: HTMLElement,
|
||||
pub htmlelement: HTMLElement,
|
||||
}
|
||||
|
||||
impl HTMLTitleElementDerived for EventTarget {
|
||||
|
|
|
@ -15,7 +15,7 @@ use servo_util::str::DOMString;
|
|||
|
||||
#[deriving(Encodable)]
|
||||
pub struct HTMLTrackElement {
|
||||
htmlelement: HTMLElement,
|
||||
pub htmlelement: HTMLElement,
|
||||
}
|
||||
|
||||
impl HTMLTrackElementDerived for EventTarget {
|
||||
|
|
|
@ -15,7 +15,7 @@ use servo_util::str::DOMString;
|
|||
|
||||
#[deriving(Encodable)]
|
||||
pub struct HTMLUListElement {
|
||||
htmlelement: HTMLElement
|
||||
pub htmlelement: HTMLElement
|
||||
}
|
||||
|
||||
impl HTMLUListElementDerived for EventTarget {
|
||||
|
|
|
@ -14,7 +14,7 @@ use servo_util::str::DOMString;
|
|||
|
||||
#[deriving(Encodable)]
|
||||
pub struct HTMLUnknownElement {
|
||||
htmlelement: HTMLElement
|
||||
pub htmlelement: HTMLElement
|
||||
}
|
||||
|
||||
impl HTMLUnknownElementDerived for EventTarget {
|
||||
|
|
|
@ -15,7 +15,7 @@ use servo_util::str::DOMString;
|
|||
|
||||
#[deriving(Encodable)]
|
||||
pub struct HTMLVideoElement {
|
||||
htmlmediaelement: HTMLMediaElement
|
||||
pub htmlmediaelement: HTMLMediaElement
|
||||
}
|
||||
|
||||
impl HTMLVideoElementDerived for EventTarget {
|
||||
|
|
|
@ -17,8 +17,8 @@ use serialize::{Encoder, Encodable};
|
|||
|
||||
#[deriving(Encodable)]
|
||||
pub struct Location {
|
||||
reflector_: Reflector, //XXXjdm cycle: window->Location->window
|
||||
page: Rc<Page>,
|
||||
pub reflector_: Reflector, //XXXjdm cycle: window->Location->window
|
||||
pub page: Rc<Page>,
|
||||
}
|
||||
|
||||
impl Location {
|
||||
|
|
|
@ -15,17 +15,17 @@ use servo_util::str::DOMString;
|
|||
|
||||
#[deriving(Encodable)]
|
||||
pub struct MouseEvent {
|
||||
mouseevent: UIEvent,
|
||||
screen_x: i32,
|
||||
screen_y: i32,
|
||||
client_x: i32,
|
||||
client_y: i32,
|
||||
ctrl_key: bool,
|
||||
shift_key: bool,
|
||||
alt_key: bool,
|
||||
meta_key: bool,
|
||||
button: u16,
|
||||
related_target: Option<JS<EventTarget>>
|
||||
pub mouseevent: UIEvent,
|
||||
pub screen_x: i32,
|
||||
pub screen_y: i32,
|
||||
pub client_x: i32,
|
||||
pub client_y: i32,
|
||||
pub ctrl_key: bool,
|
||||
pub shift_key: bool,
|
||||
pub alt_key: bool,
|
||||
pub meta_key: bool,
|
||||
pub button: u16,
|
||||
pub related_target: Option<JS<EventTarget>>
|
||||
}
|
||||
|
||||
impl MouseEventDerived for Event {
|
||||
|
|
|
@ -11,7 +11,7 @@ use servo_util::str::DOMString;
|
|||
|
||||
#[deriving(Encodable)]
|
||||
pub struct Navigator {
|
||||
reflector_: Reflector //XXXjdm cycle: window->navigator->window
|
||||
pub reflector_: Reflector //XXXjdm cycle: window->navigator->window
|
||||
}
|
||||
|
||||
impl Navigator {
|
||||
|
|
|
@ -35,12 +35,12 @@ use servo_util::str::{DOMString, null_str_as_empty};
|
|||
|
||||
use js::jsapi::{JSContext, JSObject, JSRuntime};
|
||||
use js::jsfriendapi;
|
||||
use libc;
|
||||
use libc::uintptr_t;
|
||||
use std::cast::transmute;
|
||||
use std::cast;
|
||||
use std::cell::{RefCell, Ref, RefMut};
|
||||
use std::iter::{Map, Filter};
|
||||
use std::libc;
|
||||
use std::libc::uintptr_t;
|
||||
use std::mem;
|
||||
|
||||
use serialize::{Encoder, Encodable};
|
||||
|
@ -53,44 +53,45 @@ use serialize::{Encoder, Encodable};
|
|||
#[deriving(Encodable)]
|
||||
pub struct Node {
|
||||
/// The JavaScript reflector for this node.
|
||||
eventtarget: EventTarget,
|
||||
pub eventtarget: EventTarget,
|
||||
|
||||
/// The type of node that this is.
|
||||
type_id: NodeTypeId,
|
||||
pub type_id: NodeTypeId,
|
||||
|
||||
/// The parent of this node.
|
||||
parent_node: Option<JS<Node>>,
|
||||
pub parent_node: Option<JS<Node>>,
|
||||
|
||||
/// The first child of this node.
|
||||
first_child: Option<JS<Node>>,
|
||||
pub first_child: Option<JS<Node>>,
|
||||
|
||||
/// The last child of this node.
|
||||
last_child: Option<JS<Node>>,
|
||||
pub last_child: Option<JS<Node>>,
|
||||
|
||||
/// The next sibling of this node.
|
||||
next_sibling: Option<JS<Node>>,
|
||||
pub next_sibling: Option<JS<Node>>,
|
||||
|
||||
/// The previous sibling of this node.
|
||||
prev_sibling: Option<JS<Node>>,
|
||||
pub prev_sibling: Option<JS<Node>>,
|
||||
|
||||
/// The document that this node belongs to.
|
||||
priv owner_doc: Option<JS<Document>>,
|
||||
owner_doc: Option<JS<Document>>,
|
||||
|
||||
/// The live list of children return by .childNodes.
|
||||
child_list: Option<JS<NodeList>>,
|
||||
pub child_list: Option<JS<NodeList>>,
|
||||
|
||||
/// A bitfield of flags for node items.
|
||||
priv flags: NodeFlags,
|
||||
flags: NodeFlags,
|
||||
|
||||
/// Layout information. Only the layout task may touch this data.
|
||||
///
|
||||
/// FIXME(pcwalton): We need to send these back to the layout task to be destroyed when this
|
||||
/// node is finalized.
|
||||
layout_data: LayoutDataRef,
|
||||
pub layout_data: LayoutDataRef,
|
||||
}
|
||||
|
||||
impl<S: Encoder> Encodable<S> for LayoutDataRef {
|
||||
fn encode(&self, _s: &mut S) {
|
||||
impl<S: Encoder<E>, E> Encodable<S, E> for LayoutDataRef {
|
||||
fn encode(&self, _s: &mut S) -> Result<(), E> {
|
||||
Ok(())
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -105,7 +106,7 @@ impl NodeDerived for EventTarget {
|
|||
|
||||
/// Flags for node items.
|
||||
#[deriving(Encodable)]
|
||||
pub struct NodeFlags(u8);
|
||||
pub struct NodeFlags(pub u8);
|
||||
|
||||
impl NodeFlags {
|
||||
pub fn new(type_id: NodeTypeId) -> NodeFlags {
|
||||
|
@ -142,12 +143,12 @@ enum SuppressObserver {
|
|||
|
||||
/// Encapsulates the abstract layout data.
|
||||
pub struct LayoutData {
|
||||
priv chan: Option<LayoutChan>,
|
||||
priv data: *(),
|
||||
chan: Option<LayoutChan>,
|
||||
data: *(),
|
||||
}
|
||||
|
||||
pub struct LayoutDataRef {
|
||||
data_cell: RefCell<Option<LayoutData>>,
|
||||
pub data_cell: RefCell<Option<LayoutData>>,
|
||||
}
|
||||
|
||||
impl LayoutDataRef {
|
||||
|
@ -599,7 +600,7 @@ pub type ChildElementIterator<'a> = Map<'a, JS<Node>,
|
|||
Filter<'a, JS<Node>, AbstractNodeChildrenIterator>>;
|
||||
|
||||
pub struct AbstractNodeChildrenIterator {
|
||||
priv current_node: Option<JS<Node>>,
|
||||
current_node: Option<JS<Node>>,
|
||||
}
|
||||
|
||||
impl Iterator<JS<Node>> for AbstractNodeChildrenIterator {
|
||||
|
@ -613,7 +614,7 @@ impl Iterator<JS<Node>> for AbstractNodeChildrenIterator {
|
|||
}
|
||||
|
||||
pub struct AncestorIterator {
|
||||
priv current: Option<JS<Node>>,
|
||||
current: Option<JS<Node>>,
|
||||
}
|
||||
|
||||
impl Iterator<JS<Node>> for AncestorIterator {
|
||||
|
@ -632,8 +633,8 @@ impl Iterator<JS<Node>> for AncestorIterator {
|
|||
// FIXME: Do this without precomputing a vector of refs.
|
||||
// Easy for preorder; harder for postorder.
|
||||
pub struct TreeIterator {
|
||||
priv nodes: ~[JS<Node>],
|
||||
priv index: uint,
|
||||
nodes: ~[JS<Node>],
|
||||
index: uint,
|
||||
}
|
||||
|
||||
impl TreeIterator {
|
||||
|
@ -658,11 +659,11 @@ impl Iterator<JS<Node>> for TreeIterator {
|
|||
}
|
||||
|
||||
pub struct NodeIterator {
|
||||
start_node: JS<Node>,
|
||||
current_node: Option<JS<Node>>,
|
||||
depth: uint,
|
||||
priv include_start: bool,
|
||||
priv include_descendants_of_void: bool
|
||||
pub start_node: JS<Node>,
|
||||
pub current_node: Option<JS<Node>>,
|
||||
pub depth: uint,
|
||||
include_start: bool,
|
||||
include_descendants_of_void: bool
|
||||
}
|
||||
|
||||
impl NodeIterator {
|
||||
|
|
Some files were not shown because too many files have changed in this diff Show more
Loading…
Add table
Add a link
Reference in a new issue