mirror of
https://github.com/servo/servo.git
synced 2025-08-03 04:30:10 +01:00
Update rustc to revision 3dcd2157403163789aaf21a9ab3c4d30a7c6494d.
This commit is contained in:
parent
b8900782b0
commit
466faac2a5
223 changed files with 4414 additions and 4105 deletions
|
@ -2,11 +2,10 @@
|
|||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||
|
||||
use dom::attr::{Attr, AttrHelpers, StringAttrValue};
|
||||
use dom::attr::{Attr, AttrHelpers, AttrValue};
|
||||
use dom::bindings::cell::DOMRefCell;
|
||||
use dom::bindings::codegen::Bindings::DocumentBinding;
|
||||
use dom::bindings::codegen::Bindings::DocumentBinding::{DocumentMethods, DocumentReadyState};
|
||||
use dom::bindings::codegen::Bindings::DocumentBinding::DocumentReadyStateValues;
|
||||
use dom::bindings::codegen::Bindings::EventHandlerBinding::EventHandlerNonNull;
|
||||
use dom::bindings::codegen::Bindings::EventTargetBinding::EventTargetMethods;
|
||||
use dom::bindings::codegen::Bindings::NodeBinding::NodeMethods;
|
||||
|
@ -20,24 +19,25 @@ use dom::bindings::codegen::InheritTypes::{HTMLAnchorElementDerived, HTMLAppletE
|
|||
use dom::bindings::codegen::InheritTypes::{HTMLAreaElementDerived, HTMLEmbedElementDerived};
|
||||
use dom::bindings::codegen::InheritTypes::{HTMLFormElementDerived, HTMLImageElementDerived};
|
||||
use dom::bindings::codegen::InheritTypes::{HTMLScriptElementDerived};
|
||||
use dom::bindings::error::{ErrorResult, Fallible, NotSupported, InvalidCharacter};
|
||||
use dom::bindings::error::{HierarchyRequest, NamespaceError};
|
||||
use dom::bindings::error::{ErrorResult, Fallible};
|
||||
use dom::bindings::error::Error::{NotSupported, InvalidCharacter};
|
||||
use dom::bindings::error::Error::{HierarchyRequest, NamespaceError};
|
||||
use dom::bindings::global::GlobalRef;
|
||||
use dom::bindings::global;
|
||||
use dom::bindings::js::{MutNullableJS, JS, JSRef, Temporary, OptionalSettable, TemporaryPushable};
|
||||
use dom::bindings::js::OptionalRootable;
|
||||
use dom::bindings::utils::{Reflectable, Reflector, reflect_dom_object};
|
||||
use dom::bindings::utils::{xml_name_type, InvalidXMLName, Name, QName};
|
||||
use dom::bindings::utils::xml_name_type;
|
||||
use dom::bindings::utils::XMLName::{QName, Name, InvalidXMLName};
|
||||
use dom::comment::Comment;
|
||||
use dom::customevent::CustomEvent;
|
||||
use dom::documentfragment::DocumentFragment;
|
||||
use dom::documenttype::DocumentType;
|
||||
use dom::domimplementation::DOMImplementation;
|
||||
use dom::element::{Element, ScriptCreated, AttributeHandlers, get_attribute_parts};
|
||||
use dom::element::{HTMLHeadElementTypeId, HTMLTitleElementTypeId};
|
||||
use dom::element::{HTMLBodyElementTypeId, HTMLFrameSetElementTypeId};
|
||||
use dom::event::{Event, DoesNotBubble, NotCancelable};
|
||||
use dom::eventtarget::{EventTarget, NodeTargetTypeId, EventTargetHelpers};
|
||||
use dom::element::{Element, ElementCreator, AttributeHandlers, get_attribute_parts};
|
||||
use dom::element::ElementTypeId;
|
||||
use dom::event::{Event, EventBubbles, EventCancelable};
|
||||
use dom::eventtarget::{EventTarget, EventTargetTypeId, EventTargetHelpers};
|
||||
use dom::htmlanchorelement::HTMLAnchorElement;
|
||||
use dom::htmlcollection::{HTMLCollection, CollectionFilter};
|
||||
use dom::htmlelement::HTMLElement;
|
||||
|
@ -48,8 +48,7 @@ use dom::location::Location;
|
|||
use dom::mouseevent::MouseEvent;
|
||||
use dom::keyboardevent::KeyboardEvent;
|
||||
use dom::messageevent::MessageEvent;
|
||||
use dom::node::{Node, ElementNodeTypeId, DocumentNodeTypeId, NodeHelpers};
|
||||
use dom::node::{CloneChildren, DoNotCloneChildren, NodeDamage, OtherNodeDamage};
|
||||
use dom::node::{Node, NodeHelpers, NodeTypeId, CloneChildrenFlag, NodeDamage};
|
||||
use dom::nodelist::NodeList;
|
||||
use dom::text::Text;
|
||||
use dom::processinginstruction::ProcessingInstruction;
|
||||
|
@ -107,7 +106,7 @@ pub struct Document {
|
|||
|
||||
impl DocumentDerived for EventTarget {
|
||||
fn is_document(&self) -> bool {
|
||||
*self.type_id() == NodeTargetTypeId(DocumentNodeTypeId)
|
||||
*self.type_id() == EventTargetTypeId::Node(NodeTypeId::Document)
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -341,7 +340,8 @@ impl<'a> DocumentHelpers<'a> for JSRef<'a, Document> {
|
|||
|
||||
let window = self.window.root();
|
||||
let event = Event::new(global::Window(*window), "readystatechange".to_string(),
|
||||
DoesNotBubble, NotCancelable).root();
|
||||
EventBubbles::DoesNotBubble,
|
||||
EventCancelable::NotCancelable).root();
|
||||
let target: JSRef<EventTarget> = EventTargetCast::from_ref(self);
|
||||
let _ = target.DispatchEvent(*event);
|
||||
}
|
||||
|
@ -379,7 +379,7 @@ impl<'a> DocumentHelpers<'a> for JSRef<'a, Document> {
|
|||
fn dirty_all_nodes(self) {
|
||||
let root: JSRef<Node> = NodeCast::from_ref(self);
|
||||
for node in root.traverse_preorder() {
|
||||
node.dirty(OtherNodeDamage)
|
||||
node.dirty(NodeDamage::OtherNodeDamage)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -410,14 +410,14 @@ impl Document {
|
|||
source: DocumentSource) -> Document {
|
||||
let url = url.unwrap_or_else(|| Url::parse("about:blank").unwrap());
|
||||
|
||||
let ready_state = if source == FromParser {
|
||||
DocumentReadyStateValues::Loading
|
||||
let ready_state = if source == DocumentSource::FromParser {
|
||||
DocumentReadyState::Loading
|
||||
} else {
|
||||
DocumentReadyStateValues::Complete
|
||||
DocumentReadyState::Complete
|
||||
};
|
||||
|
||||
Document {
|
||||
node: Node::new_without_doc(DocumentNodeTypeId),
|
||||
node: Node::new_without_doc(NodeTypeId::Document),
|
||||
window: JS::from_rooted(window),
|
||||
idmap: DOMRefCell::new(HashMap::new()),
|
||||
implementation: Default::default(),
|
||||
|
@ -425,9 +425,9 @@ impl Document {
|
|||
Some(string) => string.clone(),
|
||||
None => match is_html_document {
|
||||
// http://dom.spec.whatwg.org/#dom-domimplementation-createhtmldocument
|
||||
HTMLDocument => "text/html".to_string(),
|
||||
IsHTMLDocument::HTMLDocument => "text/html".to_string(),
|
||||
// http://dom.spec.whatwg.org/#concept-document-content-type
|
||||
NonHTMLDocument => "application/xml".to_string()
|
||||
IsHTMLDocument::NonHTMLDocument => "application/xml".to_string()
|
||||
}
|
||||
},
|
||||
last_modified: DOMRefCell::new(None),
|
||||
|
@ -436,7 +436,7 @@ impl Document {
|
|||
quirks_mode: Cell::new(NoQuirks),
|
||||
// http://dom.spec.whatwg.org/#concept-document-encoding
|
||||
encoding_name: DOMRefCell::new("UTF-8".to_string()),
|
||||
is_html_document: is_html_document == HTMLDocument,
|
||||
is_html_document: is_html_document == IsHTMLDocument::HTMLDocument,
|
||||
images: Default::default(),
|
||||
embeds: Default::default(),
|
||||
links: Default::default(),
|
||||
|
@ -452,7 +452,9 @@ impl Document {
|
|||
|
||||
// http://dom.spec.whatwg.org/#dom-document
|
||||
pub fn Constructor(global: &GlobalRef) -> Fallible<Temporary<Document>> {
|
||||
Ok(Document::new(global.as_window(), None, NonHTMLDocument, None, NotFromParser))
|
||||
Ok(Document::new(global.as_window(), None,
|
||||
IsHTMLDocument::NonHTMLDocument, None,
|
||||
DocumentSource::NotFromParser))
|
||||
}
|
||||
|
||||
pub fn new(window: JSRef<Window>,
|
||||
|
@ -596,7 +598,7 @@ impl<'a> DocumentMethods for JSRef<'a, Document> {
|
|||
local_name
|
||||
};
|
||||
let name = QualName::new(ns!(HTML), Atom::from_slice(local_name.as_slice()));
|
||||
Ok(Element::create(name, None, self, ScriptCreated))
|
||||
Ok(Element::create(name, None, self, ElementCreator::ScriptCreated))
|
||||
}
|
||||
|
||||
// http://dom.spec.whatwg.org/#dom-document-createelementns
|
||||
|
@ -641,7 +643,7 @@ impl<'a> DocumentMethods for JSRef<'a, Document> {
|
|||
|
||||
let name = QualName::new(ns, Atom::from_slice(local_name_from_qname));
|
||||
Ok(Element::create(name, prefix_from_qname.map(|s| s.to_string()), self,
|
||||
ScriptCreated))
|
||||
ElementCreator::ScriptCreated))
|
||||
}
|
||||
|
||||
// http://dom.spec.whatwg.org/#dom-document-createattribute
|
||||
|
@ -655,7 +657,7 @@ impl<'a> DocumentMethods for JSRef<'a, Document> {
|
|||
let name = Atom::from_slice(local_name.as_slice());
|
||||
// repetition used because string_cache::atom::Atom is non-copyable
|
||||
let l_name = Atom::from_slice(local_name.as_slice());
|
||||
let value = StringAttrValue("".to_string());
|
||||
let value = AttrValue::String("".to_string());
|
||||
|
||||
Ok(Attr::new(*window, name, value, l_name, ns!(""), None, None))
|
||||
}
|
||||
|
@ -702,8 +704,8 @@ impl<'a> DocumentMethods for JSRef<'a, Document> {
|
|||
|
||||
// Step 2.
|
||||
let clone_children = match deep {
|
||||
true => CloneChildren,
|
||||
false => DoNotCloneChildren
|
||||
true => CloneChildrenFlag::CloneChildren,
|
||||
false => CloneChildrenFlag::DoNotCloneChildren
|
||||
};
|
||||
|
||||
Ok(Node::clone(node, Some(self), clone_children))
|
||||
|
@ -748,7 +750,7 @@ impl<'a> DocumentMethods for JSRef<'a, Document> {
|
|||
fn LastModified(self) -> DOMString {
|
||||
match *self.last_modified.borrow() {
|
||||
Some(ref t) => t.clone(),
|
||||
None => time::now().strftime("%m/%d/%Y %H:%M:%S").unwrap(),
|
||||
None => format!("{}", time::now().strftime("%m/%d/%Y %H:%M:%S").unwrap()),
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -769,7 +771,7 @@ impl<'a> DocumentMethods for JSRef<'a, Document> {
|
|||
self.GetDocumentElement().root().map(|root| {
|
||||
let root: JSRef<Node> = NodeCast::from_ref(*root);
|
||||
root.traverse_preorder()
|
||||
.find(|node| node.type_id() == ElementNodeTypeId(HTMLTitleElementTypeId))
|
||||
.find(|node| node.type_id() == NodeTypeId::Element(ElementTypeId::HTMLTitleElement))
|
||||
.map(|title_elem| {
|
||||
for text in title_elem.children().filter_map::<JSRef<Text>>(TextCast::to_ref) {
|
||||
title.push_str(text.characterdata().data().as_slice());
|
||||
|
@ -785,11 +787,11 @@ impl<'a> DocumentMethods for JSRef<'a, Document> {
|
|||
self.GetDocumentElement().root().map(|root| {
|
||||
let root: JSRef<Node> = NodeCast::from_ref(*root);
|
||||
let head_node = root.traverse_preorder().find(|child| {
|
||||
child.type_id() == ElementNodeTypeId(HTMLHeadElementTypeId)
|
||||
child.type_id() == NodeTypeId::Element(ElementTypeId::HTMLHeadElement)
|
||||
});
|
||||
head_node.map(|head| {
|
||||
let title_node = head.children().find(|child| {
|
||||
child.type_id() == ElementNodeTypeId(HTMLTitleElementTypeId)
|
||||
child.type_id() == NodeTypeId::Element(ElementTypeId::HTMLTitleElement)
|
||||
});
|
||||
|
||||
match title_node {
|
||||
|
@ -834,8 +836,8 @@ impl<'a> DocumentMethods for JSRef<'a, Document> {
|
|||
let node: JSRef<Node> = NodeCast::from_ref(*root);
|
||||
node.children().find(|child| {
|
||||
match child.type_id() {
|
||||
ElementNodeTypeId(HTMLBodyElementTypeId) |
|
||||
ElementNodeTypeId(HTMLFrameSetElementTypeId) => true,
|
||||
NodeTypeId::Element(ElementTypeId::HTMLBodyElement) |
|
||||
NodeTypeId::Element(ElementTypeId::HTMLFrameSetElement) => true,
|
||||
_ => false
|
||||
}
|
||||
}).map(|node| {
|
||||
|
@ -854,8 +856,8 @@ impl<'a> DocumentMethods for JSRef<'a, Document> {
|
|||
|
||||
let node: JSRef<Node> = NodeCast::from_ref(new_body);
|
||||
match node.type_id() {
|
||||
ElementNodeTypeId(HTMLBodyElementTypeId) |
|
||||
ElementNodeTypeId(HTMLFrameSetElementTypeId) => {}
|
||||
NodeTypeId::Element(ElementTypeId::HTMLBodyElement) |
|
||||
NodeTypeId::Element(ElementTypeId::HTMLFrameSetElement) => {}
|
||||
_ => return Err(HierarchyRequest)
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue