aboutsummaryrefslogtreecommitdiffstats
path: root/components/script/dom
diff options
context:
space:
mode:
authorbors-servo <lbergstrom+bors@mozilla.com>2020-03-13 18:01:32 -0400
committerGitHub <noreply@github.com>2020-03-13 18:01:32 -0400
commit5737db81f99c2a4f277a3c9d8ebd1f1ffb6f4402 (patch)
treef7496e414a597ace671b3cd8eb4c6b40e44708a9 /components/script/dom
parenta6736de09944e343344626a6e4233629a78678b2 (diff)
parent3ec848f4a81b9162e74a7d4fe662b3a701fbe3ad (diff)
downloadservo-5737db81f99c2a4f277a3c9d8ebd1f1ffb6f4402.tar.gz
servo-5737db81f99c2a4f277a3c9d8ebd1f1ffb6f4402.zip
Auto merge of #25940 - pylbrecht:image.handling, r=jdm
Handle nonexistent images in CanvasRenderingContext2D.createPattern() <!-- Thank you for contributing to Servo! Please replace each `[ ]` by `[X]` when the step is complete, and replace `___` with appropriate data: --> - [x] `./mach build -d` does not report any errors - [x] `./mach test-tidy` does not report any errors - [x] These changes fix part of #25331 <!-- Either: --> - [x] There are tests for these changes <!-- Also, please make sure that "Allow edits from maintainers" checkbox is checked, so that we can help you if you get stuck somewhere along the way.--> <!-- Pull requests that do not address these steps are welcome, but they will require additional verification as part of the review process. -->
Diffstat (limited to 'components/script/dom')
-rw-r--r--components/script/dom/htmlimageelement.rs11
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 {