Struct style::sharing::StyleSharingCache
[−]
[src]
pub struct StyleSharingCache<E: TElement> { /* fields omitted */ }
An LRU cache of the last few nodes seen, so that we can aggressively try to reuse their styles.
Note that this cache is flushed every time we steal work from the queue, so storing nodes here temporarily is safe.
Methods
impl<E: TElement> StyleSharingCache<E>
[src]
pub fn new() -> Self
[src]
Create a new style sharing candidate cache.
pub fn insert_if_possible(
&mut self,
element: &E,
style: &PrimaryStyle,
validation_data_holder: Option<&mut StyleSharingTarget<E>>,
dom_depth: usize
)
[src]
&mut self,
element: &E,
style: &PrimaryStyle,
validation_data_holder: Option<&mut StyleSharingTarget<E>>,
dom_depth: usize
)
Tries to insert an element in the style sharing cache.
Fails if we know it should never be in the cache.
NB: We pass a source for the validation data, rather than the data itself, to avoid memmoving at each function call. See rust issue #42763.
pub fn clear(&mut self)
[src]
Clear the style sharing candidate cache.
pub fn lookup_by_rules(
&mut self,
shared_context: &SharedStyleContext,
inherited: &ComputedValues,
rules: &StrongRuleNode,
visited_rules: Option<&StrongRuleNode>,
target: E
) -> Option<PrimaryStyle>
[src]
&mut self,
shared_context: &SharedStyleContext,
inherited: &ComputedValues,
rules: &StrongRuleNode,
visited_rules: Option<&StrongRuleNode>,
target: E
) -> Option<PrimaryStyle>
Attempts to find an element in the cache with the given primary rule node and parent.