| Index: third_party/WebKit/Source/core/html/ImageData.cpp
|
| diff --git a/third_party/WebKit/Source/core/html/ImageData.cpp b/third_party/WebKit/Source/core/html/ImageData.cpp
|
| index 5cf5773b2eb3a0edba6703f048236006d606eb2f..68e82d65e12fd1d190df327545d7e75dbdb34abb 100644
|
| --- a/third_party/WebKit/Source/core/html/ImageData.cpp
|
| +++ b/third_party/WebKit/Source/core/html/ImageData.cpp
|
| @@ -146,17 +146,18 @@ ImageData* ImageData::create(DOMUint8ClampedArray* data, unsigned width, unsigne
|
| return new ImageData(IntSize(width, height), data);
|
| }
|
|
|
| -ScriptPromise ImageData::createImageBitmap(ScriptState* scriptState, EventTarget& eventTarget, int sx, int sy, int sw, int sh, const ImageBitmapOptions& options, ExceptionState& exceptionState)
|
| +ScriptPromise ImageData::createImageBitmap(ScriptState* scriptState, EventTarget& eventTarget, Optional<IntRect> cropRect, const ImageBitmapOptions& options, ExceptionState& exceptionState)
|
| {
|
| - 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();
|
| - }
|
| if (data()->bufferBase()->isNeutered()) {
|
| exceptionState.throwDOMException(InvalidStateError, "The source data has been neutered.");
|
| return ScriptPromise();
|
| }
|
| - return ImageBitmapSource::fulfillImageBitmap(scriptState, ImageBitmap::create(this, IntRect(sx, sy, sw, sh), options));
|
| + if (!ImageBitmap::isResizeOptionValid(options, exceptionState))
|
| + return ScriptPromise();
|
| + return ImageBitmapSource::fulfillImageBitmap(scriptState, ImageBitmap::create(this, cropRect, options));
|
| }
|
|
|
| v8::Local<v8::Object> ImageData::associateWithWrapper(v8::Isolate* isolate, const WrapperTypeInfo* wrapperType, v8::Local<v8::Object> wrapper)
|
|
|