mirror of
https://github.com/RGBCube/serenity
synced 2025-05-31 11:28:12 +00:00
LibWeb: Coalesce layouts that happen in response to style changes
Instead of doing a forced layout synchronously whenever an element's style is changed, use a zero-timer to do the forced relayout on next event loop iteration. This effectively coalesces a lot of layouts and makes many pages such as GitHub spend way less time doing redundant layout work.
This commit is contained in:
parent
d56f4f635a
commit
1d75e82101
3 changed files with 14 additions and 1 deletions
|
@ -221,7 +221,7 @@ void Element::recompute_style()
|
|||
return;
|
||||
layout_node()->apply_style(*new_specified_css_values);
|
||||
if (diff == StyleDifference::NeedsRelayout) {
|
||||
document().force_layout();
|
||||
document().schedule_forced_layout();
|
||||
return;
|
||||
}
|
||||
if (diff == StyleDifference::NeedsRepaint) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue