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

Remove DomRefCell wrapper for CanvasState #26166

Merged
merged 3 commits into from Apr 15, 2020

Conversation

@utsavoza
Copy link
Contributor

utsavoza commented Apr 10, 2020


  • ./mach build -d does not report any errors
  • ./mach test-tidy does not report any errors
  • These changes fix #23436
  • There are tests for these changes

The PR removes the DomRefCell wrapper for CanvasState from CanvasRenderingContext2D and OffscreenCanvasRenderingContext2D. The reason for keeping member wrappers in CanvasState instead of overall CanvasState wrapper itself is because I believe that removing member wrappers would make it rather difficult to refactor the internal CanvasState methods in order to cover certain edge cases.

For example: Drawing a canvas inside of itself would require getting and providing certain parameters for source canvas such as canvas_id and is_origin_clean that are currently accessed through source canvas context. Also, we might run into similar issue when creating patterns using canvas.

@highfive
Copy link

highfive commented Apr 10, 2020

Heads up! This PR modifies the following files:

  • @asajeffrey: components/script/dom/canvasrenderingcontext2d.rs, components/script/dom/offscreencanvasrenderingcontext2d.rs, components/script/canvas_state.rs
  • @KiChjang: components/script/dom/canvasrenderingcontext2d.rs, components/script/dom/offscreencanvasrenderingcontext2d.rs, components/script/canvas_state.rs
@highfive
Copy link

highfive commented Apr 10, 2020

warning Warning warning

  • These commits modify unsafe code. Please review it carefully!
  • These commits modify script code, but no tests are modified. Please consider adding a test!
@utsavoza
Copy link
Contributor Author

utsavoza commented Apr 15, 2020

Hey @jdm, please let me know what you think.

@jdm
Copy link
Member

jdm commented Apr 15, 2020

@bors-servo r+
Looks good! Thanks for fixing this!

@bors-servo
Copy link
Contributor

bors-servo commented Apr 15, 2020

📌 Commit bd8fbee has been approved by jdm

@highfive highfive assigned jdm and unassigned asajeffrey Apr 15, 2020
@bors-servo
Copy link
Contributor

bors-servo commented Apr 15, 2020

Testing commit bd8fbee with merge ba6f21d...

bors-servo added a commit that referenced this pull request Apr 15, 2020
Remove DomRefCell wrapper for CanvasState

<!-- Please describe your changes on the following line: -->

---
<!-- 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 #23436
- [x] There are tests for these changes

The PR removes the DomRefCell wrapper for CanvasState from `CanvasRenderingContext2D` and `OffscreenCanvasRenderingContext2D`. The reason for keeping member wrappers in CanvasState instead of overall CanvasState wrapper itself is because I believe that removing member wrappers would make it rather difficult to refactor the internal CanvasState methods in order to cover certain edge cases.

[For example](#23436 (comment)): Drawing a canvas inside of itself would require getting and providing certain parameters for source canvas such as `canvas_id` and `is_origin_clean` that are currently accessed through source canvas context. Also, we might run into similar issue when creating patterns using canvas.

<!-- 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
Copy link
Contributor

bors-servo commented Apr 15, 2020

💔 Test failed - status-taskcluster

@jdm
Copy link
Member

jdm commented Apr 15, 2020

@bors-servo
Copy link
Contributor

bors-servo commented Apr 15, 2020

Testing commit bd8fbee with merge 7d1f968...

@bors-servo
Copy link
Contributor

bors-servo commented Apr 15, 2020

☀️ Test successful - status-taskcluster
Approved by: jdm
Pushing 7d1f968 to master...

@bors-servo bors-servo merged commit 7d1f968 into servo:master Apr 15, 2020
2 checks passed
2 checks passed
Community-TC (pull_request) TaskGroup: success
Details
homu Test successful
Details
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked issues

Successfully merging this pull request may close these issues.

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