mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-08-12 19:19:30 +00:00
LibWeb: Cache whether there are any :has() selectors present
As useful as they may be to web developers, :has() selectors complicate the style invalidation process quite a lot. Let's have StyleComputer keep track of whether they are present at all in the current set of active style sheets. This will allow us to implement fast-path optimizations when there are no :has() selectors.
This commit is contained in:
parent
df048e10f5
commit
8beb7c7700
Notes:
github-actions[bot]
2024-09-22 18:08:47 +00:00
Author: https://github.com/awesomekling
Commit: 8beb7c7700
Pull-request: https://github.com/LadybirdBrowser/ladybird/pull/1483
Reviewed-by: https://github.com/kalenikaliaksandr
2 changed files with 9 additions and 0 deletions
|
@ -156,6 +156,8 @@ public:
|
|||
};
|
||||
void collect_animation_into(DOM::Element&, Optional<CSS::Selector::PseudoElement::Type>, JS::NonnullGCPtr<Animations::KeyframeEffect> animation, StyleProperties& style_properties, AnimationRefresh = AnimationRefresh::No) const;
|
||||
|
||||
[[nodiscard]] bool has_has_selectors() const { return m_has_has_selectors; }
|
||||
|
||||
private:
|
||||
enum class ComputeStyleMode {
|
||||
Normal,
|
||||
|
@ -221,12 +223,15 @@ private:
|
|||
Vector<MatchingRule> other_rules;
|
||||
|
||||
HashMap<FlyString, NonnullRefPtr<Animations::KeyframeEffect::KeyFrameSet>> rules_by_animation_keyframes;
|
||||
|
||||
bool has_has_selectors { false };
|
||||
};
|
||||
|
||||
NonnullOwnPtr<RuleCache> make_rule_cache_for_cascade_origin(CascadeOrigin);
|
||||
|
||||
RuleCache const& rule_cache_for_cascade_origin(CascadeOrigin) const;
|
||||
|
||||
bool m_has_has_selectors { false };
|
||||
OwnPtr<RuleCache> m_author_rule_cache;
|
||||
OwnPtr<RuleCache> m_user_rule_cache;
|
||||
OwnPtr<RuleCache> m_user_agent_rule_cache;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue