mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-04-21 12:05:15 +00:00
LibWeb/DOM: Cache computed style for ::marker
This allows us to inspect its properties. To avoid wasted work, we only compute and cache the properties if the originating element was, or is, displaying as a list item.
This commit is contained in:
parent
28a1297360
commit
49b505e4ae
Notes:
github-actions[bot]
2025-02-12 13:49:54 +00:00
Author: https://github.com/AtkinsSJ Commit: https://github.com/LadybirdBrowser/ladybird/commit/49b505e4aed Pull-request: https://github.com/LadybirdBrowser/ladybird/pull/3529
1 changed files with 8 additions and 2 deletions
|
@ -513,11 +513,15 @@ CSS::RequiredInvalidationAfterStyleChange Element::recompute_style()
|
|||
new_computed_properties->set_property(CSS::PropertyID::TextAlign, CSS::CSSKeywordValue::create(CSS::Keyword::Start));
|
||||
}
|
||||
|
||||
bool had_list_marker = false;
|
||||
|
||||
CSS::RequiredInvalidationAfterStyleChange invalidation;
|
||||
if (m_computed_properties)
|
||||
if (m_computed_properties) {
|
||||
invalidation = compute_required_invalidation(*m_computed_properties, new_computed_properties);
|
||||
else
|
||||
had_list_marker = m_computed_properties->display().is_list_item();
|
||||
} else {
|
||||
invalidation = CSS::RequiredInvalidationAfterStyleChange::full();
|
||||
}
|
||||
|
||||
if (!invalidation.is_none())
|
||||
set_computed_properties(move(new_computed_properties));
|
||||
|
@ -542,6 +546,8 @@ CSS::RequiredInvalidationAfterStyleChange Element::recompute_style()
|
|||
|
||||
recompute_pseudo_element_style(CSS::Selector::PseudoElement::Type::Before);
|
||||
recompute_pseudo_element_style(CSS::Selector::PseudoElement::Type::After);
|
||||
if (had_list_marker || m_computed_properties->display().is_list_item())
|
||||
recompute_pseudo_element_style(CSS::Selector::PseudoElement::Type::Marker);
|
||||
|
||||
if (invalidation.is_none())
|
||||
return invalidation;
|
||||
|
|
Loading…
Add table
Reference in a new issue