Skip to content

Commit

Permalink
Handle nonexistent images in CanvasRenderingContext2D.createPattern()
Browse files Browse the repository at this point in the history
  • Loading branch information
pylbrecht committed Mar 13, 2020
1 parent e3c91f7 commit 3ec848f
Show file tree
Hide file tree
Showing 12 changed files with 37 additions and 16 deletions.
2 changes: 1 addition & 1 deletion Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

11 changes: 4 additions & 7 deletions components/script/dom/htmlimageelement.rs
Expand Up @@ -167,13 +167,10 @@ impl HTMLImageElement {
// https://html.spec.whatwg.org/multipage/#check-the-usability-of-the-image-argument
pub fn is_usable(&self) -> Fallible<bool> {
// If image has an intrinsic width or intrinsic height (or both) equal to zero, then return bad.
match &self.current_request.borrow().image {
Some(image) => {
if image.width == 0 || image.height == 0 {
return Ok(false);
}
},
None => return Ok(false),
if let Some(image) = &self.current_request.borrow().image {
if image.width == 0 || image.height == 0 {
return Ok(false);
}
}

match self.current_request.borrow().state {
Expand Down
@@ -0,0 +1,4 @@
[2d.drawImage.broken.html]
[Canvas test: 2d.drawImage.broken]
expected: FAIL

@@ -0,0 +1,4 @@
[2d.pattern.image.broken.html]
[Canvas test: 2d.pattern.image.broken]
expected: FAIL

This file was deleted.

@@ -0,0 +1,4 @@
[2d.pattern.image.zeroheight.html]
[Canvas test: 2d.pattern.image.zeroheight]
expected: FAIL

@@ -0,0 +1,4 @@
[2d.pattern.image.zerowidth.html]
[Canvas test: 2d.pattern.image.zerowidth]
expected: FAIL

@@ -0,0 +1,4 @@
[2d.drawImage.broken.html]
[Canvas test: 2d.drawImage.broken]
expected: FAIL

@@ -0,0 +1,4 @@
[2d.pattern.image.broken.html]
[Canvas test: 2d.pattern.image.broken]
expected: FAIL

This file was deleted.

@@ -0,0 +1,4 @@
[2d.pattern.image.zeroheight.html]
[Canvas test: 2d.pattern.image.zeroheight]
expected: FAIL

@@ -0,0 +1,4 @@
[2d.pattern.image.zerowidth.html]
[Canvas test: 2d.pattern.image.zerowidth]
expected: FAIL

0 comments on commit 3ec848f

Please sign in to comment.