Make ClientRectList::rects a Vec.

This commit is contained in:
Ms2ger 2014-04-26 10:28:35 +02:00
parent 0bfbe06f4b
commit 50ab85f3ee

View file

@ -11,13 +11,13 @@ use dom::window::Window;
#[deriving(Encodable)] #[deriving(Encodable)]
pub struct ClientRectList { pub struct ClientRectList {
pub reflector_: Reflector, pub reflector_: Reflector,
pub rects: ~[JS<ClientRect>], pub rects: Vec<JS<ClientRect>>,
pub window: JS<Window>, pub window: JS<Window>,
} }
impl ClientRectList { impl ClientRectList {
pub fn new_inherited(window: JS<Window>, pub fn new_inherited(window: JS<Window>,
rects: ~[JS<ClientRect>]) -> ClientRectList { rects: Vec<JS<ClientRect>>) -> ClientRectList {
ClientRectList { ClientRectList {
reflector_: Reflector::new(), reflector_: Reflector::new(),
rects: rects, rects: rects,
@ -26,7 +26,7 @@ impl ClientRectList {
} }
pub fn new(window: &JS<Window>, pub fn new(window: &JS<Window>,
rects: ~[JS<ClientRect>]) -> JS<ClientRectList> { rects: Vec<JS<ClientRect>>) -> JS<ClientRectList> {
reflect_dom_object(~ClientRectList::new_inherited(window.clone(), rects), reflect_dom_object(~ClientRectList::new_inherited(window.clone(), rects),
window, ClientRectListBinding::Wrap) window, ClientRectListBinding::Wrap)
} }
@ -37,7 +37,7 @@ impl ClientRectList {
pub fn Item(&self, index: u32) -> Option<JS<ClientRect>> { pub fn Item(&self, index: u32) -> Option<JS<ClientRect>> {
if index < self.rects.len() as u32 { if index < self.rects.len() as u32 {
Some(self.rects[index as uint].clone()) Some(self.rects.get(index as uint).clone())
} else { } else {
None None
} }