diff options
author | pylbrecht <palbrecht@mailbox.org> | 2020-03-10 19:48:46 +0100 |
---|---|---|
committer | pylbrecht <palbrecht@mailbox.org> | 2020-03-13 20:48:27 +0100 |
commit | 3ec848f4a81b9162e74a7d4fe662b3a701fbe3ad (patch) | |
tree | 7087d80779eb239a3071bad15456db9b45a67ba6 /components/script/dom/htmlimageelement.rs | |
parent | e3c91f7c4919e96e80c5d0ef8e9acb3e4461b1c3 (diff) | |
download | servo-3ec848f4a81b9162e74a7d4fe662b3a701fbe3ad.tar.gz servo-3ec848f4a81b9162e74a7d4fe662b3a701fbe3ad.zip |
Handle nonexistent images in CanvasRenderingContext2D.createPattern()
Diffstat (limited to 'components/script/dom/htmlimageelement.rs')
-rw-r--r-- | components/script/dom/htmlimageelement.rs | 11 |
1 files changed, 4 insertions, 7 deletions
diff --git a/components/script/dom/htmlimageelement.rs b/components/script/dom/htmlimageelement.rs index a18eedebfb8..95e5c43af66 100644 --- a/components/script/dom/htmlimageelement.rs +++ b/components/script/dom/htmlimageelement.rs @@ -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 { |