mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-08-01 21:59:07 +00:00
LibWeb: Optimize :hover style invalidation
Instead of recalculating styles for all nodes in the common ancestor of the new and old hovered nodes' subtrees, this change introduces the following approach: - While calculating ComputedProperties, a flag is saved if any rule applied to an element is affected by the hover state during the execution of SelectorEngine::matches(). - When the hovered element changes, styles are marked for recalculation only if the flag saved in ComputedProperties indicates that the element could be affected by the hover state.
This commit is contained in:
parent
db58986e5f
commit
e465e922bd
Notes:
github-actions[bot]
2025-01-04 19:33:47 +00:00
Author: https://github.com/kalenikaliaksandr
Commit: e465e922bd
Pull-request: https://github.com/LadybirdBrowser/ladybird/pull/3121
9 changed files with 124 additions and 77 deletions
|
@ -213,6 +213,9 @@ public:
|
|||
|
||||
static float resolve_opacity_value(CSSStyleValue const& value);
|
||||
|
||||
bool did_match_any_hover_rules() const { return m_did_match_any_hover_rules; }
|
||||
void set_did_match_any_hover_rules() { m_did_match_any_hover_rules = true; }
|
||||
|
||||
private:
|
||||
friend class StyleComputer;
|
||||
|
||||
|
@ -236,6 +239,8 @@ private:
|
|||
mutable RefPtr<Gfx::FontCascadeList> m_font_list;
|
||||
|
||||
Optional<CSSPixels> m_line_height;
|
||||
|
||||
bool m_did_match_any_hover_rules { false };
|
||||
};
|
||||
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue