1
0
Fork 0
mirror of https://github.com/LadybirdBrowser/ladybird.git synced 2025-06-11 18:20:43 +09:00

LibWeb: Use ancestor filters for hover style invalidation

By using ancestor filters some selectors could be early rejected
skipping selector engine invocation. According to my measurements it's
30-80% hover selectors depending on the website.
This commit is contained in:
Aliaksandr Kalenik 2025-01-28 03:04:04 +01:00 committed by Alexander Kalenik
parent b153420feb
commit db47fa3db1
Notes: github-actions[bot] 2025-01-28 17:56:41 +00:00
2 changed files with 30 additions and 20 deletions

View file

@ -187,6 +187,8 @@ public:
void absolutize_values(ComputedProperties&) const;
void compute_font(ComputedProperties&, DOM::Element const*, Optional<CSS::Selector::PseudoElement::Type>) const;
[[nodiscard]] bool should_reject_with_ancestor_filter(Selector const&) const;
private:
enum class ComputeStyleMode {
Normal,
@ -195,8 +197,6 @@ private:
struct MatchingFontCandidate;
[[nodiscard]] bool should_reject_with_ancestor_filter(Selector const&) const;
[[nodiscard]] GC::Ptr<ComputedProperties> compute_style_impl(DOM::Element&, Optional<CSS::Selector::PseudoElement::Type>, ComputeStyleMode) const;
[[nodiscard]] GC::Ref<CascadedProperties> compute_cascaded_values(DOM::Element&, Optional<CSS::Selector::PseudoElement::Type>, bool& did_match_any_pseudo_element_rules, bool& did_match_any_hover_rules, ComputeStyleMode) const;
static RefPtr<Gfx::FontCascadeList const> find_matching_font_weight_ascending(Vector<MatchingFontCandidate> const& candidates, int target_weight, float font_size_in_pt, bool inclusive);