mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-08-09 17:49:40 +00:00
LibWeb: Add per-layer rule caches in StyleComputer
This allows us to filter by layer *once* instead of doing it for every rule that runs. Knocks ~2 seconds of loading time off of https://wpt.fyi/
This commit is contained in:
parent
e65ca3a7d2
commit
3b3f06ca68
Notes:
github-actions[bot]
2025-01-24 16:55:50 +00:00
Author: https://github.com/awesomekling
Commit: 3b3f06ca68
Pull-request: https://github.com/LadybirdBrowser/ladybird/pull/3356
2 changed files with 35 additions and 37 deletions
|
@ -272,9 +272,13 @@ private:
|
|||
HashMap<FlyString, NonnullRefPtr<Animations::KeyframeEffect::KeyFrameSet>> rules_by_animation_keyframes;
|
||||
};
|
||||
|
||||
NonnullOwnPtr<RuleCache> make_rule_cache_for_cascade_origin(CascadeOrigin, SelectorInsights&, Vector<MatchingRule>& hover_rules);
|
||||
struct BuiltRuleCaches {
|
||||
NonnullOwnPtr<RuleCache> main_rules;
|
||||
HashMap<FlyString, NonnullOwnPtr<RuleCache>> layer_rules;
|
||||
};
|
||||
[[nodiscard]] BuiltRuleCaches make_rule_cache_for_cascade_origin(CascadeOrigin, SelectorInsights&, Vector<MatchingRule>& hover_rules);
|
||||
|
||||
RuleCache const& rule_cache_for_cascade_origin(CascadeOrigin) const;
|
||||
[[nodiscard]] RuleCache const* rule_cache_for_cascade_origin(CascadeOrigin, FlyString const& qualified_layer_name) const;
|
||||
|
||||
static void collect_selector_insights(Selector const&, SelectorInsights&);
|
||||
|
||||
|
@ -282,6 +286,7 @@ private:
|
|||
Vector<MatchingRule> m_hover_rules;
|
||||
OwnPtr<StyleInvalidationData> m_style_invalidation_data;
|
||||
OwnPtr<RuleCache> m_author_rule_cache;
|
||||
HashMap<FlyString, NonnullOwnPtr<RuleCache>> m_layer_rule_caches;
|
||||
OwnPtr<RuleCache> m_user_rule_cache;
|
||||
OwnPtr<RuleCache> m_user_agent_rule_cache;
|
||||
GC::Root<CSSStyleSheet> m_user_style_sheet;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue