mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-08-06 16:19:23 +00:00
LibWeb: Use invalidation sets to reduce style recalculation
Implements idea described in https://docs.google.com/document/d/1vEW86DaeVs4uQzNFI5R-_xS9TcS1Cs_EUsHRSgCHGu8 Invalidation sets are used to reduce the number of elements marked for style recalculation by collecting metadata from style rules about the dependencies between properties that could affect an element’s style. Currently, this optimization is only applied to style invalidation triggered by class list mutations on an element.
This commit is contained in:
parent
58c78cb003
commit
c5f2a88f69
Notes:
github-actions[bot]
2025-01-19 18:55:55 +00:00
Author: https://github.com/kalenikaliaksandr
Commit: c5f2a88f69
Pull-request: https://github.com/LadybirdBrowser/ladybird/pull/3292
Reviewed-by: https://github.com/awesomekling
11 changed files with 549 additions and 3 deletions
25
Libraries/LibWeb/CSS/StyleInvalidationData.h
Normal file
25
Libraries/LibWeb/CSS/StyleInvalidationData.h
Normal file
|
@ -0,0 +1,25 @@
|
|||
/*
|
||||
* Copyright (c) 2025, Aliaksandr Kalenik <kalenik.aliaksandr@gmail.com>
|
||||
*
|
||||
* SPDX-License-Identifier: BSD-2-Clause
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <AK/HashMap.h>
|
||||
#include <LibWeb/CSS/InvalidationSet.h>
|
||||
#include <LibWeb/Forward.h>
|
||||
|
||||
namespace Web::CSS {
|
||||
|
||||
struct StyleInvalidationData {
|
||||
HashMap<InvalidationSet::Property, InvalidationSet> descendant_invalidation_sets;
|
||||
HashTable<FlyString> ids_used_in_has_selectors;
|
||||
HashTable<FlyString> class_names_used_in_has_selectors;
|
||||
HashTable<FlyString> attribute_names_used_in_has_selectors;
|
||||
HashTable<FlyString> tag_names_used_in_has_selectors;
|
||||
|
||||
InvalidationSet build_invalidation_sets_for_selector(Selector const& selector);
|
||||
};
|
||||
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue