Add TreeWalker blob.

This commit is contained in:
Tetsuharu OHZEKI 2014-08-02 18:18:33 +09:00
parent 1e3dc0341b
commit 94cd981086
4 changed files with 60 additions and 0 deletions

View file

@ -0,0 +1,35 @@
/* 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::Bindings::TreeWalkerBinding;
use dom::bindings::codegen::Bindings::TreeWalkerBinding::TreeWalkerMethods;
use dom::bindings::global::GlobalRef;
use dom::bindings::js::{JSRef, Temporary};
use dom::bindings::utils::{Reflectable, Reflector, reflect_dom_object};
#[deriving(Encodable)]
pub struct TreeWalker {
pub reflector_: Reflector
}
impl TreeWalker {
pub fn new_inherited() -> TreeWalker {
TreeWalker {
reflector_: Reflector::new()
}
}
pub fn new(global: &GlobalRef) -> Temporary<TreeWalker> {
reflect_dom_object(box TreeWalker::new_inherited(), global, TreeWalkerBinding::Wrap)
}
}
impl<'a> TreeWalkerMethods for JSRef<'a, TreeWalker> {
}
impl Reflectable for TreeWalker {
fn reflector<'a>(&'a self) -> &'a Reflector {
&self.reflector_
}
}

View file

@ -0,0 +1,23 @@
/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* 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/.
*
* The origin of this IDL file is
* http://dom.spec.whatwg.org/#interface-treewalker
*/
interface TreeWalker {
// [SameObject] readonly attribute Node root;
// readonly attribute unsigned long whatToShow;
// readonly attribute NodeFilter? filter;
// attribute Node currentNode;
// Node? parentNode();
// Node? firstChild();
// Node? lastChild();
// Node? previousSibling();
// Node? nextSibling();
// Node? previousNode();
// Node? nextNode();
};

View file

@ -180,6 +180,7 @@ pub mod dom {
pub mod progressevent;
pub mod screen;
pub mod text;
pub mod treewalker;
pub mod uievent;
pub mod urlsearchparams;
pub mod validitystate;

View file

@ -155,6 +155,7 @@ var interfaceNamesInGlobalScope = [
"Screen",
"TestBinding", // XXX
"Text",
"TreeWalker",
"UIEvent",
"URLSearchParams",
"ValidityState",