mirror of
https://github.com/servo/servo.git
synced 2025-10-14 23:40:26 +01:00
Separate the DOM and layout into separate crates.
This commit is contained in:
parent
0ea1a94f8e
commit
bf82bc54f3
156 changed files with 192 additions and 157 deletions
39
src/components/script/dom/clientrectlist.rs
Normal file
39
src/components/script/dom/clientrectlist.rs
Normal file
|
@ -0,0 +1,39 @@
|
|||
/* 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::clientrect::ClientRect;
|
||||
use dom::bindings::utils::WrapperCache;
|
||||
|
||||
pub struct ClientRectList {
|
||||
wrapper: WrapperCache,
|
||||
rects: ~[@mut ClientRect]
|
||||
}
|
||||
|
||||
pub impl ClientRectList {
|
||||
fn new(rects: ~[@mut ClientRect]) -> @mut ClientRectList {
|
||||
let list = @mut ClientRectList {
|
||||
wrapper: WrapperCache::new(),
|
||||
rects: rects
|
||||
};
|
||||
list.init_wrapper();
|
||||
list
|
||||
}
|
||||
|
||||
fn Length(&self) -> u32 {
|
||||
self.rects.len() as u32
|
||||
}
|
||||
|
||||
fn Item(&self, index: u32) -> Option<@mut ClientRect> {
|
||||
if index < self.rects.len() as u32 {
|
||||
Some(self.rects[index])
|
||||
} else {
|
||||
None
|
||||
}
|
||||
}
|
||||
|
||||
fn IndexedGetter(&self, index: u32, found: &mut bool) -> Option<@mut ClientRect> {
|
||||
*found = index < self.rects.len() as u32;
|
||||
self.Item(index)
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue