Skip to content
Permalink
Browse files
Changed imageBitmap object as mutatable, wrapped origin_clean in cell…
… type
  • Loading branch information
JayalakshmiV committed Apr 23, 2020
1 parent 6fda590 commit fd9e7ae435b9cd0d889e9b16bc67cf229fd59c91
Showing 2 changed files with 8 additions and 9 deletions.
@@ -20,7 +20,7 @@ pub struct ImageBitmap {
width: u32,
height: u32,
bitmap_data: DomRefCell<Vec<u8>>,
origin_clean: bool,
origin_clean: DomRefCell<bool>
}

impl ImageBitmap {
@@ -30,7 +30,7 @@ impl ImageBitmap {
width: width_arg,
height: height_arg,
bitmap_data: DomRefCell::new(vec![]),
origin_clean: origin_clean_arg,
origin_clean: origin_clean_arg
}
}

@@ -906,10 +906,10 @@ impl WindowMethods for Window {
p.reject_error(Error::InvalidState)
}

let imageBitmap = ImageBitmap::new(&global,0,0,true);
let mut imageBitmap = ImageBitmap::new(&global,0,0,true);

//let result = match image {
let (image_data, image_size) = match image {
let promise = match image {
ImageBitmapSource::HTMLCanvasElement(ref canvas) => {
// https://html.spec.whatwg.org/multipage/#check-the-usability-of-the-image-argument
if !canvas.is_valid() {
@@ -921,13 +921,12 @@ impl WindowMethods for Window {

let (data, size) = canvas.fetch_all_data();
imageBitmap.bitmap_data = data;
let mut imageBitmapOrigin = image.origin_clean;
imageBitmap.origin_clean = imageBitmapOrigin;
// p.resolve_native(&());
imageBitmap.origin_clean = canvas.origin_clean;
p.resolve_native(&(imageBitmap));
p
}
};
p.resolve_native(&());
p
promise
}

// https://html.spec.whatwg.org/multipage/#dom-window

0 comments on commit fd9e7ae

Please sign in to comment.