Auto merge of #24464 - rasviitanen:offscreen-canvas, r=jdm

fix getimagedata returns empty pixels

<!-- Please describe your changes on the following line: -->
GetImageData for OffscreenCanvas without an associated canvas element returned blank pixels. To solve this, we now pass a `Size2D` instead of a canvas to relevant functions.

I don't quite know if it's ok that `OffscreenCanvasRenderingContext2D` now have a `width` and `height`, but I found no other reasonable solution to this.

There are some tests that previously were marked as `PASS` that are now failing. It seems that they were passing for the wrong reason.
These are:
> tests/wpt/metadata/offscreen-canvas/pixel-manipulation/2d.imageData.put.unchanged.html.ini
> tests/wpt/metadata/offscreen-canvas/pixel-manipulatio/2d.imageData.put.unchanged.worker.js.ini
> tests/wpt/metadata/offscreen-canvas/the-offscreen-canvas/initial.reset.path.html.ini
> tests/wpt/metadata/offscreen-canvas/the-offscreen-canvas/initial.reset.path.worker.js.ini
---
<!-- Thank you for contributing to Servo! Please replace each `[ ]` by `[X]` when the step is complete, and replace `___` with appropriate data: -->
- [x] `./mach build -d` does not report any errors
- [x] `./mach test-tidy` does not report any errors
- [x] These changes fix #24271 (GitHub issue number if applicable)

<!-- Either: -->
- [x] There are tests for these changes

<!-- Also, please make sure that "Allow edits from maintainers" checkbox is checked, so that we can help you if you get stuck somewhere along the way.-->

<!-- Pull requests that do not address these steps are welcome, but they will require additional verification as part of the review process. -->
This commit is contained in:
bors-servo 2019-10-18 13:00:37 -04:00 committed by GitHub
commit 83fb2b06d0
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
57 changed files with 44 additions and 239 deletions

View file

@ -1,4 +0,0 @@
[2d.gradient.interpolate.zerosize.fill.html]
[OffscreenCanvas test: 2d.gradient.interpolate.zerosize.fill]
expected: FAIL

View file

@ -1,4 +0,0 @@
[2d.gradient.interpolate.zerosize.fill.worker.html]
[2d]
expected: FAIL

View file

@ -1,4 +0,0 @@
[2d.gradient.interpolate.zerosize.fillRect.html]
[OffscreenCanvas test: 2d.gradient.interpolate.zerosize.fillRect]
expected: FAIL

View file

@ -1,4 +0,0 @@
[2d.gradient.interpolate.zerosize.fillRect.worker.html]
[2d]
expected: FAIL

View file

@ -1,4 +0,0 @@
[2d.gradient.interpolate.zerosize.stroke.html]
[OffscreenCanvas test: 2d.gradient.interpolate.zerosize.stroke]
expected: FAIL

View file

@ -1,4 +0,0 @@
[2d.gradient.interpolate.zerosize.stroke.worker.html]
[2d]
expected: FAIL

View file

@ -1,4 +0,0 @@
[2d.gradient.interpolate.zerosize.strokeRect.html]
[OffscreenCanvas test: 2d.gradient.interpolate.zerosize.strokeRect]
expected: FAIL

View file

@ -1,4 +0,0 @@
[2d.gradient.interpolate.zerosize.strokeRect.worker.html]
[2d]
expected: FAIL

View file

@ -1,4 +0,0 @@
[offscreencanvas.filter.html]
[none]
expected: FAIL

View file

@ -1,4 +0,0 @@
[2d.line.cap.closed.html]
[Line caps are not drawn at the corners of an unclosed rectangle]
expected: FAIL

View file

@ -1,4 +0,0 @@
[2d.line.cap.closed.worker.html]
[Line caps are not drawn at the corners of an unclosed rectangle]
expected: FAIL

View file

@ -1,4 +0,0 @@
[2d.line.cap.open.html]
[Line caps are drawn at the corners of an unclosed rectangle]
expected: FAIL

View file

@ -1,4 +0,0 @@
[2d.line.cap.open.worker.html]
[Line caps are drawn at the corners of an unclosed rectangle]
expected: FAIL

View file

@ -1,4 +0,0 @@
[2d.line.cross.html]
[OffscreenCanvas test: 2d.line.cross]
expected: FAIL

View file

@ -1,4 +0,0 @@
[2d.line.cross.worker.html]
[2d]
expected: FAIL

View file

@ -1,4 +0,0 @@
[2d.line.join.closed.html]
[Line joins are drawn at the corner of a closed rectangle]
expected: FAIL

View file

@ -1,4 +0,0 @@
[2d.line.join.closed.worker.html]
[Line joins are drawn at the corner of a closed rectangle]
expected: FAIL

View file

@ -1,4 +0,0 @@
[2d.line.join.open.html]
[Line joins are not drawn at the corner of an unclosed rectangle]
expected: FAIL

View file

@ -1,4 +0,0 @@
[2d.line.join.open.worker.html]
[Line joins are not drawn at the corner of an unclosed rectangle]
expected: FAIL

View file

@ -1,4 +0,0 @@
[2d.line.join.parallel.html]
[Line joins are drawn at 180-degree joins]
expected: FAIL

View file

@ -1,4 +0,0 @@
[2d.line.join.parallel.worker.html]
[Line joins are drawn at 180-degree joins]
expected: FAIL

View file

@ -1,4 +0,0 @@
[2d.line.miter.acute.html]
[Miter joins are drawn correctly with acute angles]
expected: FAIL

View file

@ -1,4 +0,0 @@
[2d.line.miter.acute.worker.html]
[Miter joins are drawn correctly with acute angles]
expected: FAIL

View file

@ -1,4 +0,0 @@
[2d.line.miter.exceeded.html]
[Miter joins are not drawn when the miter limit is exceeded]
expected: FAIL

View file

@ -1,4 +0,0 @@
[2d.line.miter.exceeded.worker.html]
[Miter joins are not drawn when the miter limit is exceeded]
expected: FAIL

View file

@ -1,4 +0,0 @@
[2d.line.miter.lineedge.html]
[Miter joins are not drawn when the miter limit is exceeded at the corners of a zero-height rectangle]
expected: FAIL

View file

@ -1,4 +0,0 @@
[2d.line.miter.lineedge.worker.html]
[Miter joins are not drawn when the miter limit is exceeded at the corners of a zero-height rectangle]
expected: FAIL

View file

@ -1,4 +0,0 @@
[2d.line.miter.obtuse.html]
[Miter joins are drawn correctly with obtuse angles]
expected: FAIL

View file

@ -1,4 +0,0 @@
[2d.line.miter.obtuse.worker.html]
[Miter joins are drawn correctly with obtuse angles]
expected: FAIL

View file

@ -1,4 +0,0 @@
[2d.line.miter.rightangle.html]
[Miter joins are not drawn when the miter limit is exceeded, on exact right angles]
expected: FAIL

View file

@ -1,4 +0,0 @@
[2d.line.miter.rightangle.worker.html]
[Miter joins are not drawn when the miter limit is exceeded, on exact right angles]
expected: FAIL

View file

@ -1,4 +0,0 @@
[2d.line.miter.within.html]
[Miter joins are drawn when the miter limit is not quite exceeded]
expected: FAIL

View file

@ -1,4 +0,0 @@
[2d.line.miter.within.worker.html]
[Miter joins are drawn when the miter limit is not quite exceeded]
expected: FAIL

View file

@ -1,4 +0,0 @@
[2d.line.union.html]
[OffscreenCanvas test: 2d.line.union]
expected: FAIL

View file

@ -1,4 +0,0 @@
[2d.line.union.worker.html]
[2d]
expected: FAIL

View file

@ -1,4 +0,0 @@
[2d.imageData.get.clamp.html]
[getImageData() clamps colours to the range [0, 255\]]
expected: FAIL

View file

@ -1,4 +0,0 @@
[2d.imageData.get.clamp.worker.html]
[getImageData() clamps colours to the range [0, 255\]]
expected: FAIL

View file

@ -1,4 +0,0 @@
[2d.imageData.get.nonpremul.html]
[getImageData() returns non-premultiplied colours]
expected: FAIL

View file

@ -1,4 +0,0 @@
[2d.imageData.get.nonpremul.worker.html]
[getImageData() returns non-premultiplied colours]
expected: FAIL

View file

@ -1,4 +0,0 @@
[2d.imageData.get.order.alpha.html]
[getImageData() returns A in the fourth component]
expected: FAIL

View file

@ -1,4 +0,0 @@
[2d.imageData.get.order.alpha.worker.html]
[getImageData() returns A in the fourth component]
expected: FAIL

View file

@ -1,4 +0,0 @@
[2d.imageData.get.order.cols.html]
[getImageData() returns leftmost columns first]
expected: FAIL

View file

@ -1,4 +0,0 @@
[2d.imageData.get.order.cols.worker.html]
[getImageData() returns leftmost columns first]
expected: FAIL

View file

@ -1,4 +0,0 @@
[2d.imageData.get.order.rgb.html]
[getImageData() returns R then G then B]
expected: FAIL

View file

@ -1,4 +0,0 @@
[2d.imageData.get.order.rgb.worker.html]
[getImageData() returns R then G then B]
expected: FAIL

View file

@ -1,4 +0,0 @@
[2d.imageData.get.order.rows.html]
[getImageData() returns topmost rows first]
expected: FAIL

View file

@ -1,4 +0,0 @@
[2d.imageData.get.order.rows.worker.html]
[getImageData() returns topmost rows first]
expected: FAIL

View file

@ -1,4 +0,0 @@
[2d.imageData.get.range.html]
[getImageData() returns values in the range [0, 255\]]
expected: FAIL

View file

@ -1,4 +0,0 @@
[2d.imageData.get.range.worker.html]
[getImageData() returns values in the range [0, 255\]]
expected: FAIL

View file

@ -0,0 +1,4 @@
[2d.imageData.put.unchanged.html]
[putImageData(getImageData(...), ...) has no effect]
expected: FAIL

View file

@ -0,0 +1,4 @@
[2d.imageData.put.unchanged.worker.html]
[putImageData(getImageData(...), ...) has no effect]
expected: FAIL

View file

@ -0,0 +1,4 @@
[initial.reset.path.html]
[Resetting the canvas state resets the current path]
expected: FAIL

View file

@ -0,0 +1,4 @@
[initial.reset.path.worker.html]
[Resetting the canvas state resets the current path]
expected: FAIL

View file

@ -5,9 +5,6 @@
[Test that webglcontext.canvas should return the original OffscreenCanvas]
expected: FAIL
[Test that OffscreenCanvasRenderingContext2D with alpha enabled preserves the alpha]
expected: FAIL
[Test that getContext with un-supported string throws a TypeError.]
expected: FAIL
@ -17,9 +14,6 @@
[Test that getContext twice with different context type returns null the second time]
expected: FAIL
[Test that 'alpha' context creation attribute is true by default]
expected: FAIL
[Test that 2dcontext.canvas should return the original OffscreenCanvas]
expected: FAIL

View file

@ -5,9 +5,6 @@
[Test that webglcontext.canvas should return the original OffscreenCanvas]
expected: FAIL
[Test that OffscreenCanvasRenderingContext2D with alpha enabled preserves the alpha]
expected: FAIL
[Test that getContext with un-supported string throws a TypeError.]
expected: FAIL
@ -17,9 +14,6 @@
[Test that getContext twice with different context type returns null the second time]
expected: FAIL
[Test that 'alpha' context creation attribute is true by default]
expected: FAIL
[Test that 2dcontext.canvas should return the original OffscreenCanvas]
expected: FAIL