
Hello Inkscape devs,
I'm looking through the code that sets/reads desktop and tool styles (sp_desktop_set_style, sp_desktop_get_style, etc.), and have some questions on some of the attribute filtering that happens.
As far as I can tell, there are two kinds of styles (except the 3dbox oddity):
* The "last used style": /desktop/style * A per-tool style: /tool/<tool_path>/style
For these styles, certain CSS properties are forbidden and are filtered out (e.g,. "shape-inside", "filter", "stop-opacity"). Filtering happens both when reading from the style and writing to the style.
For the filters when reading (in sp_desktop_apply_style_tool https://gitlab.com/inkscape/inkscape/-/blob/master/src/desktop-style.cpp?ref_type=heads#L376), the list of forbidden attributes are different for the global style and per-tool style. (More attributes are forbidden for the global style than the per-tool style).
There is a different list of filters when writing the styles (sp_css_attr_unset_blacklist https://gitlab.com/inkscape/inkscape/-/blob/master/src/style.cpp?ref_type=heads#L1498, sp_css_attr_unset_uris https://gitlab.com/inkscape/inkscape/-/blob/master/src/style.cpp?ref_type=heads#L1543). The rules differ between the global and per-tool style, AND the rules differ from the ones applied when reading the styles. (More attributes are forbidden for the per-tool style than the global style?)
Is there a reason the rules ended up this complicated? (Especially the part where the attributes that are writable to the style differ from the set of attributes allowed to be read back.)
I'm wondering whether they can be simplified to something like:
* Some set of attributes are forbidden from all default styles. Apply the same filter for both reading and writing.
Or
* Some set of attributes are forbidden for all default styles, and a superset is forbidden for the global last-used style. But the same filters are used for both reading and writing.