Replace unsafe_blocks by unsafe_code.

This commit is contained in:
Manish Goregaokar 2015-03-19 07:40:22 +05:30 committed by Ms2ger
parent 4eb26065ac
commit 3479d3fa7f
53 changed files with 151 additions and 57 deletions

View file

@ -63,21 +63,27 @@ impl HTMLCanvasElement {
}
pub trait LayoutHTMLCanvasElementHelpers {
#[allow(unsafe_code)]
unsafe fn get_renderer(&self) -> Option<Sender<CanvasMsg>>;
#[allow(unsafe_code)]
unsafe fn get_canvas_width(&self) -> u32;
#[allow(unsafe_code)]
unsafe fn get_canvas_height(&self) -> u32;
}
impl LayoutHTMLCanvasElementHelpers for LayoutJS<HTMLCanvasElement> {
#[allow(unsafe_code)]
unsafe fn get_renderer(&self) -> Option<Sender<CanvasMsg>> {
let context = (*self.unsafe_get()).context.get_inner_as_layout();
context.map(|cx| cx.get_renderer())
}
#[allow(unsafe_code)]
unsafe fn get_canvas_width(&self) -> u32 {
(*self.unsafe_get()).width.get()
}
#[allow(unsafe_code)]
unsafe fn get_canvas_height(&self) -> u32 {
(*self.unsafe_get()).height.get()
}