Implement RadioNodeList

This commit is contained in:
Keith Yeung 2016-01-22 03:24:28 -05:00
parent e93a460db4
commit 9e3af70941
6 changed files with 175 additions and 11 deletions

View file

@ -28,7 +28,7 @@ pub struct NodeList {
impl NodeList {
#[allow(unrooted_must_root)]
fn new_inherited(list_type: NodeListType) -> NodeList {
pub fn new_inherited(list_type: NodeListType) -> NodeList {
NodeList {
reflector_: Reflector::new(),
list_type: list_type,
@ -36,8 +36,7 @@ impl NodeList {
}
#[allow(unrooted_must_root)]
pub fn new(window: &Window,
list_type: NodeListType) -> Root<NodeList> {
pub fn new(window: &Window, list_type: NodeListType) -> Root<NodeList> {
reflect_dom_object(box NodeList::new_inherited(list_type),
GlobalRef::Window(window), NodeListBinding::Wrap)
}
@ -93,6 +92,10 @@ impl NodeList {
panic!("called as_children_list() on a simple node list")
}
}
pub fn get_list_type(&self) -> &NodeListType {
&self.list_type
}
}
#[derive(JSTraceable, HeapSizeOf)]
@ -114,6 +117,10 @@ impl ChildrenList {
}
}
pub fn get_parent_node(&self) -> &Node {
&*self.node
}
pub fn len(&self) -> u32 {
self.node.children_count()
}