Auto merge of #17364 - asajeffrey:script-paint-worklets-properties, r=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 -->
This commit is contained in:
bors-servo 2017-07-11 16:24:18 -07:00 committed by GitHub
commit bc44246fc6
29 changed files with 353 additions and 118 deletions

View file

@ -64,16 +64,7 @@ impl ServoRestyleDamage {
new: &ServoComputedValues)
-> StyleDifference {
let damage = compute_damage(old, new);
// If computed values for custom properties changed, we should cascade these changes to
// children (custom properties are all inherited).
// https://www.w3.org/TR/css-variables/#defining-variables
// (With Properties & Values, not all custom properties will be inherited!)
let variable_values_changed = old.get_custom_properties() != new.get_custom_properties();
let change = if damage.is_empty() && !variable_values_changed {
StyleChange::Unchanged
} else {
StyleChange::Changed
};
let change = if damage.is_empty() { StyleChange::Unchanged } else { StyleChange::Changed };
StyleDifference::new(damage, change)
}
@ -285,6 +276,13 @@ fn compute_damage(old: &ServoComputedValues, new: &ServoComputedValues) -> Servo
get_inheritedbox.visibility
]);
// Paint worklets may depend on custom properties,
// so if they have changed we should repaint.
if old.get_custom_properties() != new.get_custom_properties() {
damage.insert(REPAINT);
}
// If the layer requirements of this flow have changed due to the value
// of the transform, then reflow is required to rebuild the layers.
if old.transform_requires_layer() != new.transform_requires_layer() {