mirror of
https://github.com/servo/servo.git
synced 2025-08-05 05:30:08 +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> {
|
impl LayoutHTMLCanvasElementHelpers for LayoutDom<'_, HTMLCanvasElement> {
|
||||||
#[allow(unsafe_code)]
|
#[allow(unsafe_code)]
|
||||||
fn data(self) -> HTMLCanvasData {
|
fn data(self) -> HTMLCanvasData {
|
||||||
unsafe {
|
let source = unsafe {
|
||||||
let source = match self.unsafe_get().context.borrow_for_layout().as_ref() {
|
match self.unsafe_get().context.borrow_for_layout().as_ref() {
|
||||||
Some(&CanvasContext::Context2d(ref context)) => {
|
Some(&CanvasContext::Context2d(ref context)) => {
|
||||||
HTMLCanvasDataSource::Image(Some(context.to_layout().get_ipc_renderer()))
|
HTMLCanvasDataSource::Image(Some(context.to_layout().get_ipc_renderer()))
|
||||||
},
|
},
|
||||||
|
@ -135,6 +135,7 @@ impl LayoutHTMLCanvasElementHelpers for LayoutDom<'_, HTMLCanvasElement> {
|
||||||
context.to_layout().canvas_data_source()
|
context.to_layout().canvas_data_source()
|
||||||
},
|
},
|
||||||
None => HTMLCanvasDataSource::Image(None),
|
None => HTMLCanvasDataSource::Image(None),
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
let width_attr = self
|
let width_attr = self
|
||||||
|
@ -150,7 +151,6 @@ impl LayoutHTMLCanvasElementHelpers for LayoutDom<'_, HTMLCanvasElement> {
|
||||||
canvas_id: self.get_canvas_id_for_layout(),
|
canvas_id: self.get_canvas_id_for_layout(),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
fn get_width(self) -> LengthOrPercentageOrAuto {
|
fn get_width(self) -> LengthOrPercentageOrAuto {
|
||||||
self.upcast::<Element>()
|
self.upcast::<Element>()
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue