Skip to content

Move CSS longhands outside of mako #19015

Closed

Description

@emilio

We use the mako template system to autogenerate code.

Ideally, we'd like to use a manifest and use Rust to generate it instead. For that, we need to move all the remaining CSS properties (most of them have been moved already) outside of Mako. That is the same as saying: We should make all those use ${helpers.predefined_type(..)}.

This is mostly moving and cleaning up code in the same way as #19002 and #19005, but there are probably bugs along the way that may need fixing (like the calc() bug I added a test for in #19005).

If you want to help out with this, please comment on this issue or reach out on IRC (#servo in irc.mozilla.org) and we'll find one which is interesting to you.

Or, you can also file an issue and mention this one and I'll get it assigned to you.

Known properties still using mako:

FAQ

How do I get started? How can I make any sense of the code?

This code lives in compontents/style/properties/longhands. Note that some of the code is Firefox-specific (properties marked with products="gecko", so you may need to do ./mach build-geckolib or ./mach cargo-geckolib check in order to build and see).

Please ask here, in #servo, or open an issue like #19020 and say that you want to work on it.

Ask questions! I (or any of the other Servo members and contributors) are happy to help :)

What's the general setup?

Each CSS property has two different representations: The "specified" one (the one people write in the stylesheets), and the "computed" one. Sometimes they are the same, sometimes they're different.

So for example if you write width: 1em in a CSS style sheet, the "specified" value is 1em, but the "computed" value could be, for example, 10px, if the parent font-size is 10px.

So the way this is organized is roughly as follows: We have two rust modules inside compontents/style/values. The computed and the specified (there are others, but those shouldn't worry you).

The first argument for predefined_type is the CSS property name.

The second argument is the name of the type that becomes computed::$name or specified::$name, depending on the appropriate context. For example, in #19018, both are the same (computed::ScrollSnapType just re-exports specified::ScrollSnapType).

The third argument is the initial computed value of the property. The rest of the arguments are key-value pairs with various meanings, that we should probably preserve intact. If there are any questions about a particular argument feel free to ask though!

Which ones are easier? Which ones are harder?

In general, the level of difficulty relates with the amount that lies inside the mako section of that property.

For example, transform is huge, and is fairly non-trivial, while probably others like overflow-y are easy to refactor like #19018.

But again, please ask if you're unsure and we'll try to answer! :)

Activity

  1. added
    B-meta
    A-content/css
    on Oct 25, 2017
  2. Manishearth commented on Oct 25, 2017

    @Manishearth
    Member

    Yes!

    I'm currently doing transform stuff though I may not do the extra step of predefined typing it.

  3. added
    E-more-complex
    on Oct 25, 2017
  4. SimonSapin commented on Oct 26, 2017

    @SimonSapin
    Member

    We use the mako template system to autogenerate code.

    Ideally, we'd like to use a manifest, and use Rust to generate it instead.

    Before we go through every property and move code around, maybe we could talk a little bit about what design we want?

    For example, maybe instead of the pattern of having modules that are expected to define a few items of certain kinds with certain names, we could rely on the hot new language feature of associated types. That kind of things.

  5. SimonSapin commented on Oct 26, 2017

    @SimonSapin
    Member

    After clarifying on IRC, it turns out that the changes I had in mind are mostly orthogonal with what this issue is about. So, carry on :)

  6. added 9 commits that reference this issue on Oct 26, 2017
  7. 60 remaining items

  8. added 2 commits that reference this issue on Jan 20, 2018
  9. added a commit that references this issue on Feb 1, 2018
  10. donovanglover commented on Feb 2, 2018

    @donovanglover

    Hello I'd like to work on text-emphasis-style, thanks.

  11. jdm commented on Feb 3, 2018

    @jdm
    Member

    @gloverdonovan Go ahead and file an issue for it; you're welcome to work on it!

  12. added a commit that references this issue on Mar 10, 2018
  13. changed the title [-][meta] Move CSS longhands outside of mako.[/-] [+]Move CSS longhands outside of mako.[/+] on Jun 23, 2018
  14. deleted a comment from on Jul 7, 2018
  15. deleted a comment from on Jul 7, 2018
  16. kleinph commented on Jul 8, 2018

    @kleinph
    Contributor

    I would like to take float (and clear if the first one is successful). I already created issue #21130 (and a PR) for that.

  17. added a commit that references this issue on Jul 10, 2018
  18. changed the title [-]Move CSS longhands outside of mako.[/-] [+]Move CSS longhands outside of mako[/+] on Jul 2, 2020
  19. atouchet commented on Jul 2, 2020

    @atouchet
    Contributor

    @emilio @Manishearth is this done now?

  20. jdm commented on Jul 6, 2020

    @jdm
    Member

    I'm going to go ahead and claim it's done. We can file specific issues for anything remaining.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-content/cssB-metaE-more-complex

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions