This works; the test suite passes and I've been running this for a while on my machine. Obviously no visual changes; the parsers produce the same results as before for the theme.
I think this depends on mutter!951 (closed) to include Rust in the CI image; not sure how you'd like to go about that.
Summary of the changes:
- There's a new
subprojects/stylishgit submodule that references that little library.
- That library provides functions like
stylish_parse_font_size(CRTerm *term, ...). The idea is to move the parsers for individual properties to Rust first.
- There is some refactoring to make things easier; for example, there is now an
top, right, bottom, leftfields instead of having a
double paddingarray in
StThemeNode. This makes it harder to screw things up with the indices.
- The parsers in stylish which are standard CSS properties come from librsvg; there are a couple custom ones for the
st-*properties. My intention is to actually have librsvg provide a sub-crate that gnome-shell can reuse, but gnome-shell isn't at that point yet.
- The current parsers have a few changes from St's - see the README for details. For example, color properties also support
hsla(...)per CSS3. Shadow properties have a more strict ordering of their fields, per CSS3, too.
- Finish porting the basic properties. I now have a good workflow for this.
- Actually load the CSS files in the Rust code, and do cascading there. This code already exists in librsvg.
- Decide whether to keep gnome-shell's "dynamic" properties, or whether to constrain things to a hardcoded set of property names. E.g. the API that shell extensions use is
st_node.gimme_property_of_type_blah("propname"). In turn,
StThemeNodewalks its properties looking for one called
propname, and parses it as an
StBlah. I'd like to move to a model where the set of allowed properties is known at compile time, and also their types. We can discuss this; I'm not sure what gnome-shell would prefer in the end.