Skip to content

Commit

Permalink
Rollup merge of servo#6974 - dzbarsky:tiny-create, r=jdm
Browse files Browse the repository at this point in the history
<!-- Reviewable:start -->
[<img src=\"https://reviewable.io/review_button.png\" height=40 alt=\"Review on Reviewable\"/>](https://reviewable.io/reviews/servo/servo/6974)
<!-- Reviewable:end -->
  • Loading branch information
Manishearth committed Aug 5, 2015
2 parents d5ea08e + 2fb5fda commit c40e719
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 6 deletions.
5 changes: 4 additions & 1 deletion components/script/dom/canvasrenderingcontext2d.rs
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ use num::{Float, ToPrimitive};
use std::borrow::ToOwned;
use std::cell::RefCell;
use std::fmt;
use std::cmp;
use std::sync::mpsc::channel;

use util::str::DOMString;
Expand Down Expand Up @@ -954,7 +955,9 @@ impl<'a> CanvasRenderingContext2DMethods for &'a CanvasRenderingContext2D {
return Err(IndexSize)
}

Ok(ImageData::new(self.global.root().r(), sw.abs().to_u32().unwrap(), sh.abs().to_u32().unwrap(), None))
let sw = cmp::max(1, sw.abs().to_u32().unwrap());
let sh = cmp::max(1, sh.abs().to_u32().unwrap());
Ok(ImageData::new(self.global.root().r(), sw, sh, None))
}

// https://html.spec.whatwg.org/multipage/#dom-context-2d-createimagedata
Expand Down

This file was deleted.

0 comments on commit c40e719

Please sign in to comment.