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
Implement paint worklets rendering context #17326
Implement paint worklets rendering context #17326
Conversation
Heads up! This PR modifies the following files:
|
The commit "Implemented paint worklets invoking worklet scripts." is #17239. |
return self.send_invalid_image(size, sender); | ||
} | ||
// Step 5.4 | ||
entry.insert(Heap::new(paint_instance.get())); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm just going to flag this now - we must not introduce any new uses of Heap::new into Servo due to servo/rust-mozjs#343 . Use Heap::default to create a Heap value and ensure it will never move after that point before calling Heap::set. This hashtable looks very scary to me for this reason :(
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oh good point.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
My proposed fix: 660d8dd
let context = PaintRenderingContext2D::new(self); | ||
let definition = PaintDefinition { | ||
class_constructor: Heap::new(ObjectValue(paint_obj.get())), | ||
paint_function: Heap::new(paint_function), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
These also need to be changed.
☔ The latest upstream changes (presumably #17352) made this pull request unmergeable. Please resolve the merge conflicts. |
660d8dd
to
137760e
Compare
☔ The latest upstream changes (presumably #17456) made this pull request unmergeable. Please resolve the merge conflicts. |
137760e
to
ab8024d
Compare
74c3026
to
4fcf2d7
Compare
@@ -347,7 +358,7 @@ impl CanvasRenderingContext2D { | |||
|
|||
let smoothing_enabled = self.state.borrow().image_smoothing_enabled; | |||
|
|||
if &*self.canvas == canvas { | |||
if self.canvas.as_ref().map(|c| &**c == canvas).unwrap_or(false) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
map_or instead of map.unwrap_or
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done.
self.context.Save() | ||
} | ||
|
||
#[allow(unrooted_must_root)] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Unnecessary.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Removed. Serves me right cutting-and-pasting from CanvasRenderingContext2D.
{ | ||
// TODO: document paint definitions. | ||
self.invoke_a_paint_callback(name, size, sender); | ||
} | ||
|
||
/// https://drafts.css-houdini.org/css-paint-api/#invoke-a-paint-callback | ||
#[allow(unrooted_must_root)] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What's this for?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Apparently nothing, I removed it.
@bors-servo: r=jdm |
📌 Commit e32817c has been approved by |
…text, r=jdm Implement paint worklets rendering context <!-- Please describe your changes on the following line: --> Implement the rendering context for paint worklets. They really paint things now! --- <!-- 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 do not require tests because the existing reftest now passes <!-- 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. --> <!-- Reviewable:start --> --- This change is [<img src="https://reviewable.io/review_button.svg" height="34" align="absmiddle" alt="Reviewable"/>](https://reviewable.io/reviews/servo/servo/17326) <!-- Reviewable:end -->
💔 Test failed - linux-rel-wpt |
e32817c
to
328fb25
Compare
Updated test expectations. @bors-servo r=jdm |
📌 Commit 328fb25 has been approved by |
…text, r=jdm Implement paint worklets rendering context <!-- Please describe your changes on the following line: --> Implement the rendering context for paint worklets. They really paint things now! --- <!-- 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 do not require tests because the existing reftest now passes <!-- 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. --> <!-- Reviewable:start --> --- This change is [<img src="https://reviewable.io/review_button.svg" height="34" align="absmiddle" alt="Reviewable"/>](https://reviewable.io/reviews/servo/servo/17326) <!-- Reviewable:end -->
☀️ Test successful - android, arm32, arm64, linux-dev, linux-rel-css, linux-rel-wpt, mac-dev-unit, mac-rel-css1, mac-rel-css2, mac-rel-wpt1, mac-rel-wpt2, mac-rel-wpt3, mac-rel-wpt4, windows-msvc-dev |
…=jdm Implement paint worklet properties <!-- Please describe your changes on the following line: --> This is the final PR to get basic paint worklet support. It adds support for paint worklet properties (https://drafts.css-houdini.org/css-paint-api/#paint-definition-input-properties). When a paint worklet is registered, it specifies a list of CSS properties, and is provided with their computed values when it is invoked. This is a dependent PR: * "Implemented paint worklets invoking worklet scripts" is #17239. * "Implemented paint worklets rendering contexts" is #17326. There should be tests added for this, hopefully the existing wpt houdini tests. --- <!-- 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 #16839 - [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. --> <!-- Reviewable:start --> --- This change is [<img src="https://reviewable.io/review_button.svg" height="34" align="absmiddle" alt="Reviewable"/>](https://reviewable.io/reviews/servo/servo/17364) <!-- Reviewable:end -->
…=jdm Implement paint worklet properties <!-- Please describe your changes on the following line: --> This is the final PR to get basic paint worklet support. It adds support for paint worklet properties (https://drafts.css-houdini.org/css-paint-api/#paint-definition-input-properties). When a paint worklet is registered, it specifies a list of CSS properties, and is provided with their computed values when it is invoked. This is a dependent PR: * "Implemented paint worklets invoking worklet scripts" is #17239. * "Implemented paint worklets rendering contexts" is #17326. There should be tests added for this, hopefully the existing wpt houdini tests. --- <!-- 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 #16839 - [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. --> <!-- Reviewable:start --> --- This change is [<img src="https://reviewable.io/review_button.svg" height="34" align="absmiddle" alt="Reviewable"/>](https://reviewable.io/reviews/servo/servo/17364) <!-- Reviewable:end -->
Fixed scaling artefacts in paint worklets caused by zoom and hidpi <!-- Please describe your changes on the following line: --> This PR renders paint worklet canvases at the device pixel resolution, rather than the CSS pixel resolution. It's a dependent PR, building on #17239, #17326 and #17364. --- <!-- 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 #17454 - [X] These changes do not require tests because we don't run reftests with zoom enabled <!-- 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. --> <!-- Reviewable:start --> --- This change is [<img src="https://reviewable.io/review_button.svg" height="34" align="absmiddle" alt="Reviewable"/>](https://reviewable.io/reviews/servo/servo/17499) <!-- Reviewable:end -->
Fixed scaling artefacts in paint worklets caused by zoom and hidpi <!-- Please describe your changes on the following line: --> This PR renders paint worklet canvases at the device pixel resolution, rather than the CSS pixel resolution. It's a dependent PR, building on #17239, #17326 and #17364. --- <!-- 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 #17454 - [X] These changes do not require tests because we don't run reftests with zoom enabled <!-- 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. --> <!-- Reviewable:start --> --- This change is [<img src="https://reviewable.io/review_button.svg" height="34" align="absmiddle" alt="Reviewable"/>](https://reviewable.io/reviews/servo/servo/17499) <!-- Reviewable:end -->
Implement the rendering context for paint worklets. They really paint things now!
./mach build -d
does not report any errors./mach test-tidy
does not report any errorsThis change is