Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

GetImageData for OffscreenCanvas without an associated canvas element returns blank pixels #24271

Closed
jdm opened this issue Sep 23, 2019 · 10 comments
Closed

Comments

@jdm
Copy link
Member

@jdm jdm commented Sep 23, 2019

Code:

In cases like OffscreenCanvasRenderingContext2D::GetImageData when there is no associated canvas element (eg. https://github.com/servo/servo/blob/master/tests/wpt/web-platform-tests/offscreen-canvas/drawing-rectangles-to-the-canvas/2d.clearRect.clip.html), we need to provide a real canvas size. I propose we replace the optional canvas element argument with a canvas size argument instead, and modify the callers to pass it in as appropriate.

We should get a bunch of tests with better results when running ./mach test-wpt tests/wpt/web-platform-tests/offscreen-canvas.

@rasviitanen
Copy link
Contributor

@rasviitanen rasviitanen commented Oct 7, 2019

@highfive: assign me

@highfive highfive added the C-assigned label Oct 7, 2019
@highfive
Copy link

@highfive highfive commented Oct 7, 2019

Hey @rasviitanen! Thanks for your interest in working on this issue. It's now assigned to you!

@bblanke
Copy link
Contributor

@bblanke bblanke commented Oct 16, 2019

Hi! I'm with an NC State group that's been assigned to work on this as a part of a school project. @rasviitanen, have you made progress on this? How can I help?

@rasviitanen
Copy link
Contributor

@rasviitanen rasviitanen commented Oct 16, 2019

@bblanke Hey fellow student. I have had some major hardware issues, which has been hindering me from resolving this issue and running the tests properly. I have however, made some progress on this, and created an implementation that for the most part resolves this issue.
The problem I am facing now, is that some tests regarding reseting the canvas is failing, that are supposed to pass (they are marked as pass in the test metadata). I believe that this can be an effect of someone marking the test as "pass" mistakenly, and that the failing tests is a result of something else other than my implementation.

You could help me investigate this issue. I'll to upload the patch shortly and give a more detailed explanation. I'll make sure to let you know once I upload it.

@bblanke
Copy link
Contributor

@bblanke bblanke commented Oct 16, 2019

Awesome! I'm excited to help

@jdm
Copy link
Member Author

@jdm jdm commented Oct 16, 2019

@rasviitanen Ah, so the reason the test is "passing" right now is that the existing implementation to compare pixel values relies on GetImageData. If the passing condition for the test is transparent black pixels, the incorrect GetImageData implementation will make the test look like it's passing because the expected pixel data is found. When the bug is fixed, it exposes that the existing canvas implementation that's actually being tested is faulty.

@bblanke
Copy link
Contributor

@bblanke bblanke commented Oct 16, 2019

Which tests are you all using to validate this? When I look at the metadata in tests/wpt/metadata/offscreen-canvas all of the tests are set to FAIL

@jdm
Copy link
Member Author

@jdm jdm commented Oct 16, 2019

The absence of an ini file for https://github.com/servo/servo/tree/master/tests/wpt/web-platform-tests/offscreen-canvas/the-offscreen-canvas/initial.reset.path.html means the test hardness defaults to expecting it to pass.

@rasviitanen rasviitanen mentioned this issue Oct 16, 2019
4 of 4 tasks complete
@rasviitanen
Copy link
Contributor

@rasviitanen rasviitanen commented Oct 16, 2019

@bblanke sorry for it taking time, you can now see my pull-request #24464

@bblanke
Copy link
Contributor

@bblanke bblanke commented Oct 16, 2019

Thank you! I'm looking through it now; nice to have a good reference to learn from.

bors-servo added a commit that referenced this issue Oct 17, 2019
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. -->
bors-servo added a commit that referenced this issue Oct 18, 2019
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. -->
bors-servo added a commit that referenced this issue Oct 18, 2019
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. -->
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

4 participants
You can’t perform that action at this time.