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:
Bruno de Oliveira Abinader 2014-01-13 17:10:58 -04:00
parent 8f0f2d9ef5
commit 60dd40f412
7 changed files with 97 additions and 4 deletions

View file

@ -0,0 +1,36 @@
/* This Source Code Form is subject to the terms of the Mozilla Public
* 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::bindings::codegen::DOMImplementationBinding;
use dom::bindings::utils::{Reflector, Reflectable, reflect_dom_object};
use dom::window::Window;
pub struct DOMImplementation {
owner: @mut Window,
reflector_: Reflector
}
impl DOMImplementation {
pub fn new_inherited(owner: @mut Window) -> DOMImplementation {
DOMImplementation {
owner: owner,
reflector_: Reflector::new()
}
}
pub fn new(owner: @mut Window) -> @mut DOMImplementation {
reflect_dom_object(@mut DOMImplementation::new_inherited(owner), owner,
DOMImplementationBinding::Wrap)
}
}
impl Reflectable for DOMImplementation {
fn reflector<'a>(&'a self) -> &'a Reflector {
&self.reflector_
}
fn mut_reflector<'a>(&'a mut self) -> &'a mut Reflector {
&mut self.reflector_
}
}