| Index: third_party/WebKit/Source/modules/shapedetection/ShapeDetector.cpp
|
| diff --git a/third_party/WebKit/Source/modules/shapedetection/ShapeDetector.cpp b/third_party/WebKit/Source/modules/shapedetection/ShapeDetector.cpp
|
| index 241ac7cd5075f7965115e0e04510165fc75d4512..610e4d35c8f1a896a37f1c30a7ff80c781554e0e 100644
|
| --- a/third_party/WebKit/Source/modules/shapedetection/ShapeDetector.cpp
|
| +++ b/third_party/WebKit/Source/modules/shapedetection/ShapeDetector.cpp
|
| @@ -107,6 +107,10 @@ ScriptPromise ShapeDetector::detect(ScriptState* scriptState,
|
| DOMException::create(InvalidStateError, "Invalid element or state."));
|
| return promise;
|
| }
|
| + if (size.isEmpty()) {
|
| + resolver->resolve(HeapVector<Member<DOMRect>>());
|
| + return promise;
|
| + }
|
|
|
| SkPixmap pixmap;
|
| RefPtr<Uint8Array> pixelData;
|
| @@ -150,6 +154,11 @@ ScriptPromise ShapeDetector::detectShapesOnImageData(
|
| ImageData* imageData) {
|
| ScriptPromise promise = resolver->promise();
|
|
|
| + if (imageData->size().isZero()) {
|
| + resolver->resolve(HeapVector<Member<DOMRect>>());
|
| + return promise;
|
| + }
|
| +
|
| uint8_t* const data = imageData->data()->data();
|
| WTF::CheckedNumeric<int> allocationSize = imageData->size().area() * 4;
|
|
|
| @@ -167,7 +176,6 @@ ScriptPromise ShapeDetector::detectShapesOnImageElement(
|
| const HTMLImageElement* img) {
|
| ScriptPromise promise = resolver->promise();
|
|
|
| - // TODO(mcasas): reconsider this resolve(), https://crbug.com/674306.
|
| if (img->bitmapSourceSize().isZero()) {
|
| resolver->resolve(HeapVector<Member<DOMRect>>());
|
| return promise;
|
|
|