mirror of
https://github.com/servo/servo.git
synced 2025-07-23 07:13:52 +01:00
CanGc fixes starting from imagedata.rs (#33808)
* CanGc fixes starting from imagedata.rs Signed-off-by: L Ashwin B <lashwinib@gmail.com> * Update components/script/dom/imagedata.rs Co-authored-by: Josh Matthews <josh@joshmatthews.net> Signed-off-by: chickenleaf <lashwinib@gmail.com> --------- Signed-off-by: L Ashwin B <lashwinib@gmail.com> Signed-off-by: chickenleaf <lashwinib@gmail.com> Co-authored-by: Josh Matthews <josh@joshmatthews.net>
This commit is contained in:
parent
27b25e869b
commit
20a15619f0
5 changed files with 65 additions and 24 deletions
|
@ -39,6 +39,7 @@ impl ImageData {
|
|||
width: u32,
|
||||
height: u32,
|
||||
mut data: Option<Vec<u8>>,
|
||||
can_gc: CanGc,
|
||||
) -> Fallible<DomRoot<ImageData>> {
|
||||
let len = width * height * 4;
|
||||
unsafe {
|
||||
|
@ -48,16 +49,9 @@ impl ImageData {
|
|||
d.resize(len as usize, 0);
|
||||
let data = CreateWith::Slice(&d[..]);
|
||||
Uint8ClampedArray::create(*cx, data, js_object.handle_mut()).unwrap();
|
||||
Self::new_with_jsobject(
|
||||
global,
|
||||
None,
|
||||
width,
|
||||
Some(height),
|
||||
js_object.get(),
|
||||
CanGc::note(),
|
||||
)
|
||||
Self::new_with_jsobject(global, None, width, Some(height), js_object.get(), can_gc)
|
||||
} else {
|
||||
Self::new_without_jsobject(global, None, width, height, CanGc::note())
|
||||
Self::new_without_jsobject(global, None, width, height, can_gc)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue