mirror of
https://github.com/servo/servo.git
synced 2025-08-04 21:20:23 +01:00
Reduce scope of unsafe block in LayoutHTMLCanvasElementHelpers::data
This commit is contained in:
parent
5ff931d171
commit
a913c6650d
1 changed files with 15 additions and 15 deletions
|
@ -123,8 +123,8 @@ pub trait LayoutHTMLCanvasElementHelpers {
|
|||
impl LayoutHTMLCanvasElementHelpers for LayoutDom<'_, HTMLCanvasElement> {
|
||||
#[allow(unsafe_code)]
|
||||
fn data(self) -> HTMLCanvasData {
|
||||
unsafe {
|
||||
let source = match self.unsafe_get().context.borrow_for_layout().as_ref() {
|
||||
let source = unsafe {
|
||||
match self.unsafe_get().context.borrow_for_layout().as_ref() {
|
||||
Some(&CanvasContext::Context2d(ref context)) => {
|
||||
HTMLCanvasDataSource::Image(Some(context.to_layout().get_ipc_renderer()))
|
||||
},
|
||||
|
@ -135,6 +135,7 @@ impl LayoutHTMLCanvasElementHelpers for LayoutDom<'_, HTMLCanvasElement> {
|
|||
context.to_layout().canvas_data_source()
|
||||
},
|
||||
None => HTMLCanvasDataSource::Image(None),
|
||||
}
|
||||
};
|
||||
|
||||
let width_attr = self
|
||||
|
@ -150,7 +151,6 @@ impl LayoutHTMLCanvasElementHelpers for LayoutDom<'_, HTMLCanvasElement> {
|
|||
canvas_id: self.get_canvas_id_for_layout(),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
fn get_width(self) -> LengthOrPercentageOrAuto {
|
||||
self.upcast::<Element>()
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue