mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-08-16 23:39:44 +00:00
LibWeb: Further optimize :hover style invalidation
Previously, we optimized hover style invalidation to mark for style updates only those elements that were matched by :hover selectors in the last style calculation. This change takes it a step further by invalidating only the elements where the set of selectors that use :hover changes after hovered element is modified. The implementation is as follows: 1. Collect all elements whose styles might be affected by a change in the hovered element. 2. Retrieve a list of all selectors that use :hover. 3. Test each selector against each element and record which selectors match. 4. Update m_hovered_node to the newly hovered element. 5. Repeat step 3. 6. For each element, compare the previous and current sets of matched selectors. If they differ, mark the element for style recalculation.
This commit is contained in:
parent
ae9257bf3b
commit
482e5deb85
Notes:
github-actions[bot]
2025-01-04 19:33:30 +00:00
Author: https://github.com/kalenikaliaksandr
Commit: 482e5deb85
Pull-request: https://github.com/LadybirdBrowser/ladybird/pull/3121
6 changed files with 101 additions and 25 deletions
|
@ -174,6 +174,7 @@ public:
|
|||
|
||||
virtual FlyString node_name() const override { return "#document"_fly_string; }
|
||||
|
||||
void invalidate_style_for_elements_affected_by_hover_change(GC::Ptr<Node> old_new_hovered_common_ancestor, GC::Ptr<Node> hovered_node);
|
||||
void set_hovered_node(Node*);
|
||||
Node* hovered_node() { return m_hovered_node.ptr(); }
|
||||
Node const* hovered_node() const { return m_hovered_node.ptr(); }
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue