libcss
Loading...
Searching...
No Matches
Macros | Typedefs
bloom.h File Reference
#include <stdint.h>
#include <string.h>

Go to the source code of this file.

Macros

#define CSS_BLOOM_SIZE   4
 
#define INDEX_BITS_N   (CSS_BLOOM_SIZE - 1)
 

Typedefs

typedef uint32_t css_bloom
 

Detailed Description

Bloom filter for CSS style selection optimisation.

Attempting to match CSS rules by querying the client about DOM nodes via the selection callbacks is slow. To avoid the slow matching of CSS rule selector chains, we build up two bloom filters. One describing the rule selector chain, and one describing the node we are selecting for in css_get_style.

These bloom filters have bits set according to the node's ancestor element names, class names and id names.

Generate the bloom filter by adding calling css_bloom_add_hash() on each ancestor element name, class name and id name for the node.

Use the insensitive hash value:

lwc_err = lwc_string_caseless_hash_value(str, &hash);

We avoid matching most selector chains by checking whether the rule bloom is a subset of the node bloom.

Macro Definition Documentation

◆ CSS_BLOOM_SIZE

#define CSS_BLOOM_SIZE   4

◆ INDEX_BITS_N

#define INDEX_BITS_N   (CSS_BLOOM_SIZE - 1)

Typedef Documentation

◆ css_bloom

typedef uint32_t css_bloom