mirror of
https://github.com/servo/servo.git
synced 2025-10-07 20:19:21 +01:00
Upgrade to latest Rust.
This commit is contained in:
parent
56dd5b943e
commit
f5b5b337d3
99 changed files with 269 additions and 253 deletions
|
@ -22,7 +22,7 @@ pub enum AttrSettingType {
|
|||
ReplacedAttr,
|
||||
}
|
||||
|
||||
#[deriving(Eq, Clone, Encodable)]
|
||||
#[deriving(PartialEq, Clone, Encodable)]
|
||||
pub enum AttrValue {
|
||||
StringAttrValue(DOMString),
|
||||
TokenListAttrValue(DOMString, Vec<(uint, uint)>),
|
||||
|
|
|
@ -24,7 +24,7 @@ pub enum ExceptionHandling {
|
|||
RethrowExceptions
|
||||
}
|
||||
|
||||
#[deriving(Clone,Eq,Encodable)]
|
||||
#[deriving(Clone,PartialEq,Encodable)]
|
||||
pub struct CallbackFunction {
|
||||
object: CallbackObject
|
||||
}
|
||||
|
@ -39,13 +39,13 @@ impl CallbackFunction {
|
|||
}
|
||||
}
|
||||
|
||||
#[deriving(Clone,Eq,Encodable)]
|
||||
#[deriving(Clone,PartialEq,Encodable)]
|
||||
pub struct CallbackInterface {
|
||||
object: CallbackObject
|
||||
}
|
||||
|
||||
#[allow(raw_pointer_deriving)]
|
||||
#[deriving(Clone,Eq,Encodable)]
|
||||
#[deriving(Clone,PartialEq,Encodable)]
|
||||
struct CallbackObject {
|
||||
callback: Traceable<*mut JSObject>,
|
||||
}
|
||||
|
|
|
@ -2707,7 +2707,7 @@ use js::jsapi::JSContext;
|
|||
use js::jsval::JSVal;
|
||||
|
||||
#[repr(uint)]
|
||||
#[deriving(Encodable, Eq)]
|
||||
#[deriving(Encodable, PartialEq)]
|
||||
pub enum valuelist {
|
||||
%s
|
||||
}
|
||||
|
@ -4756,7 +4756,7 @@ class CGCallback(CGClass):
|
|||
bases=[ClassBase(baseName)],
|
||||
constructors=self.getConstructors(),
|
||||
methods=realMethods+getters+setters,
|
||||
decorators="#[deriving(Eq,Clone,Encodable)]")
|
||||
decorators="#[deriving(PartialEq,Clone,Encodable)]")
|
||||
|
||||
def getConstructors(self):
|
||||
return [ClassConstructor(
|
||||
|
@ -5262,7 +5262,7 @@ class GlobalGenRoots():
|
|||
return CGList([
|
||||
CGGeneric(AUTOGENERATED_WARNING_COMMENT),
|
||||
CGGeneric("pub static MAX_PROTO_CHAIN_LENGTH: uint = %d;\n\n" % config.maxProtoChainLength),
|
||||
CGNamespacedEnum('id', 'ID', protos, [0], deriving="Eq"),
|
||||
CGNamespacedEnum('id', 'ID', protos, [0], deriving="PartialEq"),
|
||||
])
|
||||
|
||||
|
||||
|
|
|
@ -228,7 +228,7 @@ impl ToJSValConvertible for DOMString {
|
|||
}
|
||||
}
|
||||
|
||||
#[deriving(Eq)]
|
||||
#[deriving(PartialEq)]
|
||||
pub enum StringificationBehavior {
|
||||
Default,
|
||||
Empty,
|
||||
|
|
|
@ -63,7 +63,7 @@ pub struct Temporary<T> {
|
|||
js_ptr: *mut JSObject,
|
||||
}
|
||||
|
||||
impl<T> Eq for Temporary<T> {
|
||||
impl<T> PartialEq for Temporary<T> {
|
||||
fn eq(&self, other: &Temporary<T>) -> bool {
|
||||
self.inner == other.inner
|
||||
}
|
||||
|
@ -106,7 +106,7 @@ pub struct JS<T> {
|
|||
ptr: *T
|
||||
}
|
||||
|
||||
impl<T> Eq for JS<T> {
|
||||
impl<T> PartialEq for JS<T> {
|
||||
fn eq(&self, other: &JS<T>) -> bool {
|
||||
self.ptr == other.ptr
|
||||
}
|
||||
|
@ -455,7 +455,7 @@ impl<'a, T> Clone for JSRef<'a, T> {
|
|||
}
|
||||
}
|
||||
|
||||
impl<'a, T> Eq for JSRef<'a, T> {
|
||||
impl<'a, T> PartialEq for JSRef<'a, T> {
|
||||
fn eq(&self, other: &JSRef<T>) -> bool {
|
||||
self.ptr == other.ptr
|
||||
}
|
||||
|
|
|
@ -7,7 +7,7 @@ use std::hash::{Hash, sip};
|
|||
use std::path::BytesContainer;
|
||||
use std::str;
|
||||
|
||||
#[deriving(Encodable,Clone,TotalEq,Eq)]
|
||||
#[deriving(Encodable,Clone,Eq,PartialEq)]
|
||||
pub struct ByteString(Vec<u8>);
|
||||
|
||||
impl ByteString {
|
||||
|
@ -66,7 +66,7 @@ impl ByteString {
|
|||
|
||||
pub fn is_field_value(&self) -> bool {
|
||||
// Classifications of characters necessary for the [CRLF] (SP|HT) rule
|
||||
#[deriving(Eq)]
|
||||
#[deriving(PartialEq)]
|
||||
enum PreviousCharacter {
|
||||
Other,
|
||||
CR,
|
||||
|
|
|
@ -116,7 +116,7 @@ impl<T> DerefMut<T> for Untraceable<T> {
|
|||
///
|
||||
/// We always prefer this, in case the contained type ever changes to something that should be traced.
|
||||
/// See more details: mozilla#2662.
|
||||
#[deriving(Eq, Clone)]
|
||||
#[deriving(PartialEq, Clone)]
|
||||
pub struct Traceable<T> {
|
||||
inner: T
|
||||
}
|
||||
|
|
|
@ -11,12 +11,12 @@ use dom::browsercontext;
|
|||
use dom::window;
|
||||
use servo_util::str::DOMString;
|
||||
|
||||
use collections::hashmap::HashMap;
|
||||
use std::collections::hashmap::HashMap;
|
||||
use libc;
|
||||
use libc::c_uint;
|
||||
use std::cell::Cell;
|
||||
use std::cmp::Eq;
|
||||
use std::mem;
|
||||
use std::cmp::PartialEq;
|
||||
use std::ptr;
|
||||
use std::ptr::null;
|
||||
use std::slice;
|
||||
|
@ -383,7 +383,7 @@ pub fn reflect_dom_object<T: Reflectable>
|
|||
}
|
||||
|
||||
#[allow(raw_pointer_deriving)]
|
||||
#[deriving(Eq)]
|
||||
#[deriving(PartialEq)]
|
||||
pub struct Reflector {
|
||||
object: Cell<*mut JSObject>,
|
||||
}
|
||||
|
@ -608,7 +608,7 @@ pub fn cx_for_dom_object<T: Reflectable>(obj: &T) -> *mut JSContext {
|
|||
|
||||
/// Check if an element name is valid. See http://www.w3.org/TR/xml/#NT-Name
|
||||
/// for details.
|
||||
#[deriving(Eq)]
|
||||
#[deriving(PartialEq)]
|
||||
pub enum XMLName {
|
||||
QName,
|
||||
Name,
|
||||
|
|
|
@ -46,13 +46,13 @@ use servo_util::namespace;
|
|||
use servo_util::namespace::{Namespace, Null};
|
||||
use servo_util::str::{DOMString, null_str_as_empty_ref};
|
||||
|
||||
use collections::hashmap::HashMap;
|
||||
use std::collections::hashmap::HashMap;
|
||||
use js::jsapi::JSContext;
|
||||
use std::ascii::StrAsciiExt;
|
||||
use std::cell::{Cell, RefCell};
|
||||
use url::{Url, from_str};
|
||||
|
||||
#[deriving(Eq,Encodable)]
|
||||
#[deriving(PartialEq,Encodable)]
|
||||
pub enum IsHTMLDocument {
|
||||
HTMLDocument,
|
||||
NonHTMLDocument,
|
||||
|
|
|
@ -64,7 +64,7 @@ impl Reflectable for Element {
|
|||
}
|
||||
}
|
||||
|
||||
#[deriving(Eq,Encodable)]
|
||||
#[deriving(PartialEq,Encodable)]
|
||||
pub enum ElementTypeId {
|
||||
HTMLElementTypeId,
|
||||
HTMLAnchorElementTypeId,
|
||||
|
@ -773,9 +773,9 @@ pub fn get_attribute_parts(name: DOMString) -> (Option<String>, String) {
|
|||
}
|
||||
|
||||
impl<'a> VirtualMethods for JSRef<'a, Element> {
|
||||
fn super_type<'a>(&'a self) -> Option<&'a VirtualMethods:> {
|
||||
fn super_type<'a>(&'a self) -> Option<&'a VirtualMethods+> {
|
||||
let node: &JSRef<Node> = NodeCast::from_ref(self);
|
||||
Some(node as &VirtualMethods:)
|
||||
Some(node as &VirtualMethods+)
|
||||
}
|
||||
|
||||
fn after_set_attr(&self, name: DOMString, value: DOMString) {
|
||||
|
|
|
@ -35,7 +35,7 @@ pub enum EventPhase {
|
|||
PhaseBubbling = EventConstants::BUBBLING_PHASE,
|
||||
}
|
||||
|
||||
#[deriving(Eq, Encodable)]
|
||||
#[deriving(PartialEq, Encodable)]
|
||||
pub enum EventTypeId {
|
||||
CustomEventTypeId,
|
||||
HTMLEventTypeId,
|
||||
|
|
|
@ -22,22 +22,22 @@ use std::cell::RefCell;
|
|||
use std::ptr;
|
||||
use url::Url;
|
||||
|
||||
use collections::hashmap::HashMap;
|
||||
use std::collections::hashmap::HashMap;
|
||||
|
||||
#[deriving(Eq,Encodable)]
|
||||
#[deriving(PartialEq,Encodable)]
|
||||
pub enum ListenerPhase {
|
||||
Capturing,
|
||||
Bubbling,
|
||||
}
|
||||
|
||||
#[deriving(Eq,Encodable)]
|
||||
#[deriving(PartialEq,Encodable)]
|
||||
pub enum EventTargetTypeId {
|
||||
NodeTargetTypeId(NodeTypeId),
|
||||
WindowTypeId,
|
||||
XMLHttpRequestTargetTypeId(XMLHttpRequestId)
|
||||
}
|
||||
|
||||
#[deriving(Eq, Encodable)]
|
||||
#[deriving(PartialEq, Encodable)]
|
||||
pub enum EventListenerType {
|
||||
Additive(EventListener),
|
||||
Inline(EventListener),
|
||||
|
@ -51,7 +51,7 @@ impl EventListenerType {
|
|||
}
|
||||
}
|
||||
|
||||
#[deriving(Eq,Encodable)]
|
||||
#[deriving(PartialEq,Encodable)]
|
||||
pub struct EventListenerEntry {
|
||||
pub phase: ListenerPhase,
|
||||
pub listener: EventListenerType
|
||||
|
@ -281,7 +281,7 @@ impl Reflectable for EventTarget {
|
|||
}
|
||||
|
||||
impl<'a> VirtualMethods for JSRef<'a, EventTarget> {
|
||||
fn super_type<'a>(&'a self) -> Option<&'a VirtualMethods:> {
|
||||
fn super_type<'a>(&'a self) -> Option<&'a VirtualMethods+> {
|
||||
None
|
||||
}
|
||||
}
|
||||
|
|
|
@ -15,7 +15,7 @@ use dom::htmlformelement::HTMLFormElement;
|
|||
use dom::window::Window;
|
||||
use servo_util::str::DOMString;
|
||||
use std::cell::RefCell;
|
||||
use collections::hashmap::HashMap;
|
||||
use std::collections::hashmap::HashMap;
|
||||
|
||||
#[deriving(Encodable, Clone)]
|
||||
pub enum FormDatum {
|
||||
|
@ -120,4 +120,4 @@ impl PrivateFormDataHelpers for FormData {
|
|||
let name = filename.unwrap_or(f.map(|inner| inner.name.clone()).unwrap_or("blob".to_string()));
|
||||
File::new(&*global, value, name)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -68,9 +68,9 @@ impl<'a> PrivateHTMLAnchorElementHelpers for JSRef<'a, HTMLAnchorElement> {
|
|||
}
|
||||
|
||||
impl<'a> VirtualMethods for JSRef<'a, HTMLAnchorElement> {
|
||||
fn super_type<'a>(&'a self) -> Option<&'a VirtualMethods:> {
|
||||
fn super_type<'a>(&'a self) -> Option<&'a VirtualMethods+> {
|
||||
let htmlelement: &JSRef<HTMLElement> = HTMLElementCast::from_ref(self);
|
||||
Some(htmlelement as &VirtualMethods:)
|
||||
Some(htmlelement as &VirtualMethods+)
|
||||
}
|
||||
|
||||
fn handle_event(&self, event: &JSRef<Event>) {
|
||||
|
|
|
@ -59,9 +59,9 @@ impl<'a> HTMLBodyElementMethods for JSRef<'a, HTMLBodyElement> {
|
|||
}
|
||||
|
||||
impl<'a> VirtualMethods for JSRef<'a, HTMLBodyElement> {
|
||||
fn super_type<'a>(&'a self) -> Option<&'a VirtualMethods:> {
|
||||
fn super_type<'a>(&'a self) -> Option<&'a VirtualMethods+> {
|
||||
let element: &JSRef<HTMLElement> = HTMLElementCast::from_ref(self);
|
||||
Some(element as &VirtualMethods:)
|
||||
Some(element as &VirtualMethods+)
|
||||
}
|
||||
|
||||
fn after_set_attr(&self, name: DOMString, value: DOMString) {
|
||||
|
|
|
@ -135,10 +135,10 @@ impl<'a> HTMLCollectionMethods for JSRef<'a, HTMLCollection> {
|
|||
Live(ref root, ref filter) => {
|
||||
let root = root.root();
|
||||
root.deref().traverse_preorder()
|
||||
.count(|child| {
|
||||
.filter(|&child| {
|
||||
let elem: Option<&JSRef<Element>> = ElementCast::to_ref(&child);
|
||||
elem.map_or(false, |elem| filter.filter(elem, &*root))
|
||||
}) as u32
|
||||
}).count() as u32
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -93,9 +93,9 @@ impl<'a> HTMLElementMethods for JSRef<'a, HTMLElement> {
|
|||
}
|
||||
|
||||
impl<'a> VirtualMethods for JSRef<'a, HTMLElement> {
|
||||
fn super_type<'a>(&'a self) -> Option<&'a VirtualMethods:> {
|
||||
fn super_type<'a>(&'a self) -> Option<&'a VirtualMethods+> {
|
||||
let element: &JSRef<Element> = ElementCast::from_ref(self);
|
||||
Some(element as &VirtualMethods:)
|
||||
Some(element as &VirtualMethods+)
|
||||
}
|
||||
|
||||
fn after_set_attr(&self, name: DOMString, value: DOMString) {
|
||||
|
|
|
@ -136,9 +136,9 @@ impl<'a> HTMLIFrameElementMethods for JSRef<'a, HTMLIFrameElement> {
|
|||
}
|
||||
|
||||
impl<'a> VirtualMethods for JSRef<'a, HTMLIFrameElement> {
|
||||
fn super_type<'a>(&'a self) -> Option<&'a VirtualMethods:> {
|
||||
fn super_type<'a>(&'a self) -> Option<&'a VirtualMethods+> {
|
||||
let htmlelement: &JSRef<HTMLElement> = HTMLElementCast::from_ref(self);
|
||||
Some(htmlelement as &VirtualMethods:)
|
||||
Some(htmlelement as &VirtualMethods+)
|
||||
}
|
||||
|
||||
fn after_set_attr(&self, name: DOMString, value: DOMString) {
|
||||
|
|
|
@ -240,9 +240,9 @@ impl<'a> HTMLImageElementMethods for JSRef<'a, HTMLImageElement> {
|
|||
}
|
||||
|
||||
impl<'a> VirtualMethods for JSRef<'a, HTMLImageElement> {
|
||||
fn super_type<'a>(&'a self) -> Option<&'a VirtualMethods:> {
|
||||
fn super_type<'a>(&'a self) -> Option<&'a VirtualMethods+> {
|
||||
let htmlelement: &JSRef<HTMLElement> = HTMLElementCast::from_ref(self);
|
||||
Some(htmlelement as &VirtualMethods:)
|
||||
Some(htmlelement as &VirtualMethods+)
|
||||
}
|
||||
|
||||
fn after_set_attr(&self, name: DOMString, value: DOMString) {
|
||||
|
|
|
@ -85,9 +85,9 @@ impl<'a> HTMLObjectElementMethods for JSRef<'a, HTMLObjectElement> {
|
|||
}
|
||||
|
||||
impl<'a> VirtualMethods for JSRef<'a, HTMLObjectElement> {
|
||||
fn super_type<'a>(&'a self) -> Option<&'a VirtualMethods:> {
|
||||
fn super_type<'a>(&'a self) -> Option<&'a VirtualMethods+> {
|
||||
let htmlelement: &JSRef<HTMLElement> = HTMLElementCast::from_ref(self);
|
||||
Some(htmlelement as &VirtualMethods:)
|
||||
Some(htmlelement as &VirtualMethods+)
|
||||
}
|
||||
|
||||
fn after_set_attr(&self, name: DOMString, value: DOMString) {
|
||||
|
|
|
@ -22,9 +22,9 @@ use dom::text::Text;
|
|||
pub fn serialize(iterator: &mut NodeIterator) -> String {
|
||||
let mut html = String::new();
|
||||
let mut open_elements: Vec<String> = vec!();
|
||||
|
||||
let depth = iterator.depth;
|
||||
for node in *iterator {
|
||||
while open_elements.len() > iterator.depth {
|
||||
while open_elements.len() > depth {
|
||||
html.push_str("</");
|
||||
html.push_str(open_elements.pop().unwrap().as_slice());
|
||||
html.push_str(">");
|
||||
|
|
|
@ -65,9 +65,9 @@ impl<'a> StyleElementHelpers for JSRef<'a, HTMLStyleElement> {
|
|||
}
|
||||
|
||||
impl<'a> VirtualMethods for JSRef<'a, HTMLStyleElement> {
|
||||
fn super_type<'a>(&'a self) -> Option<&'a VirtualMethods:> {
|
||||
fn super_type<'a>(&'a self) -> Option<&'a VirtualMethods+> {
|
||||
let htmlelement: &JSRef<HTMLElement> = HTMLElementCast::from_ref(self);
|
||||
Some(htmlelement as &VirtualMethods:)
|
||||
Some(htmlelement as &VirtualMethods+)
|
||||
}
|
||||
|
||||
fn child_inserted(&self, child: &JSRef<Node>) {
|
||||
|
|
|
@ -172,12 +172,6 @@ impl LayoutDataRef {
|
|||
}
|
||||
}
|
||||
|
||||
pub unsafe fn from_data<T>(data: Box<T>) -> LayoutDataRef {
|
||||
LayoutDataRef {
|
||||
data_cell: RefCell::new(Some(mem::transmute(data))),
|
||||
}
|
||||
}
|
||||
|
||||
/// Returns true if there is layout data present.
|
||||
#[inline]
|
||||
pub fn is_present(&self) -> bool {
|
||||
|
@ -225,7 +219,7 @@ impl LayoutDataRef {
|
|||
pub trait TLayoutData {}
|
||||
|
||||
/// The different types of nodes.
|
||||
#[deriving(Eq,Encodable)]
|
||||
#[deriving(PartialEq,Encodable)]
|
||||
pub enum NodeTypeId {
|
||||
DoctypeNodeTypeId,
|
||||
DocumentFragmentNodeTypeId,
|
||||
|
@ -901,7 +895,7 @@ fn gather_abstract_nodes<'a>(cur: &JSRef<'a, Node>, refs: &mut Vec<JSRef<'a, Nod
|
|||
}
|
||||
|
||||
/// Specifies whether children must be recursively cloned or not.
|
||||
#[deriving(Eq)]
|
||||
#[deriving(PartialEq)]
|
||||
pub enum CloneChildrenFlag {
|
||||
CloneChildren,
|
||||
DoNotCloneChildren
|
||||
|
@ -1024,13 +1018,13 @@ impl Node {
|
|||
if node.children().any(|c| c.is_text()) {
|
||||
return Err(HierarchyRequest);
|
||||
}
|
||||
match node.child_elements().len() {
|
||||
match node.child_elements().count() {
|
||||
0 => (),
|
||||
// Step 6.1.2
|
||||
1 => {
|
||||
// FIXME: change to empty() when https://github.com/mozilla/rust/issues/11218
|
||||
// will be fixed
|
||||
if parent.child_elements().len() > 0 {
|
||||
if parent.child_elements().count() > 0 {
|
||||
return Err(HierarchyRequest);
|
||||
}
|
||||
match child {
|
||||
|
@ -1049,7 +1043,7 @@ impl Node {
|
|||
ElementNodeTypeId(_) => {
|
||||
// FIXME: change to empty() when https://github.com/mozilla/rust/issues/11218
|
||||
// will be fixed
|
||||
if parent.child_elements().len() > 0 {
|
||||
if parent.child_elements().count() > 0 {
|
||||
return Err(HierarchyRequest);
|
||||
}
|
||||
match child {
|
||||
|
@ -1076,7 +1070,7 @@ impl Node {
|
|||
None => {
|
||||
// FIXME: change to empty() when https://github.com/mozilla/rust/issues/11218
|
||||
// will be fixed
|
||||
if parent.child_elements().len() > 0 {
|
||||
if parent.child_elements().count() > 0 {
|
||||
return Err(HierarchyRequest);
|
||||
}
|
||||
},
|
||||
|
@ -1649,7 +1643,7 @@ impl<'a> NodeMethods for JSRef<'a, Node> {
|
|||
if node.children().any(|c| c.is_text()) {
|
||||
return Err(HierarchyRequest);
|
||||
}
|
||||
match node.child_elements().len() {
|
||||
match node.child_elements().count() {
|
||||
0 => (),
|
||||
// Step 6.1.2
|
||||
1 => {
|
||||
|
@ -1837,7 +1831,7 @@ impl<'a> NodeMethods for JSRef<'a, Node> {
|
|||
}
|
||||
|
||||
// Step 5.
|
||||
if this.children().len() != node.children().len() {
|
||||
if this.children().count() != node.children().count() {
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -1953,9 +1947,9 @@ pub fn window_from_node<T: NodeBase>(derived: &JSRef<T>) -> Temporary<Window> {
|
|||
}
|
||||
|
||||
impl<'a> VirtualMethods for JSRef<'a, Node> {
|
||||
fn super_type<'a>(&'a self) -> Option<&'a VirtualMethods:> {
|
||||
fn super_type<'a>(&'a self) -> Option<&'a VirtualMethods+> {
|
||||
let eventtarget: &JSRef<EventTarget> = EventTargetCast::from_ref(self);
|
||||
Some(eventtarget as &VirtualMethods:)
|
||||
Some(eventtarget as &VirtualMethods+)
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -58,7 +58,7 @@ impl<'a> NodeListMethods for JSRef<'a, NodeList> {
|
|||
Simple(ref elems) => elems.len() as u32,
|
||||
Children(ref node) => {
|
||||
let node = node.root();
|
||||
node.deref().children().len() as u32
|
||||
node.deref().children().count() as u32
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -31,7 +31,7 @@ use servo_util::str::DOMString;
|
|||
pub trait VirtualMethods {
|
||||
/// Returns self as the superclass of the implementation for this trait,
|
||||
/// if any.
|
||||
fn super_type<'a>(&'a self) -> Option<&'a VirtualMethods:>;
|
||||
fn super_type<'a>(&'a self) -> Option<&'a VirtualMethods+>;
|
||||
|
||||
/// Called when changing or adding attributes, after the attribute's value
|
||||
/// has been updated.
|
||||
|
@ -99,42 +99,42 @@ pub trait VirtualMethods {
|
|||
/// method call on the trait object will invoke the corresponding method on the
|
||||
/// concrete type, propagating up the parent hierarchy unless otherwise
|
||||
/// interrupted.
|
||||
pub fn vtable_for<'a>(node: &'a JSRef<Node>) -> &'a VirtualMethods: {
|
||||
pub fn vtable_for<'a>(node: &'a JSRef<Node>) -> &'a VirtualMethods+ {
|
||||
match node.type_id() {
|
||||
ElementNodeTypeId(HTMLAnchorElementTypeId) => {
|
||||
let element: &JSRef<HTMLAnchorElement> = HTMLAnchorElementCast::to_ref(node).unwrap();
|
||||
element as &VirtualMethods:
|
||||
element as &VirtualMethods+
|
||||
}
|
||||
ElementNodeTypeId(HTMLBodyElementTypeId) => {
|
||||
let element: &JSRef<HTMLBodyElement> = HTMLBodyElementCast::to_ref(node).unwrap();
|
||||
element as &VirtualMethods:
|
||||
element as &VirtualMethods+
|
||||
}
|
||||
ElementNodeTypeId(HTMLImageElementTypeId) => {
|
||||
let element: &JSRef<HTMLImageElement> = HTMLImageElementCast::to_ref(node).unwrap();
|
||||
element as &VirtualMethods:
|
||||
element as &VirtualMethods+
|
||||
}
|
||||
ElementNodeTypeId(HTMLIFrameElementTypeId) => {
|
||||
let element: &JSRef<HTMLIFrameElement> = HTMLIFrameElementCast::to_ref(node).unwrap();
|
||||
element as &VirtualMethods:
|
||||
element as &VirtualMethods+
|
||||
}
|
||||
ElementNodeTypeId(HTMLObjectElementTypeId) => {
|
||||
let element: &JSRef<HTMLObjectElement> = HTMLObjectElementCast::to_ref(node).unwrap();
|
||||
element as &VirtualMethods:
|
||||
element as &VirtualMethods+
|
||||
}
|
||||
ElementNodeTypeId(HTMLStyleElementTypeId) => {
|
||||
let element: &JSRef<HTMLStyleElement> = HTMLStyleElementCast::to_ref(node).unwrap();
|
||||
element as &VirtualMethods:
|
||||
element as &VirtualMethods+
|
||||
}
|
||||
ElementNodeTypeId(ElementTypeId) => {
|
||||
let element: &JSRef<Element> = ElementCast::to_ref(node).unwrap();
|
||||
element as &VirtualMethods:
|
||||
element as &VirtualMethods+
|
||||
}
|
||||
ElementNodeTypeId(_) => {
|
||||
let element: &JSRef<HTMLElement> = HTMLElementCast::to_ref(node).unwrap();
|
||||
element as &VirtualMethods:
|
||||
element as &VirtualMethods+
|
||||
}
|
||||
_ => {
|
||||
node as &VirtualMethods:
|
||||
node as &VirtualMethods+
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -29,7 +29,7 @@ use js::jsapi::JSContext;
|
|||
use js::jsapi::{JS_GC, JS_GetRuntime};
|
||||
use js::jsval::JSVal;
|
||||
|
||||
use collections::hashmap::HashMap;
|
||||
use std::collections::hashmap::HashMap;
|
||||
use std::cell::{Cell, RefCell};
|
||||
use std::cmp;
|
||||
use std::comm::{channel, Sender};
|
||||
|
@ -43,7 +43,7 @@ use time;
|
|||
use serialize::{Encoder, Encodable};
|
||||
use url::Url;
|
||||
|
||||
#[deriving(Eq, Encodable, TotalEq)]
|
||||
#[deriving(PartialEq, Encodable, Eq)]
|
||||
pub struct TimerId(i32);
|
||||
|
||||
#[deriving(Encodable)]
|
||||
|
|
|
@ -61,13 +61,13 @@ use url::Url;
|
|||
// use SendParam = dom::bindings::codegen::UnionTypes::StringOrFormData;
|
||||
pub type SendParam = DOMString;
|
||||
|
||||
#[deriving(Eq,Encodable)]
|
||||
#[deriving(PartialEq,Encodable)]
|
||||
pub enum XMLHttpRequestId {
|
||||
XMLHttpRequestTypeId,
|
||||
XMLHttpRequestUploadTypeId
|
||||
}
|
||||
|
||||
#[deriving(Eq, Encodable)]
|
||||
#[deriving(PartialEq, Encodable)]
|
||||
enum XMLHttpRequestState {
|
||||
Unsent = 0u16,
|
||||
Opened = 1u16,
|
||||
|
@ -889,7 +889,7 @@ impl<'a> PrivateXMLHttpRequestHelpers for JSRef<'a, XMLHttpRequest> {
|
|||
self.timer.deref().borrow_mut().oneshot(0);
|
||||
}
|
||||
fn text_response(&self) -> DOMString {
|
||||
let mut encoding = UTF_8 as &Encoding:Send;
|
||||
let mut encoding = UTF_8 as &Encoding+Send;
|
||||
match self.response_headers.deref().borrow().content_type {
|
||||
Some(ref x) => {
|
||||
for &(ref name, ref value) in x.parameters.iter() {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue