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

Implement paint worklets rendering context #17326

Merged

Conversation

@asajeffrey
Copy link
Member

asajeffrey commented Jun 14, 2017

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 errors
  • These changes do not require tests because the existing reftest now passes

This change is Reviewable

@highfive
Copy link

highfive commented Jun 14, 2017

Heads up! This PR modifies the following files:

  • @KiChjang: components/script/dom/paintrenderingcontext2d.rs, components/script/dom/bindings/refcounted.rs, components/script/dom/webidls/PaintWorkletGlobalScope.webidl, components/script/dom/workletglobalscope.rs, components/script/dom/canvasrenderingcontext2d.rs and 14 more
  • @fitzgen: components/script/dom/paintrenderingcontext2d.rs, components/script/dom/bindings/refcounted.rs, components/script/dom/webidls/PaintWorkletGlobalScope.webidl, components/script/dom/workletglobalscope.rs, components/script/dom/canvasrenderingcontext2d.rs and 14 more
  • @emilio: components/layout/display_list_builder.rs
@highfive
Copy link

highfive commented Jun 14, 2017

warning Warning warning

  • These commits modify unsafe code. Please review it carefully!
@asajeffrey
Copy link
Member Author

asajeffrey commented Jun 14, 2017

The commit "Implemented paint worklets invoking worklet scripts." is #17239.

@asajeffrey
Copy link
Member Author

asajeffrey commented Jun 14, 2017

return self.send_invalid_image(size, sender);
}
// Step 5.4
entry.insert(Heap::new(paint_instance.get()));

This comment has been minimized.

Copy link
@jdm

jdm Jun 14, 2017

Member

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 :(

This comment has been minimized.

Copy link
@asajeffrey

asajeffrey Jun 15, 2017

Author Member

Oh good point.

This comment has been minimized.

Copy link
@asajeffrey

asajeffrey Jun 15, 2017

Author Member

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),

This comment has been minimized.

Copy link
@jdm

jdm Jun 15, 2017

Member

These also need to be changed.

@bors-servo
Copy link
Contributor

bors-servo commented Jun 16, 2017

The latest upstream changes (presumably #17352) made this pull request unmergeable. Please resolve the merge conflicts.

@asajeffrey asajeffrey mentioned this pull request Jun 16, 2017
4 of 4 tasks complete
@asajeffrey asajeffrey force-pushed the asajeffrey:script-paint-worklets-rendering-context branch from 660d8dd to 137760e Jun 20, 2017
@asajeffrey asajeffrey mentioned this pull request Jun 22, 2017
4 of 4 tasks complete
@bors-servo
Copy link
Contributor

bors-servo commented Jun 22, 2017

The latest upstream changes (presumably #17456) made this pull request unmergeable. Please resolve the merge conflicts.

@asajeffrey asajeffrey force-pushed the asajeffrey:script-paint-worklets-rendering-context branch from 137760e to ab8024d Jun 22, 2017
asajeffrey added a commit to asajeffrey/servo that referenced this pull request Jun 23, 2017
asajeffrey added a commit to asajeffrey/servo that referenced this pull request Jun 28, 2017
@asajeffrey asajeffrey force-pushed the asajeffrey:script-paint-worklets-rendering-context branch 2 times, most recently from 74c3026 to 4fcf2d7 Jun 29, 2017
@asajeffrey
Copy link
Member Author

asajeffrey commented Jun 30, 2017

#17239 landed, so this PR is now unblocked. @jdm?

@@ -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) {

This comment has been minimized.

Copy link
@jdm

jdm Jun 30, 2017

Member

map_or instead of map.unwrap_or

This comment has been minimized.

Copy link
@asajeffrey

asajeffrey Jun 30, 2017

Author Member

Done.

self.context.Save()
}

#[allow(unrooted_must_root)]

This comment has been minimized.

Copy link
@jdm

jdm Jun 30, 2017

Member

Unnecessary.

This comment has been minimized.

Copy link
@asajeffrey

asajeffrey Jun 30, 2017

Author Member

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)]

This comment has been minimized.

Copy link
@jdm

jdm Jun 30, 2017

Member

What's this for?

This comment has been minimized.

Copy link
@asajeffrey

asajeffrey Jun 30, 2017

Author Member

Apparently nothing, I removed it.

@jdm
jdm approved these changes Jun 30, 2017
asajeffrey added a commit to asajeffrey/servo that referenced this pull request Jun 30, 2017
@asajeffrey
Copy link
Member Author

asajeffrey commented Jun 30, 2017

@bors-servo: r=jdm

@bors-servo
Copy link
Contributor

bors-servo commented Jun 30, 2017

📌 Commit e32817c has been approved by jdm

@highfive highfive assigned jdm and unassigned emilio Jun 30, 2017
@bors-servo
Copy link
Contributor

bors-servo commented Jun 30, 2017

Testing commit e32817c with merge f129f38...

bors-servo added a commit that referenced this pull request Jun 30, 2017
…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 -->
@bors-servo
Copy link
Contributor

bors-servo commented Jun 30, 2017

💔 Test failed - linux-rel-wpt

@asajeffrey asajeffrey force-pushed the asajeffrey:script-paint-worklets-rendering-context branch from e32817c to 328fb25 Jun 30, 2017
@asajeffrey
Copy link
Member Author

asajeffrey commented Jun 30, 2017

Updated test expectations. @bors-servo r=jdm

@bors-servo
Copy link
Contributor

bors-servo commented Jun 30, 2017

📌 Commit 328fb25 has been approved by jdm

@bors-servo
Copy link
Contributor

bors-servo commented Jun 30, 2017

Testing commit 328fb25 with merge a9fea06...

bors-servo added a commit that referenced this pull request Jun 30, 2017
…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 -->
@bors-servo
Copy link
Contributor

bors-servo commented Jun 30, 2017

@bors-servo bors-servo merged commit 328fb25 into servo:master Jun 30, 2017
3 checks passed
3 checks passed
continuous-integration/appveyor/pr AppVeyor build succeeded
Details
continuous-integration/travis-ci/pr The Travis CI build passed
Details
homu Test successful
Details
bors-servo added a commit that referenced this pull request Jul 11, 2017
…=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 -->
bors-servo added a commit that referenced this pull request Jul 11, 2017
…=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 -->
bors-servo added a commit that referenced this pull request Jul 20, 2017
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 -->
bors-servo added a commit that referenced this pull request Jul 21, 2017
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 -->
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.

None yet

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