aboutsummaryrefslogtreecommitdiffstats
path: root/src/components/script/dom/document.rs
diff options
context:
space:
mode:
authorMs2ger <ms2ger@gmail.com>2014-02-22 21:03:39 +0100
committerMs2ger <ms2ger@gmail.com>2014-02-24 22:35:28 +0100
commit870ccd95d2fd9afbc0128bd6b44391eb695554c9 (patch)
tree652dca921dcb0a174585a34d300b4f288074fb9c /src/components/script/dom/document.rs
parent5ede84fa46c5aa5fe1d7c969c7c0714a6730b7f1 (diff)
downloadservo-870ccd95d2fd9afbc0128bd6b44391eb695554c9.tar.gz
servo-870ccd95d2fd9afbc0128bd6b44391eb695554c9.zip
Remove DocumentTypeId.
Diffstat (limited to 'src/components/script/dom/document.rs')
-rw-r--r--src/components/script/dom/document.rs27
1 files changed, 16 insertions, 11 deletions
diff --git a/src/components/script/dom/document.rs b/src/components/script/dom/document.rs
index 055a4dcad6d..e839e4aa233 100644
--- a/src/components/script/dom/document.rs
+++ b/src/components/script/dom/document.rs
@@ -45,9 +45,9 @@ use std::hashmap::HashMap;
use extra::serialize::{Encoder, Encodable};
#[deriving(Eq,Encodable)]
-pub enum DocumentTypeId {
- PlainDocumentTypeId,
- HTMLDocumentTypeId
+pub enum IsHTMLDocument {
+ HTMLDocument,
+ NonHTMLDocument,
}
#[deriving(Encodable)]
@@ -59,6 +59,7 @@ pub struct Document {
implementation: Option<JS<DOMImplementation>>,
content_type: DOMString,
encoding_name: DOMString,
+ is_html_document: bool,
extra: Untraceable,
}
@@ -75,7 +76,7 @@ impl<S: Encoder> Encodable<S> for Untraceable {
impl DocumentDerived for EventTarget {
fn is_document(&self) -> bool {
match self.type_id {
- NodeTargetTypeId(DocumentNodeTypeId(_)) => true,
+ NodeTargetTypeId(DocumentNodeTypeId) => true,
_ => false
}
}
@@ -97,20 +98,23 @@ impl Document {
raw_doc
}
- pub fn new_inherited(window: JS<Window>, url: Option<Url>, doctype: DocumentTypeId, content_type: Option<DOMString>) -> Document {
+ pub fn new_inherited(window: JS<Window>,
+ url: Option<Url>,
+ is_html_document: IsHTMLDocument,
+ content_type: Option<DOMString>) -> Document {
Document {
- node: Node::new_without_doc(DocumentNodeTypeId(doctype)),
+ node: Node::new_without_doc(DocumentNodeTypeId),
reflector_: Reflector::new(),
window: window,
idmap: HashMap::new(),
implementation: None,
content_type: match content_type {
Some(string) => string.clone(),
- None => match doctype {
+ None => match is_html_document {
// http://dom.spec.whatwg.org/#dom-domimplementation-createhtmldocument
- HTMLDocumentTypeId => ~"text/html",
+ HTMLDocument => ~"text/html",
// http://dom.spec.whatwg.org/#concept-document-content-type
- PlainDocumentTypeId => ~"application/xml"
+ NonHTMLDocument => ~"application/xml"
}
},
extra: Untraceable {
@@ -123,10 +127,11 @@ impl Document {
},
// http://dom.spec.whatwg.org/#concept-document-encoding
encoding_name: ~"utf-8",
+ is_html_document: is_html_document == HTMLDocument,
}
}
- pub fn new(window: &JS<Window>, url: Option<Url>, doctype: DocumentTypeId, content_type: Option<DOMString>) -> JS<Document> {
+ pub fn new(window: &JS<Window>, url: Option<Url>, doctype: IsHTMLDocument, content_type: Option<DOMString>) -> JS<Document> {
let document = Document::new_inherited(window.clone(), url, doctype, content_type);
Document::reflect_document(~document, window, DocumentBinding::Wrap)
}
@@ -135,7 +140,7 @@ impl Document {
impl Document {
// http://dom.spec.whatwg.org/#dom-document
pub fn Constructor(owner: &JS<Window>) -> Fallible<JS<Document>> {
- Ok(Document::new(owner, None, PlainDocumentTypeId, None))
+ Ok(Document::new(owner, None, NonHTMLDocument, None))
}
}