| Index: third_party/WebKit/Source/core/html/HTMLImageElement.cpp
|
| diff --git a/third_party/WebKit/Source/core/html/HTMLImageElement.cpp b/third_party/WebKit/Source/core/html/HTMLImageElement.cpp
|
| index 7511b30e3909957401b419099360b25114d6fa16..2647b3b31e9b2ab662d09933010f0ffcc62df91d 100644
|
| --- a/third_party/WebKit/Source/core/html/HTMLImageElement.cpp
|
| +++ b/third_party/WebKit/Source/core/html/HTMLImageElement.cpp
|
| @@ -687,14 +687,15 @@ void HTMLImageElement::forceReload() const
|
| imageLoader().updateFromElement(ImageLoader::UpdateForcedReload, m_referrerPolicy);
|
| }
|
|
|
| -ScriptPromise HTMLImageElement::createImageBitmap(ScriptState* scriptState, EventTarget& eventTarget, int sx, int sy, int sw, int sh, const ImageBitmapOptions& options, ExceptionState& exceptionState)
|
| +ScriptPromise HTMLImageElement::createImageBitmap(ScriptState* scriptState, EventTarget& eventTarget, Optional<IntRect> cropRect, const ImageBitmapOptions& options, ExceptionState& exceptionState)
|
| {
|
| ASSERT(eventTarget.toLocalDOMWindow());
|
| - if (!sw || !sh) {
|
| - exceptionState.throwDOMException(IndexSizeError, String::format("The source %s provided is 0.", sw ? "height" : "width"));
|
| + if ((cropRect && !ImageBitmap::isSourceSizeValid(cropRect->width(), cropRect->height(), exceptionState))
|
| + || !ImageBitmap::isSourceSizeValid(bitmapSourceSize().width(), bitmapSourceSize().height(), exceptionState))
|
| return ScriptPromise();
|
| - }
|
| - return ImageBitmapSource::fulfillImageBitmap(scriptState, ImageBitmap::create(this, IntRect(sx, sy, sw, sh), eventTarget.toLocalDOMWindow()->document(), options));
|
| + if (!ImageBitmap::isResizeOptionValid(options, exceptionState))
|
| + return ScriptPromise();
|
| + return ImageBitmapSource::fulfillImageBitmap(scriptState, ImageBitmap::create(this, cropRect, eventTarget.toLocalDOMWindow()->document(), options));
|
| }
|
|
|
| void HTMLImageElement::selectSourceURL(ImageLoader::UpdateFromElementBehavior behavior)
|
|
|