Skip to content

Commit

Permalink
Changed imageBitmap object as mutatable, wrapped origin_clean in cell…
Browse files Browse the repository at this point in the history
… type
  • Loading branch information
JayalakshmiV committed Apr 23, 2020
1 parent 6fda590 commit fd9e7ae
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 9 deletions.
4 changes: 2 additions & 2 deletions components/script/dom/imagebitmap.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand All @@ -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
}
}

Expand Down
13 changes: 6 additions & 7 deletions components/script/dom/window.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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() {
Expand All @@ -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
Expand Down

0 comments on commit fd9e7ae

Please sign in to comment.