[WIP] Handle nondeterministic paint worklet registration #20269
Closed
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
When different global paint worklet scopes register document paint definitions of the same name with different parameters, the registration should be marked invalid [1]. Currently, Servo unconditionally overwrites any prior registrations when a new definition is received.
This commit passes the parameters from the paint worklet global scope through to the layout thread so that they can be tracked there. In the absence of support for parsing input arguments, I'm passing the length of the input argument vector as a placeholder.
TODO:
When the act of registering a paint class in the first place is non-deterministic, a paint worklet global scope may attempt to invoke a paint callback for a class it has not registered. When this happens, the spec states that the document paint definition should be invalidated and an invalid image should be output [2]. Currently, only the latter happens.
No tests yet. It's pretty easy to generate conflicting registrations manually, but I don't think it's possible to make this fully deterministic without a stateful server component or something.
[1] https://drafts.css-houdini.org/css-paint-api/#registering-custom-paint
[2] https://drafts.css-houdini.org/css-paint-api/#invoke-a-paint-callback
./mach build -d
does not report any errors./mach test-tidy
does not report any errorsThis change is