Diff
Modified: trunk/LayoutTests/ChangeLog (226499 => 226500)
--- trunk/LayoutTests/ChangeLog 2018-01-08 06:00:43 UTC (rev 226499)
+++ trunk/LayoutTests/ChangeLog 2018-01-08 07:23:30 UTC (rev 226500)
@@ -1,3 +1,15 @@
+2018-01-07 Ms2ger <ms2...@igalia.com>
+
+ Implement createImageBitmap(ImageBitmap)
+ https://bugs.webkit.org/show_bug.cgi?id=181287
+
+ Reviewed by Darin Adler.
+
+ * platform/gtk/imported/w3c/web-platform-tests/2dcontext/imagebitmap/createImageBitmap-drawImage-expected.txt: rebaseline.
+ * platform/gtk/imported/w3c/web-platform-tests/2dcontext/imagebitmap/createImageBitmap-invalid-args-expected.txt: rebaseline.
+ * platform/wpe/imported/w3c/web-platform-tests/2dcontext/imagebitmap/createImageBitmap-drawImage-expected.txt: rebaseline.
+ * platform/wpe/imported/w3c/web-platform-tests/2dcontext/imagebitmap/createImageBitmap-invalid-args-expected.txt: rebaseline.
+
2018-01-07 Ryosuke Niwa <rn...@webkit.org>
Reduce the precision of "high" resolution time to 1ms
Modified: trunk/LayoutTests/imported/w3c/ChangeLog (226499 => 226500)
--- trunk/LayoutTests/imported/w3c/ChangeLog 2018-01-08 06:00:43 UTC (rev 226499)
+++ trunk/LayoutTests/imported/w3c/ChangeLog 2018-01-08 07:23:30 UTC (rev 226500)
@@ -1,3 +1,12 @@
+2018-01-07 Ms2ger <ms2...@igalia.com>
+
+ Implement createImageBitmap(ImageBitmap)
+ https://bugs.webkit.org/show_bug.cgi?id=181287
+
+ Reviewed by Darin Adler.
+
+ * web-platform-tests/2dcontext/imagebitmap/createImageBitmap-drawImage-expected.txt: rebaseline.
+
2018-01-05 Alex Christensen <achristen...@webkit.org>
Forbid < and > in URL hosts
Modified: trunk/LayoutTests/imported/w3c/web-platform-tests/2dcontext/imagebitmap/createImageBitmap-drawImage-expected.txt (226499 => 226500)
--- trunk/LayoutTests/imported/w3c/web-platform-tests/2dcontext/imagebitmap/createImageBitmap-drawImage-expected.txt 2018-01-08 06:00:43 UTC (rev 226499)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/2dcontext/imagebitmap/createImageBitmap-drawImage-expected.txt 2018-01-08 07:23:30 UTC (rev 226500)
@@ -4,7 +4,7 @@
PASS createImageBitmap from a HTMLImageElement, and drawImage on the created ImageBitmap
FAIL createImageBitmap from a Blob, and drawImage on the created ImageBitmap promise_test: Unhandled rejection with value: object "TypeError: createImageBitmap with ArrayBuffer or Blob is not implemented"
PASS createImageBitmap from a HTMLCanvasElement, and drawImage on the created ImageBitmap
-FAIL createImageBitmap from an ImageBitmap, and drawImage on the created ImageBitmap promise_test: Unhandled rejection with value: object "TypeError: createImageBitmap with ImageBitmap is not implemented"
+PASS createImageBitmap from an ImageBitmap, and drawImage on the created ImageBitmap
FAIL createImageBitmap from an ImageData, and drawImage on the created ImageBitmap promise_test: Unhandled rejection with value: object "TypeError: createImageBitmap with ImageData is not implemented"
TIMEOUT createImageBitmap from a HTMLVideoElement, and drawImage on the created ImageBitmap Test timed out
Modified: trunk/LayoutTests/platform/gtk/imported/w3c/web-platform-tests/2dcontext/imagebitmap/createImageBitmap-drawImage-expected.txt (226499 => 226500)
--- trunk/LayoutTests/platform/gtk/imported/w3c/web-platform-tests/2dcontext/imagebitmap/createImageBitmap-drawImage-expected.txt 2018-01-08 06:00:43 UTC (rev 226499)
+++ trunk/LayoutTests/platform/gtk/imported/w3c/web-platform-tests/2dcontext/imagebitmap/createImageBitmap-drawImage-expected.txt 2018-01-08 07:23:30 UTC (rev 226500)
@@ -2,7 +2,7 @@
PASS createImageBitmap from a HTMLImageElement, and drawImage on the created ImageBitmap
FAIL createImageBitmap from a Blob, and drawImage on the created ImageBitmap promise_test: Unhandled rejection with value: object "TypeError: createImageBitmap with ArrayBuffer or Blob is not implemented"
PASS createImageBitmap from a HTMLCanvasElement, and drawImage on the created ImageBitmap
-FAIL createImageBitmap from an ImageBitmap, and drawImage on the created ImageBitmap promise_test: Unhandled rejection with value: object "TypeError: createImageBitmap with ImageBitmap is not implemented"
+PASS createImageBitmap from an ImageBitmap, and drawImage on the created ImageBitmap
FAIL createImageBitmap from an ImageData, and drawImage on the created ImageBitmap promise_test: Unhandled rejection with value: object "TypeError: createImageBitmap with ImageData is not implemented"
FAIL createImageBitmap from a HTMLVideoElement, and drawImage on the created ImageBitmap promise_test: Unhandled rejection with value: object "TypeError: createImageBitmap with HTMLVideoElement is not implemented"
Modified: trunk/LayoutTests/platform/gtk/imported/w3c/web-platform-tests/2dcontext/imagebitmap/createImageBitmap-invalid-args-expected.txt (226499 => 226500)
--- trunk/LayoutTests/platform/gtk/imported/w3c/web-platform-tests/2dcontext/imagebitmap/createImageBitmap-invalid-args-expected.txt 2018-01-08 06:00:43 UTC (rev 226499)
+++ trunk/LayoutTests/platform/gtk/imported/w3c/web-platform-tests/2dcontext/imagebitmap/createImageBitmap-invalid-args-expected.txt 2018-01-08 07:23:30 UTC (rev 226500)
@@ -17,7 +17,7 @@
FAIL createImageBitmap with a ImageData source and oversized (unallocatable) crop region rejects with an InvalidStateError DOMException. assert_throws: function "function () { throw e }" threw object "TypeError: createImageBitmap with ImageData is not implemented" ("TypeError") expected object "InvalidStateError" ("InvalidStateError")
PASS createImageBitmap with a ImageBitmap source and sw set to 0 rejects with a RangeError.
PASS createImageBitmap with a ImageBitmap source and sh set to 0 rejects with a RangeError.
-FAIL createImageBitmap with a ImageBitmap source and oversized (unallocatable) crop region rejects with an InvalidStateError DOMException. assert_throws: function "function () { throw e }" threw object "TypeError: createImageBitmap with ImageBitmap is not implemented" ("TypeError") expected object "InvalidStateError" ("InvalidStateError")
+FAIL createImageBitmap with a ImageBitmap source and oversized (unallocatable) crop region rejects with an InvalidStateError DOMException. assert_unreached: Should have rejected: undefined Reached unreachable code
PASS createImageBitmap with a Blob source and sw set to 0 rejects with a RangeError.
PASS createImageBitmap with a Blob source and sh set to 0 rejects with a RangeError.
FAIL createImageBitmap with a Blob source and oversized (unallocatable) crop region rejects with an InvalidStateError DOMException. assert_throws: function "function () { throw e }" threw object "TypeError: createImageBitmap with ArrayBuffer or Blob is not implemented" ("TypeError") expected object "InvalidStateError" ("InvalidStateError")
Modified: trunk/LayoutTests/platform/wpe/imported/w3c/web-platform-tests/2dcontext/imagebitmap/createImageBitmap-drawImage-expected.txt (226499 => 226500)
--- trunk/LayoutTests/platform/wpe/imported/w3c/web-platform-tests/2dcontext/imagebitmap/createImageBitmap-drawImage-expected.txt 2018-01-08 06:00:43 UTC (rev 226499)
+++ trunk/LayoutTests/platform/wpe/imported/w3c/web-platform-tests/2dcontext/imagebitmap/createImageBitmap-drawImage-expected.txt 2018-01-08 07:23:30 UTC (rev 226500)
@@ -2,7 +2,7 @@
PASS createImageBitmap from a HTMLImageElement, and drawImage on the created ImageBitmap
FAIL createImageBitmap from a Blob, and drawImage on the created ImageBitmap promise_test: Unhandled rejection with value: object "TypeError: createImageBitmap with ArrayBuffer or Blob is not implemented"
PASS createImageBitmap from a HTMLCanvasElement, and drawImage on the created ImageBitmap
-FAIL createImageBitmap from an ImageBitmap, and drawImage on the created ImageBitmap promise_test: Unhandled rejection with value: object "TypeError: createImageBitmap with ImageBitmap is not implemented"
+PASS createImageBitmap from an ImageBitmap, and drawImage on the created ImageBitmap
FAIL createImageBitmap from an ImageData, and drawImage on the created ImageBitmap promise_test: Unhandled rejection with value: object "TypeError: createImageBitmap with ImageData is not implemented"
FAIL createImageBitmap from a HTMLVideoElement, and drawImage on the created ImageBitmap promise_test: Unhandled rejection with value: object "TypeError: createImageBitmap with HTMLVideoElement is not implemented"
Modified: trunk/LayoutTests/platform/wpe/imported/w3c/web-platform-tests/2dcontext/imagebitmap/createImageBitmap-invalid-args-expected.txt (226499 => 226500)
--- trunk/LayoutTests/platform/wpe/imported/w3c/web-platform-tests/2dcontext/imagebitmap/createImageBitmap-invalid-args-expected.txt 2018-01-08 06:00:43 UTC (rev 226499)
+++ trunk/LayoutTests/platform/wpe/imported/w3c/web-platform-tests/2dcontext/imagebitmap/createImageBitmap-invalid-args-expected.txt 2018-01-08 07:23:30 UTC (rev 226500)
@@ -17,7 +17,7 @@
FAIL createImageBitmap with a ImageData source and oversized (unallocatable) crop region rejects with an InvalidStateError DOMException. assert_throws: function "function () { throw e }" threw object "TypeError: createImageBitmap with ImageData is not implemented" ("TypeError") expected object "InvalidStateError" ("InvalidStateError")
PASS createImageBitmap with a ImageBitmap source and sw set to 0 rejects with a RangeError.
PASS createImageBitmap with a ImageBitmap source and sh set to 0 rejects with a RangeError.
-FAIL createImageBitmap with a ImageBitmap source and oversized (unallocatable) crop region rejects with an InvalidStateError DOMException. assert_throws: function "function () { throw e }" threw object "TypeError: createImageBitmap with ImageBitmap is not implemented" ("TypeError") expected object "InvalidStateError" ("InvalidStateError")
+FAIL createImageBitmap with a ImageBitmap source and oversized (unallocatable) crop region rejects with an InvalidStateError DOMException. assert_unreached: Should have rejected: undefined Reached unreachable code
PASS createImageBitmap with a Blob source and sw set to 0 rejects with a RangeError.
PASS createImageBitmap with a Blob source and sh set to 0 rejects with a RangeError.
FAIL createImageBitmap with a Blob source and oversized (unallocatable) crop region rejects with an InvalidStateError DOMException. assert_throws: function "function () { throw e }" threw object "TypeError: createImageBitmap with ArrayBuffer or Blob is not implemented" ("TypeError") expected object "InvalidStateError" ("InvalidStateError")
Modified: trunk/Source/WebCore/ChangeLog (226499 => 226500)
--- trunk/Source/WebCore/ChangeLog 2018-01-08 06:00:43 UTC (rev 226499)
+++ trunk/Source/WebCore/ChangeLog 2018-01-08 07:23:30 UTC (rev 226500)
@@ -1,3 +1,16 @@
+2018-01-07 Ms2ger <ms2...@igalia.com>
+
+ Implement createImageBitmap(ImageBitmap)
+ https://bugs.webkit.org/show_bug.cgi?id=181287
+
+ Reviewed by Darin Adler.
+
+ Tests: imported/w3c/web-platform-tests/2dcontext/imagebitmap/createImageBitmap-drawImage.html
+ imported/w3c/web-platform-tests/2dcontext/imagebitmap/createImageBitmap-invalid-args.html
+
+ * html/ImageBitmap.cpp:
+ (WebCore::ImageBitmap::createPromise):
+
2018-01-07 Ryosuke Niwa <rn...@webkit.org>
Reduce the precision of "high" resolution time to 1ms
Modified: trunk/Source/WebCore/html/ImageBitmap.cpp (226499 => 226500)
--- trunk/Source/WebCore/html/ImageBitmap.cpp 2018-01-08 06:00:43 UTC (rev 226499)
+++ trunk/Source/WebCore/html/ImageBitmap.cpp 2018-01-08 07:23:30 UTC (rev 226500)
@@ -394,25 +394,44 @@
void ImageBitmap::createPromise(ScriptExecutionContext&, RefPtr<ImageBitmap>& existingImageBitmap, ImageBitmapOptions&& options, std::optional<IntRect> rect, ImageBitmap::Promise&& promise)
{
- UNUSED_PARAM(existingImageBitmap);
- UNUSED_PARAM(options);
- UNUSED_PARAM(rect);
-
// 2. If image's [[Detached]] internal slot value is true, return a promise
// rejected with an "InvalidStateError" DOMException and abort these steps.
+ if (existingImageBitmap->isDetached() || !existingImageBitmap->buffer()) {
+ promise.reject(InvalidStateError, "Cannot create ImageBitmap from a detached ImageBitmap");
+ return;
+ }
// 3. Create a new ImageBitmap object.
+ auto imageBitmap = create();
// 4. Let the ImageBitmap object's bitmap data be a copy of the image argument's
// bitmap data, cropped to the source rectangle with formatting.
+ auto sourceRectangle = croppedSourceRectangleWithFormatting(existingImageBitmap->buffer()->logicalSize(), options, WTFMove(rect));
+ if (sourceRectangle.hasException()) {
+ promise.reject(sourceRectangle.releaseException());
+ return;
+ }
+ auto outputSize = outputSizeForSourceRectangle(sourceRectangle.returnValue(), options);
+ auto bitmapData = ImageBuffer::create(FloatSize(outputSize.width(), outputSize.height()), bufferRenderingMode);
+
+ auto imageForRender = existingImageBitmap->buffer()->copyImage();
+
+ FloatRect destRect(FloatPoint(), outputSize);
+ ImagePaintingOptions paintingOptions;
+ paintingOptions.m_interpolationQuality = interpolationQualityForResizeQuality(options.resizeQuality);
+
+ bitmapData->context().drawImage(*imageForRender, destRect, sourceRectangle.releaseReturnValue(), paintingOptions);
+
+ imageBitmap->m_bitmapData = WTFMove(bitmapData);
+
// 5. Set the origin-clean flag of the ImageBitmap object's bitmap to the same
// value as the origin-clean flag of the bitmap of the image argument.
+ imageBitmap->m_originClean = existingImageBitmap->originClean();
// 6. Return a new promise, but continue running these steps in parallel.
-
// 7. Resolve the promise with the new ImageBitmap object as the value.
- promise.reject(TypeError, "createImageBitmap with ImageBitmap is not implemented");
+ promise.resolve(WTFMove(imageBitmap));
}
class PendingImageBitmap final : public ActiveDOMObject, public FileReaderLoaderClient {