mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-08-01 13:49:16 +00:00
LibWeb: Add mechanism to invalidate only inherited styles
We can now mark an element as needing an "inherited style update" rather than a full "style update". This effectively means that the next style update will visit the element and pull all of its inherited properties from the relevant ancestor element. This is now used for descendants of elements with animated style.
This commit is contained in:
parent
92ac702c0c
commit
dc8343cc23
Notes:
github-actions[bot]
2024-12-23 16:06:18 +00:00
Author: https://github.com/awesomekling
Commit: dc8343cc23
Pull-request: https://github.com/LadybirdBrowser/ladybird/pull/3023
7 changed files with 55 additions and 16 deletions
|
@ -1249,6 +1249,22 @@ EventTarget* Node::get_parent(Event const&)
|
|||
return parent();
|
||||
}
|
||||
|
||||
void Node::set_needs_inherited_style_update(bool value)
|
||||
{
|
||||
if (m_needs_inherited_style_update == value)
|
||||
return;
|
||||
m_needs_inherited_style_update = value;
|
||||
|
||||
if (m_needs_inherited_style_update) {
|
||||
for (auto* ancestor = parent_or_shadow_host(); ancestor; ancestor = ancestor->parent_or_shadow_host()) {
|
||||
if (ancestor->m_child_needs_style_update)
|
||||
break;
|
||||
ancestor->m_child_needs_style_update = true;
|
||||
}
|
||||
document().schedule_style_update();
|
||||
}
|
||||
}
|
||||
|
||||
void Node::set_needs_style_update(bool value)
|
||||
{
|
||||
if (m_needs_style_update == value)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue