Description
Motivation
Enable OSS (non-gecko, non-servo) users of stylo
to use all style properties that stylo
supports.
Background
The set of style properties that Stylo supports are currently conditionally compiled using a python script to generate them. There are two sets of styles: Gecko and Servo. The Servo style set only enables styles properties (and values of style properties) that Servo supports. For example, the Servo version of the justify-content
property does not support the start
and end
values (although it does support flex-start
and flex-end
which are similar but ultimately different).
It is presumably set up like this partly for efficiency (don't compile or run code that isn't being used) and partly because the CSS specification specifies that style property values that are not understood should not be parsed (to ensure future compatibility if/when support is added).
Proposal
- Enable all style properties in the "servo" configuration of stylo (at least where this is relatively easy to do)
- Align Servo's generated types with Gecko's where possible (e.g. AFAICT there's no reason why Servo couldn't use the same
JustifiedContent
enum that Gecko is using) - Implement ignoring of unsupported style properties at a higher level (for instance by updating unsupported values back to the default value). This doesn't stick to the letter of the spec: it will parse unsupported properties. But it should be functionally equivalent.
- If particular functionality is particularly heavyweight and merits conditional compilation then it could be given a functionality-specific cargo feature.
Notes
- Such a migration does not need to be done all at once and could be done property-by-property.
- It may be possible to remove conditional compilation entirely from large parts of Stylo using this approach