mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2024-11-22 23:50:19 +00:00
LibWeb: Enable fast path of animation invalidation for pseudo-elements
3abd3ef5e2
made possible using fast
invalidation path for pseudo-element by saving previously computed style
in DOM::Element.
This commit is contained in:
parent
4049cce40c
commit
9e22233be9
Notes:
github-actions[bot]
2024-08-02 06:06:21 +00:00
Author: https://github.com/kalenikaliaksandr Commit: https://github.com/LadybirdBrowser/ladybird/commit/9e22233be97 Pull-request: https://github.com/LadybirdBrowser/ladybird/pull/921
1 changed files with 14 additions and 8 deletions
|
@ -954,13 +954,12 @@ void KeyframeEffect::update_style_properties()
|
|||
if (!target)
|
||||
return;
|
||||
|
||||
if (pseudo_element_type().has_value()) {
|
||||
// StyleProperties are not saved for pseudo-elements so there is nothing to patch
|
||||
target->invalidate_style();
|
||||
return;
|
||||
}
|
||||
CSS::StyleProperties* style = nullptr;
|
||||
if (!pseudo_element_type().has_value())
|
||||
style = target->computed_css_values();
|
||||
else
|
||||
style = target->pseudo_element_computed_css_values(pseudo_element_type().value());
|
||||
|
||||
auto* style = target->computed_css_values();
|
||||
if (!style)
|
||||
return;
|
||||
|
||||
|
@ -988,8 +987,15 @@ void KeyframeEffect::update_style_properties()
|
|||
|
||||
auto invalidation = compute_required_invalidation(animated_properties_before_update, style->animated_property_values());
|
||||
|
||||
if (target->layout_node())
|
||||
target->layout_node()->apply_style(*style);
|
||||
if (!pseudo_element_type().has_value()) {
|
||||
if (target->layout_node())
|
||||
target->layout_node()->apply_style(*style);
|
||||
} else {
|
||||
auto pseudo_element_node = target->get_pseudo_element_node(pseudo_element_type().value());
|
||||
if (auto* node_with_style = dynamic_cast<Layout::NodeWithStyle*>(pseudo_element_node.ptr())) {
|
||||
node_with_style->apply_style(*style);
|
||||
}
|
||||
}
|
||||
|
||||
if (invalidation.relayout)
|
||||
document.set_needs_layout();
|
||||
|
|
Loading…
Reference in a new issue