auto merge of #1499 : brunoabinader/servo/documenttype-remove-quirks, r=Ms2ger

TSIA. Closes #1498.
This commit is contained in:
bors-servo 2014-01-15 12:25:11 -08:00
commit c120779bca
3 changed files with 3 additions and 11 deletions

View file

@ -13,35 +13,30 @@ pub struct DocumentType {
name: DOMString, name: DOMString,
public_id: DOMString, public_id: DOMString,
system_id: DOMString, system_id: DOMString,
force_quirks: bool
} }
impl DocumentType { impl DocumentType {
pub fn new_inherited(name: ~str, pub fn new_inherited(name: ~str,
public_id: Option<~str>, public_id: Option<~str>,
system_id: Option<~str>, system_id: Option<~str>,
force_quirks: bool,
document: AbstractDocument) document: AbstractDocument)
-> DocumentType { -> DocumentType {
DocumentType { DocumentType {
node: Node::new_inherited(DoctypeNodeTypeId, document), node: Node::new_inherited(DoctypeNodeTypeId, document),
name: name, name: name,
public_id: public_id.unwrap_or(~""), public_id: public_id.unwrap_or(~""),
system_id: system_id.unwrap_or(~""), system_id: system_id.unwrap_or(~"")
force_quirks: force_quirks,
} }
} }
pub fn new(name: ~str, pub fn new(name: ~str,
public_id: Option<~str>, public_id: Option<~str>,
system_id: Option<~str>, system_id: Option<~str>,
force_quirks: bool,
document: AbstractDocument) document: AbstractDocument)
-> AbstractNode { -> AbstractNode {
let documenttype = DocumentType::new_inherited(name, let documenttype = DocumentType::new_inherited(name,
public_id, public_id,
system_id, system_id,
force_quirks,
document); document);
Node::reflect_node(@mut documenttype, document, DocumentTypeBinding::Wrap) Node::reflect_node(@mut documenttype, document, DocumentTypeBinding::Wrap)
} }

View file

@ -43,15 +43,13 @@ impl Reflectable for DOMImplementation {
impl DOMImplementation { impl DOMImplementation {
// http://dom.spec.whatwg.org/#dom-domimplementation-createdocumenttype // http://dom.spec.whatwg.org/#dom-domimplementation-createdocumenttype
pub fn CreateDocumentType(&self, qname: DOMString, pubid: DOMString, sysid: DOMString) -> Fallible<AbstractNode> { pub fn CreateDocumentType(&self, qname: DOMString, pubid: DOMString, sysid: DOMString) -> Fallible<AbstractNode> {
// FIXME: To be removed in https://github.com/mozilla/servo/issues/1498
let force_quirks : bool = false;
match xml_name_type(qname) { match xml_name_type(qname) {
// Step 1. // Step 1.
InvalidXMLName => Err(InvalidCharacter), InvalidXMLName => Err(InvalidCharacter),
// Step 2. // Step 2.
Name => Err(NamespaceError), Name => Err(NamespaceError),
// Step 3. // Step 3.
QName => Ok(DocumentType::new(qname, Some(pubid), Some(sysid), force_quirks, self.owner.Document())) QName => Ok(DocumentType::new(qname, Some(pubid), Some(sysid), self.owner.Document()))
} }
} }
} }

View file

@ -312,11 +312,10 @@ pub fn parse_html(cx: *JSContext,
let ~hubbub::Doctype {name: name, let ~hubbub::Doctype {name: name,
public_id: public_id, public_id: public_id,
system_id: system_id, system_id: system_id,
force_quirks: force_quirks } = doctype; force_quirks: _ } = doctype;
let node = DocumentType::new(name, let node = DocumentType::new(name,
public_id, public_id,
system_id, system_id,
force_quirks,
document); document);
unsafe { unsafe {
node.to_hubbub_node() node.to_hubbub_node()