What is Perignon? |
Perignon is the project to replace Mozilla's current CSS-1 implementation with one that uses the DOM for style information. We believe that this is the best way to fix Mozilla's current, er, suboptimal handling of CSS-1, and we've already made good progress. Style inheritance works (as near as we can tell) as it should, meaning that the days of broken nested-<DIV> or table style-property inheritance are hopefully behind us. Also, we've improved the handling of the A:visited and A:link pseudoclasses, so that you can now set any text attribute (text-decoration, bgcolor, font-decoration, etc.) for these elements. (Previously, only color worked.)
How do I use Perignon? |
As an HTML author, you can continue to use CSS-1 and JSSS syntaxes to set style data for your pages. Nothing should change, except that things will work better!
As a hacker-on-layout, you need to know about a handful of core APIs.
Most of the tree-generation and style-data-loading stuff is already done,
so you just need to worry about extractive data from the style system.
The APIs live in the DOM library, mainly in domstyle.c.
- DOM_StyleDatabase
- The style database lives in the lo_TopState struct, as style_db. In most layout functions, you are provided with an lo_DocState, so you can just use doc_state->top_state->style_db to get to it. If this style_db is NULL, there is no style information for this page, so you should fall back to defaults as appropriate. (See lo_FillInTextStyleInfo for an example of this.) Don't force the creation of a style database!
- DOM_StyleGetProperty
- This function is used to get an attribute entry (a value, basically) for a given style property on a given node. It does all the inheritance and weighting rocket science. See lo_FillInTextStyleInfo for a good example of usage.
- DOM_GetCleanEntryData
- This function uses a provided DOM_DataParser function to parse an entry's value as required. It will cache the value if possible, which will hopefully reduce the strcasecomp overhead.
That's basically it. Everything else is probably going to be specific to the individual usage of the data. In addition to lo_FillInTextStyleInfo, good examples of usage include lo_SetStyleSheetLayerProperties and lo_format_image.
Mike Shaver Last modified: Tue Oct 13 19:45:49 EDT 1998