mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-07-30 20:59:16 +00:00
LibWeb: Use invalidation sets for :defined
style invalidation
This commit is contained in:
parent
51a5ebb91d
commit
a6bea99959
Notes:
github-actions[bot]
2025-02-06 19:08:10 +00:00
Author: https://github.com/kalenikaliaksandr
Commit: a6bea99959
Pull-request: https://github.com/LadybirdBrowser/ladybird/pull/3476
Reviewed-by: https://github.com/AtkinsSJ
4 changed files with 8 additions and 16 deletions
|
@ -1183,6 +1183,9 @@ bool Element::includes_properties_from_invalidation_set(CSS::InvalidationSet con
|
|||
case CSS::PseudoClass::Disabled: {
|
||||
return is_actually_disabled();
|
||||
}
|
||||
case CSS::PseudoClass::Defined: {
|
||||
return is_defined();
|
||||
}
|
||||
case CSS::PseudoClass::Checked: {
|
||||
// FIXME: This could be narrowed down to return true only if element is actually checked.
|
||||
return is<HTML::HTMLInputElement>(*this) || is<HTML::HTMLOptionElement>(*this);
|
||||
|
@ -2366,8 +2369,9 @@ void Element::set_custom_element_state(CustomElementState state)
|
|||
return;
|
||||
m_custom_element_state = state;
|
||||
|
||||
if (document().style_computer().may_have_defined_selectors())
|
||||
invalidate_style(StyleInvalidationReason::CustomElementStateChange);
|
||||
Vector<CSS::InvalidationSet::Property, 1> changed_properties;
|
||||
changed_properties.append({ .type = CSS::InvalidationSet::Property::Type::PseudoClass, .value = CSS::PseudoClass::Defined });
|
||||
invalidate_style(StyleInvalidationReason::CustomElementStateChange, changed_properties, {});
|
||||
}
|
||||
|
||||
// https://html.spec.whatwg.org/multipage/dom.html#html-element-constructors
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue