Skip to content

Extract parameters before applying filters

This is a preliminary refactoring to make !377 (closed) easier. I also want to experiment with a scheme to make the big structural changes in !387 (closed) unnecessary.

!387 (closed) - adds a post_process step after cascading, in which elements for filter primitives are supposed to extract their parameters from child nodes or whatever. I think we can avoid doing that with the following scheme.

This MR modifies the filter primitive elements so they indeed extract their parameters from child nodes, but leaves it at that. If anything, this made it easier to add tests for fetching parameters from child nodes.

The next steps:

  • For each filter primitive, actually implement a struct with all the parameters for that primitive. This is similar to the existing FeWhatever, plus anything we need to extract from the ComputedValues (some primitives require colors, or color_interpolation_filters), plus extra stuff extracted from child nodes (what this MR does).
  • Make a FilterPrimitive enum of all the primitives, with each of the structs above in a variant.
  • Add the missing filter functions to FilterValue.
  • Resolve FilterValueList to a Vec<FilterPrimitive>. In particular, FilterValue::URI should resolve to a specific primitive like FilterPrimitive::FeBlur(all_its_parameters).
  • filters::render() should probably just take the Vec<FilterValue> and go through them.

Merge request reports