diff options
Diffstat (limited to 'components/script/dom')
-rw-r--r-- | components/script/dom/documenttype.rs | 24 | ||||
-rw-r--r-- | components/script/dom/htmlserializer.rs | 2 | ||||
-rw-r--r-- | components/script/dom/node.rs | 14 |
3 files changed, 28 insertions, 12 deletions
diff --git a/components/script/dom/documenttype.rs b/components/script/dom/documenttype.rs index 8d902a34b26..6983e6eb19b 100644 --- a/components/script/dom/documenttype.rs +++ b/components/script/dom/documenttype.rs @@ -15,11 +15,12 @@ use servo_util::str::DOMString; /// The `DOCTYPE` tag. #[jstraceable] #[must_root] +#[privatize] pub struct DocumentType { - pub node: Node, - pub name: DOMString, - pub public_id: DOMString, - pub system_id: DOMString, + node: Node, + name: DOMString, + public_id: DOMString, + system_id: DOMString, } impl DocumentTypeDerived for EventTarget { @@ -53,6 +54,21 @@ impl DocumentType { document); Node::reflect_node(box documenttype, document, DocumentTypeBinding::Wrap) } + + #[inline] + pub fn name<'a>(&'a self) -> &'a DOMString { + &self.name + } + + #[inline] + pub fn public_id<'a>(&'a self) -> &'a DOMString { + &self.public_id + } + + #[inline] + pub fn system_id<'a>(&'a self) -> &'a DOMString { + &self.system_id + } } impl<'a> DocumentTypeMethods for JSRef<'a, DocumentType> { diff --git a/components/script/dom/htmlserializer.rs b/components/script/dom/htmlserializer.rs index aab4c8d922d..07c5b3d7121 100644 --- a/components/script/dom/htmlserializer.rs +++ b/components/script/dom/htmlserializer.rs @@ -101,7 +101,7 @@ fn serialize_processing_instruction(processing_instruction: JSRef<ProcessingInst fn serialize_doctype(doctype: JSRef<DocumentType>, html: &mut String) { html.push_str("<!DOCTYPE"); - html.push_str(doctype.name.as_slice()); + html.push_str(doctype.name().as_slice()); html.push_char('>'); } diff --git a/components/script/dom/node.rs b/components/script/dom/node.rs index 3f657b2a755..8ff8b29eca6 100644 --- a/components/script/dom/node.rs +++ b/components/script/dom/node.rs @@ -1458,9 +1458,9 @@ impl Node { let copy: Root<Node> = match node.type_id() { DoctypeNodeTypeId => { let doctype: JSRef<DocumentType> = DocumentTypeCast::to_ref(node).unwrap(); - let doctype = DocumentType::new(doctype.name.clone(), - Some(doctype.public_id.clone()), - Some(doctype.system_id.clone()), *document); + let doctype = DocumentType::new(doctype.name().clone(), + Some(doctype.public_id().clone()), + Some(doctype.system_id().clone()), *document); NodeCast::from_temporary(doctype) }, DocumentFragmentNodeTypeId => { @@ -1612,7 +1612,7 @@ impl<'a> NodeMethods for JSRef<'a, Node> { CommentNodeTypeId => "#comment".to_string(), DoctypeNodeTypeId => { let doctype: JSRef<DocumentType> = DocumentTypeCast::to_ref(self).unwrap(); - doctype.name.clone() + doctype.name().clone() }, DocumentFragmentNodeTypeId => "#document-fragment".to_string(), DocumentNodeTypeId => "#document".to_string() @@ -1959,9 +1959,9 @@ impl<'a> NodeMethods for JSRef<'a, Node> { fn is_equal_doctype(node: JSRef<Node>, other: JSRef<Node>) -> bool { let doctype: JSRef<DocumentType> = DocumentTypeCast::to_ref(node).unwrap(); let other_doctype: JSRef<DocumentType> = DocumentTypeCast::to_ref(other).unwrap(); - (doctype.name == other_doctype.name) && - (doctype.public_id == other_doctype.public_id) && - (doctype.system_id == other_doctype.system_id) + (*doctype.name() == *other_doctype.name()) && + (*doctype.public_id() == *other_doctype.public_id()) && + (*doctype.system_id() == *other_doctype.system_id()) } fn is_equal_element(node: JSRef<Node>, other: JSRef<Node>) -> bool { let element: JSRef<Element> = ElementCast::to_ref(node).unwrap(); |