mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-08-31 06:38:22 +00:00
LibWeb: Avoid unnecessary style recomputation during traversal
While traversing the DOM tree, looking for nodes that need a style update, we were recomputing style for every node visited along the way, even nodes that didn't themselves need a style update (but one of their descendants did). This avoids a bunch of completely unnecessary style recomputation on basically every website.
This commit is contained in:
parent
0de9818470
commit
5431db8c1c
Notes:
github-actions[bot]
2024-11-06 09:50:26 +00:00
Author: https://github.com/awesomekling
Commit: 5431db8c1c
Pull-request: https://github.com/LadybirdBrowser/ladybird/pull/2181
1 changed files with 3 additions and 1 deletions
|
@ -1258,7 +1258,9 @@ void Document::update_layout()
|
|||
bool is_display_none = false;
|
||||
|
||||
if (is<Element>(node)) {
|
||||
invalidation |= static_cast<Element&>(node).recompute_style();
|
||||
if (needs_full_style_update || node.needs_style_update()) {
|
||||
invalidation |= static_cast<Element&>(node).recompute_style();
|
||||
}
|
||||
is_display_none = static_cast<Element&>(node).computed_css_values()->display().is_none();
|
||||
}
|
||||
node.set_needs_style_update(false);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue