Implement OffscreenCanvas.copiedImage
authorcommit-queue@webkit.org <commit-queue@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 13 Feb 2020 15:51:50 +0000 (15:51 +0000)
committercommit-queue@webkit.org <commit-queue@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 13 Feb 2020 15:51:50 +0000 (15:51 +0000)
https://bugs.webkit.org/show_bug.cgi?id=206220

Patch by Chris Lord <clord@igalia.com> on 2020-02-13
Reviewed by Žan Doberšek.

Source/WebCore:

No new tests. Covered by existing tests.

* html/OffscreenCanvas.cpp:
(WebCore::OffscreenCanvas::didDraw):
(WebCore::OffscreenCanvas::copiedImage const):
(WebCore::OffscreenCanvas::clearCopiedImage const):
(WebCore::OffscreenCanvas::takeImageBuffer const):
(WebCore::OffscreenCanvas::reset):
* html/OffscreenCanvas.h:

LayoutTests:

* platform/gtk/TestExpectations:
* platform/gtk/imported/w3c/web-platform-tests/2dcontext/imagebitmap/createImageBitmap-drawImage-expected.txt:
* platform/gtk/imported/w3c/web-platform-tests/2dcontext/imagebitmap/createImageBitmap-flipY-expected.txt:
* platform/gtk/imported/w3c/web-platform-tests/2dcontext/imagebitmap/createImageBitmap-invalid-args-expected.txt:
* platform/gtk/imported/w3c/web-platform-tests/2dcontext/imagebitmap/createImageBitmap-serializable-expected.txt:
* platform/wpe/TestExpectations:
* platform/wpe/imported/w3c/web-platform-tests/2dcontext/imagebitmap/createImageBitmap-drawImage-expected.txt:
* platform/wpe/imported/w3c/web-platform-tests/2dcontext/imagebitmap/createImageBitmap-flipY-expected.txt:
* platform/wpe/imported/w3c/web-platform-tests/2dcontext/imagebitmap/createImageBitmap-invalid-args-expected.txt:
* platform/wpe/imported/w3c/web-platform-tests/2dcontext/imagebitmap/createImageBitmap-serializable-expected.txt:
* platform/wpe/imported/w3c/web-platform-tests/2dcontext/imagebitmap/createImageBitmap-transfer-expected.txt:

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@256505 268f45cc-cd09-0410-ab3c-d52691b4dbfc

15 files changed:
LayoutTests/ChangeLog
LayoutTests/platform/gtk/TestExpectations
LayoutTests/platform/gtk/imported/w3c/web-platform-tests/2dcontext/imagebitmap/createImageBitmap-drawImage-expected.txt
LayoutTests/platform/gtk/imported/w3c/web-platform-tests/2dcontext/imagebitmap/createImageBitmap-flipY-expected.txt
LayoutTests/platform/gtk/imported/w3c/web-platform-tests/2dcontext/imagebitmap/createImageBitmap-invalid-args-expected.txt
LayoutTests/platform/gtk/imported/w3c/web-platform-tests/2dcontext/imagebitmap/createImageBitmap-serializable-expected.txt
LayoutTests/platform/wpe/TestExpectations
LayoutTests/platform/wpe/imported/w3c/web-platform-tests/2dcontext/imagebitmap/createImageBitmap-drawImage-expected.txt
LayoutTests/platform/wpe/imported/w3c/web-platform-tests/2dcontext/imagebitmap/createImageBitmap-flipY-expected.txt
LayoutTests/platform/wpe/imported/w3c/web-platform-tests/2dcontext/imagebitmap/createImageBitmap-invalid-args-expected.txt
LayoutTests/platform/wpe/imported/w3c/web-platform-tests/2dcontext/imagebitmap/createImageBitmap-serializable-expected.txt
LayoutTests/platform/wpe/imported/w3c/web-platform-tests/2dcontext/imagebitmap/createImageBitmap-transfer-expected.txt
Source/WebCore/ChangeLog
Source/WebCore/html/OffscreenCanvas.cpp
Source/WebCore/html/OffscreenCanvas.h

index 53fec36..9ef074d 100644 (file)
@@ -1,3 +1,22 @@
+2020-02-13  Chris Lord  <clord@igalia.com>
+
+        Implement OffscreenCanvas.copiedImage
+        https://bugs.webkit.org/show_bug.cgi?id=206220
+
+        Reviewed by Žan Doberšek.
+
+        * platform/gtk/TestExpectations:
+        * platform/gtk/imported/w3c/web-platform-tests/2dcontext/imagebitmap/createImageBitmap-drawImage-expected.txt:
+        * platform/gtk/imported/w3c/web-platform-tests/2dcontext/imagebitmap/createImageBitmap-flipY-expected.txt:
+        * platform/gtk/imported/w3c/web-platform-tests/2dcontext/imagebitmap/createImageBitmap-invalid-args-expected.txt:
+        * platform/gtk/imported/w3c/web-platform-tests/2dcontext/imagebitmap/createImageBitmap-serializable-expected.txt:
+        * platform/wpe/TestExpectations:
+        * platform/wpe/imported/w3c/web-platform-tests/2dcontext/imagebitmap/createImageBitmap-drawImage-expected.txt:
+        * platform/wpe/imported/w3c/web-platform-tests/2dcontext/imagebitmap/createImageBitmap-flipY-expected.txt:
+        * platform/wpe/imported/w3c/web-platform-tests/2dcontext/imagebitmap/createImageBitmap-invalid-args-expected.txt:
+        * platform/wpe/imported/w3c/web-platform-tests/2dcontext/imagebitmap/createImageBitmap-serializable-expected.txt:
+        * platform/wpe/imported/w3c/web-platform-tests/2dcontext/imagebitmap/createImageBitmap-transfer-expected.txt:
+
 2020-02-13  Diego Pino Garcia  <dpino@igalia.com>
 
         [GTK] Gardening, update TestExpectations and rebaselines
index f71e797..61aff71 100644 (file)
@@ -4127,24 +4127,7 @@ webkit.org/b/99036 pointer-lock/pointerlockchange-pointerlockerror-events.html [
 
 webkit.org/b/206264 imported/w3c/web-platform-tests/css/css-multicol/multicol-gap-percentage-001.html [ Failure ]
 
-webkit.org/b/204675 imported/w3c/web-platform-tests/offscreen-canvas/compositing/2d.composite.globalAlpha.canvaspattern.html [ Failure ]
-webkit.org/b/204675 imported/w3c/web-platform-tests/offscreen-canvas/compositing/2d.composite.globalAlpha.canvaspattern.worker.html [ Failure ]
-webkit.org/b/204675 imported/w3c/web-platform-tests/offscreen-canvas/fill-and-stroke-styles/2d.pattern.basic.canvas.html [ Failure ]
-webkit.org/b/204675 imported/w3c/web-platform-tests/offscreen-canvas/fill-and-stroke-styles/2d.pattern.basic.canvas.worker.html [ Failure ]
-webkit.org/b/204675 imported/w3c/web-platform-tests/offscreen-canvas/fill-and-stroke-styles/2d.pattern.basic.nocontext.html [ Failure ]
-webkit.org/b/204675 imported/w3c/web-platform-tests/offscreen-canvas/fill-and-stroke-styles/2d.pattern.basic.nocontext.worker.html [ Failure ]
-webkit.org/b/204675 imported/w3c/web-platform-tests/offscreen-canvas/fill-and-stroke-styles/2d.pattern.modify.canvas1.html [ Failure ]
-webkit.org/b/204675 imported/w3c/web-platform-tests/offscreen-canvas/fill-and-stroke-styles/2d.pattern.modify.canvas1.worker.html [ Failure ]
-webkit.org/b/204675 imported/w3c/web-platform-tests/offscreen-canvas/fill-and-stroke-styles/2d.pattern.modify.canvas2.html [ Failure ]
-webkit.org/b/204675 imported/w3c/web-platform-tests/offscreen-canvas/fill-and-stroke-styles/2d.pattern.modify.canvas2.worker.html [ Failure ]
-webkit.org/b/204675 imported/w3c/web-platform-tests/offscreen-canvas/fill-and-stroke-styles/2d.pattern.paint.orientation.canvas.html [ Failure ]
-webkit.org/b/204675 imported/w3c/web-platform-tests/offscreen-canvas/fill-and-stroke-styles/2d.pattern.paint.orientation.canvas.worker.html [ Failure ]
-webkit.org/b/204675 imported/w3c/web-platform-tests/offscreen-canvas/fill-and-stroke-styles/2d.pattern.repeat.null.html [ Failure ]
-webkit.org/b/204675 imported/w3c/web-platform-tests/offscreen-canvas/fill-and-stroke-styles/2d.pattern.repeat.null.worker.html [ Failure ]
-webkit.org/b/204675 imported/w3c/web-platform-tests/offscreen-canvas/image-smoothing/image.smoothing.html [ Failure ]
-webkit.org/b/204675 imported/w3c/web-platform-tests/offscreen-canvas/image-smoothing/image.smoothing.worker.html [ Failure ]
-webkit.org/b/204675 imported/w3c/web-platform-tests/offscreen-canvas/the-offscreen-canvas/initial.reset.pattern.html [ Failure ]
-webkit.org/b/204675 imported/w3c/web-platform-tests/offscreen-canvas/the-offscreen-canvas/initial.reset.pattern.worker.html [ Failure ]
+webkit.org/b/207016 http/tests/misc/form-submit-file-cross-site-redirect.html [ Failure ]
 
 webkit.org/b/206692 fast/canvas/canvas-fillPath-shadow.html [ Failure ]
 
index 884dd5b..ca5a7d2 100644 (file)
@@ -34,11 +34,11 @@ FAIL createImageBitmap from a vector SVGImageElement scaled down, and drawImage
 FAIL createImageBitmap from a vector SVGImageElement scaled up, and drawImage on the created ImageBitmap promise_test: Unhandled rejection with value: object "TypeError: Type error"
 FAIL createImageBitmap from a vector SVGImageElement resized, and drawImage on the created ImageBitmap promise_test: Unhandled rejection with value: object "TypeError: Type error"
 FAIL createImageBitmap from a vector SVGImageElement with negative sw/sh, and drawImage on the created ImageBitmap promise_test: Unhandled rejection with value: object "TypeError: Type error"
-FAIL createImageBitmap from an OffscreenCanvas, and drawImage on the created ImageBitmap promise_test: Unhandled rejection with value: object "InvalidStateError: Cannot create ImageBitmap from canvas that can't be rendered"
-FAIL createImageBitmap from an OffscreenCanvas scaled down, and drawImage on the created ImageBitmap promise_test: Unhandled rejection with value: object "InvalidStateError: Cannot create ImageBitmap from canvas that can't be rendered"
-FAIL createImageBitmap from an OffscreenCanvas scaled up, and drawImage on the created ImageBitmap promise_test: Unhandled rejection with value: object "InvalidStateError: Cannot create ImageBitmap from canvas that can't be rendered"
-FAIL createImageBitmap from an OffscreenCanvas resized, and drawImage on the created ImageBitmap promise_test: Unhandled rejection with value: object "InvalidStateError: Cannot create ImageBitmap from canvas that can't be rendered"
-FAIL createImageBitmap from an OffscreenCanvas with negative sw/sh, and drawImage on the created ImageBitmap promise_test: Unhandled rejection with value: object "InvalidStateError: Cannot create ImageBitmap from canvas that can't be rendered"
+PASS createImageBitmap from an OffscreenCanvas, and drawImage on the created ImageBitmap 
+PASS createImageBitmap from an OffscreenCanvas scaled down, and drawImage on the created ImageBitmap 
+PASS createImageBitmap from an OffscreenCanvas scaled up, and drawImage on the created ImageBitmap 
+PASS createImageBitmap from an OffscreenCanvas resized, and drawImage on the created ImageBitmap 
+PASS createImageBitmap from an OffscreenCanvas with negative sw/sh, 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 an ImageData scaled down, and drawImage on the created ImageBitmap promise_test: Unhandled rejection with value: object "TypeError: createImageBitmap with ImageData is not implemented"
 FAIL createImageBitmap from an ImageData scaled up, and drawImage on the created ImageBitmap promise_test: Unhandled rejection with value: object "TypeError: createImageBitmap with ImageData is not implemented"
index 26a4ddd..e85bf46 100644 (file)
@@ -13,8 +13,8 @@ FAIL createImageBitmap from a bitmap SVGImageElement imageOrientation: "none", a
 FAIL createImageBitmap from a bitmap SVGImageElement imageOrientation: "flipY", and drawImage on the created ImageBitmap promise_test: Unhandled rejection with value: object "TypeError: Type error"
 FAIL createImageBitmap from a vector SVGImageElement imageOrientation: "none", and drawImage on the created ImageBitmap promise_test: Unhandled rejection with value: object "TypeError: Type error"
 FAIL createImageBitmap from a vector SVGImageElement imageOrientation: "flipY", and drawImage on the created ImageBitmap promise_test: Unhandled rejection with value: object "TypeError: Type error"
-FAIL createImageBitmap from an OffscreenCanvas imageOrientation: "none", and drawImage on the created ImageBitmap promise_test: Unhandled rejection with value: object "InvalidStateError: Cannot create ImageBitmap from canvas that can't be rendered"
-FAIL createImageBitmap from an OffscreenCanvas imageOrientation: "flipY", and drawImage on the created ImageBitmap promise_test: Unhandled rejection with value: object "InvalidStateError: Cannot create ImageBitmap from canvas that can't be rendered"
+PASS createImageBitmap from an OffscreenCanvas imageOrientation: "none", and drawImage on the created ImageBitmap 
+FAIL createImageBitmap from an OffscreenCanvas imageOrientation: "flipY", and drawImage on the created ImageBitmap assert_approx_equals: Red channel of the pixel at (5, 15) expected 255 +/- 10 but got 0
 FAIL createImageBitmap from an ImageData imageOrientation: "none", and drawImage on the created ImageBitmap promise_test: Unhandled rejection with value: object "TypeError: createImageBitmap with ImageData is not implemented"
 FAIL createImageBitmap from an ImageData imageOrientation: "flipY", and drawImage on the created ImageBitmap promise_test: Unhandled rejection with value: object "TypeError: createImageBitmap with ImageData is not implemented"
 PASS createImageBitmap from an ImageBitmap imageOrientation: "none", and drawImage on the created ImageBitmap 
index cd11aec..997dfb7 100644 (file)
@@ -31,7 +31,7 @@ FAIL createImageBitmap with a vector SVGImageElement source and sh set to 0 prom
 FAIL createImageBitmap with a vector SVGImageElement source and oversized (unallocatable) crop region assert_throws: function "() => { throw e }" threw object "TypeError: Type error" that is not a DOMException InvalidStateError: property "code" is equal to undefined, expected 11
 PASS createImageBitmap with an OffscreenCanvas source and sw set to 0 
 PASS createImageBitmap with an OffscreenCanvas source and sh set to 0 
-PASS createImageBitmap with an OffscreenCanvas source and oversized (unallocatable) crop region 
+FAIL createImageBitmap with an OffscreenCanvas source and oversized (unallocatable) crop region assert_equals: expected 100000000 but got 20
 PASS createImageBitmap with an ImageData source and sw set to 0 
 PASS createImageBitmap with an ImageData source and sh set to 0 
 FAIL createImageBitmap with an ImageData source and oversized (unallocatable) crop region assert_throws: function "() => { throw e }" threw object "TypeError: createImageBitmap with ImageData is not implemented" that is not a DOMException InvalidStateError: property "code" is equal to undefined, expected 11
index 3cb0f87..a5ef9b8 100644 (file)
@@ -6,7 +6,7 @@ PASS Serialize ImageBitmap created from a bitmap HTMLImageElement
 PASS Serialize ImageBitmap created from a vector HTMLImageElement 
 FAIL Serialize ImageBitmap created from a bitmap SVGImageElement promise_test: Unhandled rejection with value: object "TypeError: Type error"
 FAIL Serialize ImageBitmap created from a vector SVGImageElement promise_test: Unhandled rejection with value: object "TypeError: Type error"
-FAIL Serialize ImageBitmap created from an OffscreenCanvas promise_test: Unhandled rejection with value: object "InvalidStateError: Cannot create ImageBitmap from canvas that can't be rendered"
+PASS Serialize ImageBitmap created from an OffscreenCanvas 
 FAIL Serialize ImageBitmap created from an ImageData promise_test: Unhandled rejection with value: object "TypeError: createImageBitmap with ImageData is not implemented"
 PASS Serialize ImageBitmap created from an ImageBitmap 
 PASS Serialize ImageBitmap created from a Blob 
index 4dce705..35273a1 100644 (file)
@@ -2215,26 +2215,6 @@ webkit.org/b/203677 imported/w3c/web-platform-tests/svg/import/painting-fill-05-
 webkit.org/b/203677 imported/w3c/web-platform-tests/svg/import/painting-stroke-08-t-manual.svg [ Failure ]
 webkit.org/b/203677 svg/W3C-SVG-1.1/painting-fill-05-b.svg [ Failure ]
 
-webkit.org/b/204675 imported/w3c/web-platform-tests/offscreen-canvas/compositing/2d.composite.globalAlpha.canvaspattern.html [ Failure ]
-webkit.org/b/204675 imported/w3c/web-platform-tests/offscreen-canvas/compositing/2d.composite.globalAlpha.canvaspattern.worker.html [ Failure ]
-webkit.org/b/204675 imported/w3c/web-platform-tests/offscreen-canvas/convert-to-blob/offscreencanvas.convert.to.blob.w.html [ Failure ]
-webkit.org/b/204675 imported/w3c/web-platform-tests/offscreen-canvas/fill-and-stroke-styles/2d.pattern.basic.canvas.html [ Failure ]
-webkit.org/b/204675 imported/w3c/web-platform-tests/offscreen-canvas/fill-and-stroke-styles/2d.pattern.basic.canvas.worker.html [ Failure ]
-webkit.org/b/204675 imported/w3c/web-platform-tests/offscreen-canvas/fill-and-stroke-styles/2d.pattern.basic.nocontext.html [ Failure ]
-webkit.org/b/204675 imported/w3c/web-platform-tests/offscreen-canvas/fill-and-stroke-styles/2d.pattern.basic.nocontext.worker.html [ Failure ]
-webkit.org/b/204675 imported/w3c/web-platform-tests/offscreen-canvas/fill-and-stroke-styles/2d.pattern.modify.canvas1.html [ Failure ]
-webkit.org/b/204675 imported/w3c/web-platform-tests/offscreen-canvas/fill-and-stroke-styles/2d.pattern.modify.canvas1.worker.html [ Failure ]
-webkit.org/b/204675 imported/w3c/web-platform-tests/offscreen-canvas/fill-and-stroke-styles/2d.pattern.modify.canvas2.html [ Failure ]
-webkit.org/b/204675 imported/w3c/web-platform-tests/offscreen-canvas/fill-and-stroke-styles/2d.pattern.modify.canvas2.worker.html [ Failure ]
-webkit.org/b/204675 imported/w3c/web-platform-tests/offscreen-canvas/fill-and-stroke-styles/2d.pattern.paint.orientation.canvas.html [ Failure ]
-webkit.org/b/204675 imported/w3c/web-platform-tests/offscreen-canvas/fill-and-stroke-styles/2d.pattern.paint.orientation.canvas.worker.html [ Failure ]
-webkit.org/b/204675 imported/w3c/web-platform-tests/offscreen-canvas/fill-and-stroke-styles/2d.pattern.repeat.null.html [ Failure ]
-webkit.org/b/204675 imported/w3c/web-platform-tests/offscreen-canvas/fill-and-stroke-styles/2d.pattern.repeat.null.worker.html [ Failure ]
-webkit.org/b/204675 imported/w3c/web-platform-tests/offscreen-canvas/image-smoothing/image.smoothing.html [ Failure ]
-webkit.org/b/204675 imported/w3c/web-platform-tests/offscreen-canvas/image-smoothing/image.smoothing.worker.html [ Failure ]
-webkit.org/b/204675 imported/w3c/web-platform-tests/offscreen-canvas/the-offscreen-canvas/initial.reset.pattern.html [ Failure ]
-webkit.org/b/204675 imported/w3c/web-platform-tests/offscreen-canvas/the-offscreen-canvas/initial.reset.pattern.worker.html [ Failure ]
-
 webkit.org/b/194933 http/tests/cookies/same-site/user-load-cross-site-redirect.php [ Failure ]
 
 webkit.org/b/207678 imported/w3c/web-platform-tests/url/a-element-origin-xhtml.xhtml [ Failure ]
index 884dd5b..ca5a7d2 100644 (file)
@@ -34,11 +34,11 @@ FAIL createImageBitmap from a vector SVGImageElement scaled down, and drawImage
 FAIL createImageBitmap from a vector SVGImageElement scaled up, and drawImage on the created ImageBitmap promise_test: Unhandled rejection with value: object "TypeError: Type error"
 FAIL createImageBitmap from a vector SVGImageElement resized, and drawImage on the created ImageBitmap promise_test: Unhandled rejection with value: object "TypeError: Type error"
 FAIL createImageBitmap from a vector SVGImageElement with negative sw/sh, and drawImage on the created ImageBitmap promise_test: Unhandled rejection with value: object "TypeError: Type error"
-FAIL createImageBitmap from an OffscreenCanvas, and drawImage on the created ImageBitmap promise_test: Unhandled rejection with value: object "InvalidStateError: Cannot create ImageBitmap from canvas that can't be rendered"
-FAIL createImageBitmap from an OffscreenCanvas scaled down, and drawImage on the created ImageBitmap promise_test: Unhandled rejection with value: object "InvalidStateError: Cannot create ImageBitmap from canvas that can't be rendered"
-FAIL createImageBitmap from an OffscreenCanvas scaled up, and drawImage on the created ImageBitmap promise_test: Unhandled rejection with value: object "InvalidStateError: Cannot create ImageBitmap from canvas that can't be rendered"
-FAIL createImageBitmap from an OffscreenCanvas resized, and drawImage on the created ImageBitmap promise_test: Unhandled rejection with value: object "InvalidStateError: Cannot create ImageBitmap from canvas that can't be rendered"
-FAIL createImageBitmap from an OffscreenCanvas with negative sw/sh, and drawImage on the created ImageBitmap promise_test: Unhandled rejection with value: object "InvalidStateError: Cannot create ImageBitmap from canvas that can't be rendered"
+PASS createImageBitmap from an OffscreenCanvas, and drawImage on the created ImageBitmap 
+PASS createImageBitmap from an OffscreenCanvas scaled down, and drawImage on the created ImageBitmap 
+PASS createImageBitmap from an OffscreenCanvas scaled up, and drawImage on the created ImageBitmap 
+PASS createImageBitmap from an OffscreenCanvas resized, and drawImage on the created ImageBitmap 
+PASS createImageBitmap from an OffscreenCanvas with negative sw/sh, 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 an ImageData scaled down, and drawImage on the created ImageBitmap promise_test: Unhandled rejection with value: object "TypeError: createImageBitmap with ImageData is not implemented"
 FAIL createImageBitmap from an ImageData scaled up, and drawImage on the created ImageBitmap promise_test: Unhandled rejection with value: object "TypeError: createImageBitmap with ImageData is not implemented"
index 26a4ddd..e85bf46 100644 (file)
@@ -13,8 +13,8 @@ FAIL createImageBitmap from a bitmap SVGImageElement imageOrientation: "none", a
 FAIL createImageBitmap from a bitmap SVGImageElement imageOrientation: "flipY", and drawImage on the created ImageBitmap promise_test: Unhandled rejection with value: object "TypeError: Type error"
 FAIL createImageBitmap from a vector SVGImageElement imageOrientation: "none", and drawImage on the created ImageBitmap promise_test: Unhandled rejection with value: object "TypeError: Type error"
 FAIL createImageBitmap from a vector SVGImageElement imageOrientation: "flipY", and drawImage on the created ImageBitmap promise_test: Unhandled rejection with value: object "TypeError: Type error"
-FAIL createImageBitmap from an OffscreenCanvas imageOrientation: "none", and drawImage on the created ImageBitmap promise_test: Unhandled rejection with value: object "InvalidStateError: Cannot create ImageBitmap from canvas that can't be rendered"
-FAIL createImageBitmap from an OffscreenCanvas imageOrientation: "flipY", and drawImage on the created ImageBitmap promise_test: Unhandled rejection with value: object "InvalidStateError: Cannot create ImageBitmap from canvas that can't be rendered"
+PASS createImageBitmap from an OffscreenCanvas imageOrientation: "none", and drawImage on the created ImageBitmap 
+FAIL createImageBitmap from an OffscreenCanvas imageOrientation: "flipY", and drawImage on the created ImageBitmap assert_approx_equals: Red channel of the pixel at (5, 15) expected 255 +/- 10 but got 0
 FAIL createImageBitmap from an ImageData imageOrientation: "none", and drawImage on the created ImageBitmap promise_test: Unhandled rejection with value: object "TypeError: createImageBitmap with ImageData is not implemented"
 FAIL createImageBitmap from an ImageData imageOrientation: "flipY", and drawImage on the created ImageBitmap promise_test: Unhandled rejection with value: object "TypeError: createImageBitmap with ImageData is not implemented"
 PASS createImageBitmap from an ImageBitmap imageOrientation: "none", and drawImage on the created ImageBitmap 
index cd11aec..997dfb7 100644 (file)
@@ -31,7 +31,7 @@ FAIL createImageBitmap with a vector SVGImageElement source and sh set to 0 prom
 FAIL createImageBitmap with a vector SVGImageElement source and oversized (unallocatable) crop region assert_throws: function "() => { throw e }" threw object "TypeError: Type error" that is not a DOMException InvalidStateError: property "code" is equal to undefined, expected 11
 PASS createImageBitmap with an OffscreenCanvas source and sw set to 0 
 PASS createImageBitmap with an OffscreenCanvas source and sh set to 0 
-PASS createImageBitmap with an OffscreenCanvas source and oversized (unallocatable) crop region 
+FAIL createImageBitmap with an OffscreenCanvas source and oversized (unallocatable) crop region assert_equals: expected 100000000 but got 20
 PASS createImageBitmap with an ImageData source and sw set to 0 
 PASS createImageBitmap with an ImageData source and sh set to 0 
 FAIL createImageBitmap with an ImageData source and oversized (unallocatable) crop region assert_throws: function "() => { throw e }" threw object "TypeError: createImageBitmap with ImageData is not implemented" that is not a DOMException InvalidStateError: property "code" is equal to undefined, expected 11
index 3cb0f87..a5ef9b8 100644 (file)
@@ -6,7 +6,7 @@ PASS Serialize ImageBitmap created from a bitmap HTMLImageElement
 PASS Serialize ImageBitmap created from a vector HTMLImageElement 
 FAIL Serialize ImageBitmap created from a bitmap SVGImageElement promise_test: Unhandled rejection with value: object "TypeError: Type error"
 FAIL Serialize ImageBitmap created from a vector SVGImageElement promise_test: Unhandled rejection with value: object "TypeError: Type error"
-FAIL Serialize ImageBitmap created from an OffscreenCanvas promise_test: Unhandled rejection with value: object "InvalidStateError: Cannot create ImageBitmap from canvas that can't be rendered"
+PASS Serialize ImageBitmap created from an OffscreenCanvas 
 FAIL Serialize ImageBitmap created from an ImageData promise_test: Unhandled rejection with value: object "TypeError: createImageBitmap with ImageData is not implemented"
 PASS Serialize ImageBitmap created from an ImageBitmap 
 PASS Serialize ImageBitmap created from a Blob 
index 74babc4..fd3d781 100644 (file)
@@ -6,7 +6,7 @@ PASS Transfer ImageBitmap created from a bitmap HTMLImageElement
 PASS Transfer ImageBitmap created from a vector HTMLImageElement 
 FAIL Transfer ImageBitmap created from a bitmap SVGImageElement promise_test: Unhandled rejection with value: object "TypeError: Type error"
 FAIL Transfer ImageBitmap created from a vector SVGImageElement promise_test: Unhandled rejection with value: object "TypeError: Type error"
-FAIL Transfer ImageBitmap created from an OffscreenCanvas promise_test: Unhandled rejection with value: object "InvalidStateError: Cannot create ImageBitmap from canvas that can't be rendered"
+PASS Transfer ImageBitmap created from an OffscreenCanvas 
 FAIL Transfer ImageBitmap created from an ImageData promise_test: Unhandled rejection with value: object "TypeError: createImageBitmap with ImageData is not implemented"
 PASS Transfer ImageBitmap created from an ImageBitmap 
 PASS Transfer ImageBitmap created from a Blob 
index c9cc790..c15b689 100644 (file)
@@ -1,3 +1,20 @@
+2020-02-13  Chris Lord  <clord@igalia.com>
+
+        Implement OffscreenCanvas.copiedImage
+        https://bugs.webkit.org/show_bug.cgi?id=206220
+
+        Reviewed by Žan Doberšek.
+
+        No new tests. Covered by existing tests.
+
+        * html/OffscreenCanvas.cpp:
+        (WebCore::OffscreenCanvas::didDraw):
+        (WebCore::OffscreenCanvas::copiedImage const):
+        (WebCore::OffscreenCanvas::clearCopiedImage const):
+        (WebCore::OffscreenCanvas::takeImageBuffer const):
+        (WebCore::OffscreenCanvas::reset):
+        * html/OffscreenCanvas.h:
+
 2020-02-12  Yoshiaki Jitsukawa  <yoshiaki.jitsukawa@sony.com>
 
         [WebCrypto][CommonCrypto] Incorrect AES-CTR with counterLength longer than 64
index 9857110..6bdbe2f 100644 (file)
@@ -257,9 +257,28 @@ void OffscreenCanvas::convertToBlob(ImageEncodeOptions&& options, Ref<DeferredPr
 
 void OffscreenCanvas::didDraw(const FloatRect& rect)
 {
+    clearCopiedImage();
     notifyObserversCanvasChanged(rect);
 }
 
+Image* OffscreenCanvas::copiedImage() const
+{
+    if (m_detached)
+        return nullptr;
+
+    if (!m_copiedImage && buffer()) {
+        if (m_context)
+            m_context->paintRenderingResultsToCanvas();
+        m_copiedImage = buffer()->copyImage(CopyBackingStore, PreserveResolution::Yes);
+    }
+    return m_copiedImage.get();
+}
+
+void OffscreenCanvas::clearCopiedImage() const
+{
+    m_copiedImage = nullptr;
+}
+
 SecurityOrigin* OffscreenCanvas::securityOrigin() const
 {
     auto& context = *canvasBaseScriptExecutionContext();
@@ -316,6 +335,7 @@ std::unique_ptr<ImageBuffer> OffscreenCanvas::takeImageBuffer() const
     if (size().isEmpty())
         return nullptr;
 
+    clearCopiedImage();
     return setImageBuffer(m_detached ? nullptr : ImageBuffer::create(size(), RenderingMode::Unaccelerated));
 }
 
@@ -327,6 +347,7 @@ void OffscreenCanvas::reset()
 
     m_hasCreatedImageBuffer = false;
     setImageBuffer(nullptr);
+    clearCopiedImage();
 
     notifyObserversCanvasResized();
 }
index 6744f72..1b95f67 100644 (file)
@@ -103,7 +103,7 @@ public:
 
     void didDraw(const FloatRect&) final;
 
-    Image* copiedImage() const final { return nullptr; }
+    Image* copiedImage() const final;
     bool hasCreatedImageBuffer() const final { return m_hasCreatedImageBuffer; }
 
     SecurityOrigin* securityOrigin() const final;
@@ -138,12 +138,16 @@ private:
 
     void reset();
 
+    void clearCopiedImage() const;
+
     std::unique_ptr<CanvasRenderingContext> m_context;
 
     // m_hasCreatedImageBuffer means we tried to malloc the buffer. We didn't necessarily get it.
     mutable bool m_hasCreatedImageBuffer { false };
 
     bool m_detached { false };
+
+    mutable RefPtr<Image> m_copiedImage;
 };
 
 }