Implementa… say it! …tion

I am dithering between three possible ways of implementing all this, and I have bits of written code for all of them.

Option A is to do the whole job of tokenising and parsing and rendering ourselves.

  • We get full control and can do what we like.
  • There isn’t much of the full CSS spec we need to honour just to do window borders.
  • But we also run the risk of obscure bugs specific to our code…
  • …and we’ll have the inevitable need to prove why we didn’t rely on existing libraries.
  • I have a working tokeniser written and some of the parser; I just need to decide whether to use them.

Option B is to do the rendering and perhaps some of the parsing ourselves, and leave the rest of the parsing and all the tokenising to libcroco.

  • But libcroco doesn’t do CSS3.
  • But there are workarounds for that; still, none of them are perfect and they’ll show up very obviously in the language.
  • Of course we could start by modifying libcroco to do CSS3, but that might make this project last forever.

Option C is to use libccss to do almost everything, which depends on libcroco for parsing.

  • This is what the first draft of Cowbell did.
  • This has all the negative points of Option B, and some of its own.
  • However, there were some infelicities, including rather inflexible image handling…
  • …and no way to expand the range of colours that were allowed.
  • We also had to do some things, like rendering the title text, ourselves anyway.
  • Again, we could just fix libccss; again, this will delay this project’s going anywhere in a hurry.

Published by

Thomas Thurman

Mostly themes, triaging, and patch review.

2 thoughts on “Implementa… say it! …tion”

  1. It all boils down to “how much of the existing libraries do we reuse, and how much would we have to rewrite or replace”.

    I suspect using (and upgrading) libcroco will be pretty feasible, since CSS syntax is pretty consistent – you might need to add some selectors (which should slot in nicely alongside existing selectors) and teach it about mathematical operations in calc() (should be nicely self-contained), but the vast majority of CSS3 features are new properties that follow the same parse rules, not new parse rules.

    Rendering is a trickier beast – there’s a lot of complicated stuff in even CSS 1 that’s tricky to get right (float interactions, for example) and re-using existing code would be great. On the other hand, CSS3 additions may well require rewriting large chunks of older features to take newer properties into account.

    I suppose the choice of whether or not to use libccss depends on which CSS3 properties you think Cowbell requires.

    Browsers have it easy – they only implement the things they think are feasible with their current code-base, and content authors only create documents that use the available features. Cowbell, on the other hand, has a very specific look-and-feel that it must be able to reproduce (specifically, at least 80% of Metacity v2 themes), and anything less will just mean authors continue to creat Metacity v2 themes instead.

  2. There’s two things to consider here: what selectors will be used, and what rules will be allowed. CSS3 adds some to both.

    Could you use libccss to do the title (and other) texts too?

Comments are closed.

Leave a Reply

Your email address will not be published. Required fields are marked *