mirror of
https://github.com/servo/servo.git
synced 2025-08-03 12:40:06 +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
36
src/components/script/dom/domimplementation.rs
Normal file
36
src/components/script/dom/domimplementation.rs
Normal 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_
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue