mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-08-05 23:59:49 +00:00
LibWeb: Make :hover invalidation logic reusable for all pseudo classes
We achieve this by keeping track of all checked pseudo class selectors in the SelectorEngine code. We also give StyleComputer per-pseudo-class rule caches.
This commit is contained in:
parent
ed35f9e7c2
commit
e1777f6e79
Notes:
github-actions[bot]
2025-04-17 17:47:22 +00:00
Author: https://github.com/awesomekling
Commit: e1777f6e79
Pull-request: https://github.com/LadybirdBrowser/ladybird/pull/4388
13 changed files with 134 additions and 59 deletions
|
@ -1207,16 +1207,16 @@ GC::Ptr<Layout::NodeWithStyle> Element::get_pseudo_element_node(CSS::PseudoEleme
|
|||
return nullptr;
|
||||
}
|
||||
|
||||
bool Element::affected_by_hover() const
|
||||
bool Element::affected_by_pseudo_class(CSS::PseudoClass pseudo_class) const
|
||||
{
|
||||
if (m_computed_properties && m_computed_properties->did_match_any_hover_rules()) {
|
||||
if (m_computed_properties && m_computed_properties->has_attempted_match_against_pseudo_class(pseudo_class)) {
|
||||
return true;
|
||||
}
|
||||
if (m_pseudo_element_data) {
|
||||
for (auto& pseudo_element : *m_pseudo_element_data) {
|
||||
if (!pseudo_element.computed_properties)
|
||||
continue;
|
||||
if (pseudo_element.computed_properties->did_match_any_hover_rules())
|
||||
if (pseudo_element.computed_properties->has_attempted_match_against_pseudo_class(pseudo_class))
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue