path: root/include/libcss/select.h
Commit message (Collapse)AuthorAgeFilesLines
* Selection: Don't duplicate unit conversion members in media descriptor.tlsa/unitsMichael Drake2021-05-191-2/+4
* Selection: Remove client callback for unit conversion.Michael Drake2021-05-191-3/+2
| | | | | | | Now clients provide a unit conversion context and libcss provides code to perform unit conversion. This reduces the amount of common code that clients have to write.
* Media queries: Update selection API to support media queries.Michael Drake2019-05-041-4/+4
| | | | | | | | | | | | | | | | | | | | | The API changes are: 1. When building a selection context, stylesheets added with `css_select_ctx_{append|insert}_sheet()` now have to have media strings associcated with them. Previously they took a simple bitfield for CSS media type. 2. When selecting for an element, the client needs to specify the current media requirements. Previously it only had to provide the bitfield for CSS media type. 3. Same for the css_select_font_faces API. The selection handling has been updated to handle the new API, however it is currently only looking at the media type when performing selection. Signed-off-by: Michael Drake <>
* Strip trailing whitespace.Michael Drake2017-09-041-6/+6
* Intern partial styles.Michael Drake2016-11-191-0/+3
| | | | | Note this changes the public API. We can't compose directly over child style now, since it may be interned.
* Remove trailing tab.Michael Drake2016-11-191-1/+1
* Change how presentational hints are handled.Michael Drake2016-02-021-2/+2
| | | | | | | | | | | | | | | Previously, we performed normal selection from CSS sources, and then iterated over all the properties in the populated computed style. If the properties were unset or their values were not from either a UA stylesheet or user stylesheet with !important set, then we asked the client program (e.g. NetSurf) if there were any presentational hints for that node, for each such property. In the worst case this triggered N_PROPERTIES * N_NODES calls back to the client program, even for properties that can't be set via HTML attributes. The new API asks the client to supply a list of all the presentational hints that apply to the given node. For most nodes on modern documents, this is 0. Any presentational hints are applied before selection from CSS sources.
* Various changes which modify API and ABI:Michael Drake2013-12-131-10/+64
| | | | | | | | | - Remove client allocation function. - Change node_classes callback not to yield array ownership to libcss. - Node bloom filters now built by, during selection libcss. - Added selection callbacks to get and set data on document nodes. Test suite, example, and documentation updated to match.
* Significantly optimise CSS selection performance.Michael Drake2013-12-011-0/+2
| | | | | | | | | | | | | | | | Now we pass a node bloom filter to css_get_style. That node bloom filter is filled with the node's ancestor element, class, and id names. Internally, libcss also generates a bloom filter for each selector chain. If the selector chain's bloom filter is not a subset of the node bloom filter, we know that the selector chain's rule does not apply to the node. This avoids the slow selector chain matching process. Other smaller optimisations to move the ruling out of selector chains for inapplicable media types and other reasons to before we start comparing rules from different sources to find the next rule. All this is now done in hash.c so select.c never sees the trivially ruled out rules.
* @font-face support. Credit: James MontgomerieJohn Mark Bell2011-12-041-1/+20
| | | | | | Things missing: parser tests; the following descriptors: font-feature-settings, font-stretch, font-variant, unicode-range. svn path=/trunk/libcss/; revision=13244
* Add structure versioning for client inputJohn Mark Bell2011-03-131-0/+7
| | | | svn path=/trunk/libcss/; revision=12007
* CSS3 NamespacesJohn Mark Bell2011-03-121-15/+13
| | | | svn path=/trunk/libcss/; revision=11972
* CSS3 SelectorsJohn Mark Bell2011-01-311-1/+22
| | | | svn path=/trunk/libcss/; revision=11557
* Turns out, we know the size of the styles block up-front.John Mark Bell2011-01-051-1/+1
| | | | svn path=/trunk/libcss/; revision=11214
* Simultaneously select styles for base + pseudo elements.John Mark Bell2011-01-051-7/+28
| | | | svn path=/trunk/libcss/; revision=11211
* Sprinkle some C++ scoping aroundJohn Mark Bell2010-10-231-0/+9
| | | | svn path=/trunk/libcss/; revision=10901
* Fix libcss to use new libwapcaplet behaviour.Daniel Silverstone2010-03-271-3/+3
| | | | | | | 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-2/+4
| | | | | | | | | 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
* Change selector hash to segregate:John Mark Bell2009-07-291-0/+5
| | | | | | | | | | | | | 1) element selectors 2) universal selectors with class names 3) universal selectors with ids 4) universal selectors Only bother looking for matching selectors in 2 & 3 if the node being selected for has class names or an id, respectively. In theory, this should speed up style selection somewhat. svn path=/trunk/libcss/; revision=8882
* Remove pointless parameterJohn Mark Bell2009-07-211-1/+1
| | | | svn path=/trunk/libcss/; revision=8653
* Change mechanism for handling case sensitivity of element names. Now has ↵John Mark Bell2009-07-171-0/+2
| | | | | | | | another selection handler callback for this. Change selector hash to use an ASCII case-insensitive hash function. svn path=/trunk/libcss/; revision=8602
* Add a flag to the font size computation callback to indicate that the ↵John Mark Bell2009-07-161-1/+1
| | | | | | resultant absolute font size should not be clamped to a fixed minimum (e.g. if the client has a minimum permissible font size) svn path=/trunk/libcss/; revision=8586
* Add callback to make client compute the font size.John Mark Bell2009-07-041-2/+3
| | | | | | Some progress towards computing absolute values. svn path=/trunk/libcss/; revision=8311
* Query client for initial values of color, font-family, quotes, and ↵John Mark Bell2009-07-041-0/+5
| | | | | | voice-family properties. svn path=/trunk/libcss/; revision=8306
* Support for parsing inline stylesJohn Mark Bell2009-06-261-0/+1
| | | | svn path=/trunk/libcss/; revision=8024
* Completely change the approach used for presentational hints.John Mark Bell2009-03-231-1/+4
| | | | | | | | This one stands a chance of working sanely. While this compiles, please don't expect it to link. svn path=/trunk/libcss/; revision=6820
* Sketch out something for presentational hints.John Mark Bell2009-03-221-1/+2
| | | | | | | The client will have to maintain some state to be able to calculate this struct for every node selection, but that shouldn't be overly onerous. Also, the mess surrounding centering can only be sensibly solved through the addition of a new, prefixed, property. svn path=/trunk/libcss/; revision=6816
* Port libcss to libwapcaplet.Daniel Silverstone2009-02-141-22/+14
| | | | | | | | | 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
* Drop css_error_handler and rename css_alloc to css_allocator_fnDaniel Silverstone2009-02-141-1/+1
| | | | svn path=/trunk/libcss/; revision=6482
* Pseudo classes are now matched by callbacks to the client. This is far ↵John Mark Bell2009-02-141-18/+15
| | | | | | | | | saner, as any node may match a pseudo class, not just the immediate target of the selection. Munge test data to no longer expect :active to match -- there's currently no way to specify which node(s) in the tree have which pseudo classes applying to them. The pseudo classes on @page are no longer supported (namely, :left, :right, :first). These, and @page itself, probably want a dedicated API, as they are nothing to do with normal selection. Probably something like css_error css_select_page_margins(ctx, CSS_PAGE_LEFT, &computed); svn path=/trunk/libcss/; revision=6476
* Handle :first-child within libcssJohn Mark Bell2009-02-141-10/+11
| | | | svn path=/trunk/libcss/; revision=6474
* Enumerate pseudo classes and elementsJohn Mark Bell2009-02-101-0/+20
| | | | svn path=/trunk/libcss/; revision=6407
* Match detailsJohn Mark Bell2009-02-091-0/+22
| | | | svn path=/trunk/libcss/; revision=6404
* This is more likely to handle universal simple_selectors correctly.John Mark Bell2009-02-091-3/+6
| | | | | | | | Refactor stuff while we're at it. Selector chains containing universal simple components are expensive to match/reject, as they require matching details on every previous sibling/ancestor (depending on the combinator type). Thus, we aim to handle the universal case last, to have the best chance of avoiding it. svn path=/trunk/libcss/; revision=6403
* Match selector chains. Universal selectors will probably break this.John Mark Bell2009-02-091-1/+9
| | | | svn path=/trunk/libcss/; revision=6402
* Beginnings of a handler function table.John Mark Bell2009-02-091-1/+9
| | | | svn path=/trunk/libcss/; revision=6401
* Oh look, I've changed my mind again.John Mark Bell2009-02-071-1/+1
| | | | | | It's far better that the client creates computed style objects which we then populate. This will allow more efficient composition of styles as, in the most common case, it won't require any memory allocation. svn path=/trunk/libcss/; revision=6390
* More API changes.John Mark Bell2009-02-071-1/+1
| | | | | | | Make css_computed_style_create() private. Implement css_computed_style_[create,destroy](). svn path=/trunk/libcss/; revision=6389
* Create header containing computed style representation. This isn't remotely ↵John Mark Bell2009-01-271-6/+0
| | | | | | complete. svn path=/trunk/libcss/; revision=6289
* I guess it helps if you commit the header, too.John Mark Bell2009-01-271-2/+6
| | | | svn path=/trunk/libcss/; revision=6286
* Introduce ability to create/destroy selection contexts.John Mark Bell2009-01-261-0/+36
svn path=/trunk/libcss/; revision=6284