mirror of
https://github.com/servo/servo.git
synced 2025-08-03 20:50:07 +01:00
Add TreeWalker blob.
This commit is contained in:
parent
1e3dc0341b
commit
94cd981086
4 changed files with 60 additions and 0 deletions
35
src/components/script/dom/treewalker.rs
Normal file
35
src/components/script/dom/treewalker.rs
Normal 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_
|
||||
}
|
||||
}
|
23
src/components/script/dom/webidls/TreeWalker.webidl
Normal file
23
src/components/script/dom/webidls/TreeWalker.webidl
Normal 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();
|
||||
};
|
|
@ -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;
|
||||
|
|
|
@ -155,6 +155,7 @@ var interfaceNamesInGlobalScope = [
|
|||
"Screen",
|
||||
"TestBinding", // XXX
|
||||
"Text",
|
||||
"TreeWalker",
|
||||
"UIEvent",
|
||||
"URLSearchParams",
|
||||
"ValidityState",
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue