mirror of
https://github.com/servo/servo.git
synced 2025-06-24 09:04:33 +01:00
Add DOMImplementation skeleton
Creates a DOMImplementation struct corresponding to DOMImplementation WebIDL. Also implements a getter for Document::implementation. Closes #1486.
This commit is contained in:
parent
8f0f2d9ef5
commit
60dd40f412
7 changed files with 97 additions and 4 deletions
|
@ -9,6 +9,7 @@ use dom::bindings::utils::{ErrorResult, Fallible, NotSupported, InvalidCharacter
|
|||
use dom::bindings::utils::DOMString;
|
||||
use dom::bindings::utils::{xml_name_type, InvalidXMLName};
|
||||
use dom::documentfragment::DocumentFragment;
|
||||
use dom::domimplementation::DOMImplementation;
|
||||
use dom::element::{Element};
|
||||
use dom::element::{HTMLHtmlElementTypeId, HTMLHeadElementTypeId, HTMLTitleElementTypeId, HTMLBodyElementTypeId, HTMLFrameSetElementTypeId};
|
||||
use dom::event::{AbstractEvent, Event};
|
||||
|
@ -87,7 +88,8 @@ pub struct Document {
|
|||
window: @mut Window,
|
||||
doctype: DocumentType,
|
||||
title: ~str,
|
||||
idmap: HashMap<DOMString, AbstractNode>
|
||||
idmap: HashMap<DOMString, AbstractNode>,
|
||||
implementation: Option<@mut DOMImplementation>
|
||||
}
|
||||
|
||||
impl Document {
|
||||
|
@ -119,7 +121,8 @@ impl Document {
|
|||
window: window,
|
||||
doctype: doctype,
|
||||
title: ~"",
|
||||
idmap: HashMap::new()
|
||||
idmap: HashMap::new(),
|
||||
implementation: None
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -156,6 +159,13 @@ impl Reflectable for Document {
|
|||
}
|
||||
|
||||
impl Document {
|
||||
pub fn Implementation(&mut self) -> @mut DOMImplementation {
|
||||
if self.implementation.is_none() {
|
||||
self.implementation = Some(DOMImplementation::new(self.window));
|
||||
}
|
||||
self.implementation.unwrap()
|
||||
}
|
||||
|
||||
pub fn GetDoctype(&self) -> Option<AbstractNode> {
|
||||
self.node.children().find(|child| child.is_doctype())
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue