summaryrefslogtreecommitdiff
path: root/src/stylesheet.c
Commit message (Collapse)AuthorAgeFilesLines
* Fix libcss to use new libwapcaplet behaviour.Daniel Silverstone2010-03-271-22/+16
| | | | | | | TODO: update the tests to include a refcounting proof svn path=/trunk/libcss/; revision=10162
* Origin and media are not properties of the stylesheet. John Mark Bell2010-01-121-41/+1
| | | | | | | | | They are properties of the context in which the stylesheet is used. Therefore, for top-level sheets, this information must be provided at selection time. For child sheets, the origin is inherited from their parent and the applicable media types are specified on the linking mechanism. svn path=/trunk/libcss/; revision=9802
* 1) Allocate css_style bytecode in 16 byte chunksJohn Mark Bell2009-08-291-13/+66
| | | | | | | | | | | | | | | | | | 2) Cache unused css_style objects with chunks of size 16, 32, 48, and 64 bytes The above should reduce heap churn somewhat. Further improvements are possible: 1) Make the property parsers write the parsed values direct into the output bytecode, instead of into a temporary object which is then merged into the output. 2) Perform similar caching for css_rule and selector objects. 3) Shrink-wrap finalised output styles rather than leaving them oversized. 4) Perform measurement to determine the optimal chunk sizes (power-of-2 makes maths simple and 16 is plucked from thin air) and cache bucket count/sizes. svn path=/trunk/libcss/; revision=9502
* Calculate the in-memory size of stylesheets and provide some API to access this.John Mark Bell2009-07-271-0/+137
| | | | svn path=/trunk/libcss/; revision=8830
* Fix selector hash some more. It turns out that I'd forgotten how it was ↵John Mark Bell2009-07-171-1/+2
| | | | | | meant to work. svn path=/trunk/libcss/; revision=8607
* Fix processing of rules after @import -- previously, they were completely ↵John Mark Bell2009-07-081-0/+2
| | | | | | ignored. svn path=/trunk/libcss/; revision=8386
* Len already includes the NUL, so stop trying to manually terminate url/title.John Mark Bell2009-07-011-2/+0
| | | | svn path=/trunk/libcss/; revision=8231
* Make all URIs absoluteJohn Mark Bell2009-07-011-1/+10
| | | | svn path=/trunk/libcss/; revision=8228
* Support for parsing inline stylesJohn Mark Bell2009-06-261-7/+22
| | | | svn path=/trunk/libcss/; revision=8024
* Nested block support.John Mark Bell2009-06-261-71/+114
| | | | svn path=/trunk/libcss/; revision=8014
* Most of the interned string lifetimes are at least no shorter than we think ↵Daniel Silverstone2009-02-151-6/+41
| | | | | | they ought to be. svn path=/trunk/libcss/; revision=6532
* Quirks mode parsingJohn Mark Bell2009-02-151-2/+53
| | | | svn path=/trunk/libcss/; revision=6519
* Port libcss to libwapcaplet.Daniel Silverstone2009-02-141-26/+11
| | | | | | | | | It passes the tests, perhaps we need more of them. Lifetimes of lwc_string objects really need attention before we can consider this finished. svn path=/trunk/libcss/; revision=6517
* Rework handling of imported stylesheets.John Mark Bell2009-02-141-15/+139
| | | | | | No longer is the client called back mid-parse. Instead, they must acquire details of and process imported stylesheets after css_stylesheet_data_done() has been called on the parent sheet. The return code of css_stylesheet_data_done() informs the client of the need to process imported sheets. svn path=/trunk/libcss/; revision=6504
* Drop css_error_handler and rename css_alloc to css_allocator_fnDaniel Silverstone2009-02-141-1/+1
| | | | svn path=/trunk/libcss/; revision=6482
* Discard selectors that contain pseudo elements in non-terminal simple selectors.John Mark Bell2009-02-141-2/+10
| | | | | | More test data for selectors with pseudo elements svn path=/trunk/libcss/; revision=6473
* Synchronise media type bitfield with reality -- it's 64bits wide.John Mark Bell2009-02-121-2/+2
| | | | svn path=/trunk/libcss/; revision=6453
* Distinguish between pseudo classes and pseudo elementsJohn Mark Bell2009-02-101-5/+2
| | | | svn path=/trunk/libcss/; revision=6406
* Use a chaining hash for selectors -- permits easy sorting of hash entries by ↵John Mark Bell2009-01-261-4/+6
| | | | | | specificity/rule index. svn path=/trunk/libcss/; revision=6280
* Propagate specificity of simple selectors to the head of each combinator chain.John Mark Bell2009-01-261-0/+3
| | | | | | This saves us having to calculate the specificity every time we want it. svn path=/trunk/libcss/; revision=6278
* Assert preconditions, rather than returning runtime errors.John Mark Bell2009-01-251-19/+22
| | | | | | Squash leakage of selectors array in selector/page rules. svn path=/trunk/libcss/; revision=6274
* Implement css_stylesheet_{add,remove}_rule, thus (de)populating the selector ↵John Mark Bell2009-01-251-7/+191
| | | | | | hash. svn path=/trunk/libcss/; revision=6273
* Clean up rules when destroying sheetJohn Mark Bell2009-01-251-1/+12
| | | | svn path=/trunk/libcss/; revision=6271
* Destroy rulesJohn Mark Bell2009-01-251-4/+81
| | | | svn path=/trunk/libcss/; revision=6269
* Destroy selectorsJohn Mark Bell2009-01-251-5/+17
| | | | svn path=/trunk/libcss/; revision=6268
* Beginnings of specificity. John Mark Bell2009-01-251-2/+28
| | | | | | | | Note that we store the specificity on each simple selector. Thus the total specificity for a combinator chain is obtained by summing the specificity of each chain member. TODO: distinguish between pseudo classes and elements. svn path=/trunk/libcss/; revision=6267
* Simplify API of css_stylesheet_selector_create -- it's always used to create ↵John Mark Bell2009-01-251-7/+4
| | | | | | element selectors. Everything else is handled via detail. svn path=/trunk/libcss/; revision=6266
* Destroy style objectsJohn Mark Bell2009-01-251-3/+3
| | | | svn path=/trunk/libcss/; revision=6265
* Destroy parser on completion of parse, rather than keeping it around until ↵John Mark Bell2009-01-251-11/+26
| | | | | | we destroy the sheet. svn path=/trunk/libcss/; revision=6264
* Selector hash.John Mark Bell2009-01-251-2/+13
| | | | svn path=/trunk/libcss/; revision=6263
* Purge stylesheet dumping code from the library.John Mark Bell2009-01-191-234/+0
| | | | | | | Create a common header for the test harnesses to use, instead. Fix z-index dumping while we're at it. svn path=/trunk/libcss/; revision=6146
* Don't build the serialisation code in release modeJohn Mark Bell2009-01-141-0/+2
| | | | svn path=/trunk/libcss/; revision=6064
* Make @import actually create a rule and attempt some kind of fetch logic.John Mark Bell2009-01-141-0/+26
| | | | | | | There's still a bunch of outstanding functionality here (like URL resolution and media list parsing). Also, there's currently no way of telling the client to stop fetching data for a stylesheet (and, more importantly, not to attempt to access the stylesheet again as it's about to be destroyed) svn path=/trunk/libcss/; revision=6062
* Create charset rule objects.John Mark Bell2009-01-141-0/+26
| | | | svn path=/trunk/libcss/; revision=6059
* Given that we're going to be copying selector details, anyway, it seems ↵John Mark Bell2008-12-011-41/+11
| | | | | | pointless to create objects on the heap which can equally well be on the stack, given the shortness of their lifetime. svn path=/trunk/libcss/; revision=5863
* Retain pointer to dictionary entries so we don't have to rediscover it later.John Mark Bell2008-12-011-48/+9
| | | | svn path=/trunk/libcss/; revision=5862
* Divorce css_string from whatever gets stored in lpu hashes.John Mark Bell2008-12-011-4/+6
| | | | | | | | | | | | | | | | | | Use pointers to parserutils_hash_entry directly in stylesheet datastructures. The upshot of this for allzengarden.css is: 5506 slots used (of 8192 => 67.211914%) Data: 8 full blocks: 32768 bytes 9 partial blocks: 35124 bytes (of 36864 => 95.279945%) Total: 69936 (4112) (32) Hash structures: 65584 i.e. a total string dictionary size of 135,520 bytes, which is some 74,056 bytes less than before. svn path=/trunk/libcss/; revision=5859
* Use parserutils_hash instead of parserutils_dict.John Mark Bell2008-11-301-10/+10
| | | | | | | | | | | | | | | | | | | | | | This approximately halves the size of the interned string table. We now have the following for allzengarden.css: 5507 slots used (of 8192 => 67.224121%) Data: 3 full blocks: 12288 bytes 10 partial blocks: 38946 bytes (of 40960 => 95.083008%) Total: 53488 (4112) (32) Entries: 21 full blocks: 86016 bytes 1 partial blocks: 2096 bytes (of 4096 => 51.171875%) Total: 90496 (4112) (32) Hash structures: 65592 Which gives a total dictionary size of 209,576 bytes. Note that 43% of this is parserutils_hash_entry structures (length-pointer pairs). It would be good, therefore, to be able to purge these. svn path=/trunk/libcss/; revision=5852
* Tidy things up somewhat.John Mark Bell2008-11-281-13/+5
| | | | | | css21 is now language, as everything will share the same parsing rules (although there is facility to alter behaviour based upon the language level -- consult language->sheet->level and then decide what to do) svn path=/trunk/libcss/; revision=5815
* Optimise css_stylesheet_add_rule by the cunning approach of not iterating ↵John Mark Bell2008-11-281-9/+6
| | | | | | through a singly linked list to find the end every time we want to insert a rule. This doubles parsing speed. svn path=/trunk/libcss/; revision=5811
* Change the way in which css_rules are defined. This is more compact than the ↵John Mark Bell2008-11-281-25/+61
| | | | | | previous approach. Space requirements for rule objects alone is now 447,120 bytes as opposed to 819,270 bytes previously. This reduces the space requirements for allzengarden.css to 2,041,712 bytes, which is 45% the size of what we had originally. svn path=/trunk/libcss/; revision=5810
* css_string is now the same as a parserutils_dict_entry. This allows us to ↵John Mark Bell2008-11-271-55/+198
| | | | | | | | | | use dict entries directly as strings. iChange the way in which selectors are represented. This significantly reduces memory requirements -- reducing the approximate usage count (excludes the string dictionary, which is about 360k) of allzengarden.css from 4,535,400 bytes to 2,414,312 bytes on a 64bit platform. The string dictionary is now created and owned by the stylesheet object. The parser is just given access to this so that it can store strings in it. svn path=/trunk/libcss/; revision=5809
* Calculate some kind of ballpark figure for the memory requirements of a ↵John Mark Bell2008-11-271-12/+31
| | | | | | stylesheet. Summary: lots. svn path=/trunk/libcss/; revision=5808
* Make stylesheet component constructors/destructors report errorsJohn Mark Bell2008-11-091-50/+84
| | | | svn path=/trunk/libcss/; revision=5675
* Port libcss to new lpu API.John Mark Bell2008-11-091-6/+7
| | | | | | Make lexer, core parser, and css21 parser constructors&destructors return errors svn path=/trunk/libcss/; revision=5674
* Fix memory corruption. This took far too long to debug. Bah.John Mark Bell2008-10-251-1/+2
| | | | svn path=/trunk/libcss/; revision=5628
* A bunch of property parsers.John Mark Bell2008-10-251-0/+17
| | | | | | | | | | Split out !important parsing into a separate function. Support for dumping bytecode to a file handle in some kind of human-readable format. Strings can be represented in the bytecode as a pointer, length pair rather than embedding the string data into the bytecode -- all strings are interned by the core syntax parser. Add todo relating to early destruction of parser object (it shouldn't be needed once parsing is complete). Note documented issue surrounding interned string dictionary, however. In general, it seems wasteful to create a new dictionary containing string representations of keywords for every single parser instance. It would be better to have one central (statically allocated?) dictionary for this and then each parser instance can have a smaller dictionary containing any unknown strings contained within the stylesheet being parsed (e.g. string constants or URLs). svn path=/trunk/libcss/; revision=5627
* Something approximating a parser for clear.John Mark Bell2008-10-231-0/+92
| | | | | | Provide API to create/destroy css_styles and append them to css_rules. svn path=/trunk/libcss/; revision=5625
* Fix stupid.John Mark Bell2008-10-201-4/+8
| | | | svn path=/trunk/libcss/; revision=5606
* Squash warningJohn Mark Bell2008-10-201-1/+1
| | | | svn path=/trunk/libcss/; revision=5605