Skip to content

Commit

Permalink
Fix #1057: make createImageBitmap throw when img has 0 size
Browse files Browse the repository at this point in the history
Since the spec has no provisions for handling ImageBitmaps that
have no bitmap data, it is important to explicitly disallow
the creation of an ImageBitmap with a width or height of 0. With this
change, createImageBitmap will throw an exception when a source
image has a dimension of 0 *and* no crop rect is specified.
  • Loading branch information
junov authored and domenic committed Apr 26, 2016
1 parent caf203f commit 2749fa5
Showing 1 changed file with 11 additions and 2 deletions.
13 changes: 11 additions & 2 deletions source
Original file line number Diff line number Diff line change
Expand Up @@ -92297,8 +92297,17 @@ dictionary <dfn>ImageBitmapOptions</dfn> {
return a promise rejected with an <code>InvalidStateError</code> exception and abort these
steps.</p></li>

<li><p>If <var>image</var>'s media data has no intrinsic dimensions (e.g. it's a vector
graphic with no specified content size), then return a promise rejected with an
<li><p>If <var>image</var>'s media data has no <span>intrinsic dimensions</span> (e.g. it's a
vector graphic with no specified content size), then return a promise rejected with an
<code>InvalidStateError</code> exception and abort these steps.</p></li>

<li><p>If the <var>sw</var> and <var>sh</var> arguments are not specified and
<var>image</var>'s media data has both or either of its <span>intrinsic width</span> and
<span>intrinsic height</span> values equal to 0, then return a promise rejected with an
<code>InvalidStateError</code> exception and abort these steps.</p></li>

<li><p>If the <var>sh</var> argument is not specified and <var>image</var>'s media data has
an <span>intrinsic height</span> of 0, then return a promise rejected with an
<code>InvalidStateError</code> exception and abort these steps.</p></li>

<li><p>Create a new <code>ImageBitmap</code> object.</p></li>
Expand Down

0 comments on commit 2749fa5

Please sign in to comment.