mirror of
https://github.com/RGBCube/serenity
synced 2025-07-27 08:47:44 +00:00
LibWeb: Update style (if needed) before updating layout
Layout depends on style (and not the other way around), so if the document has dirty style when we enter update_layout(), make sure we call update_style() before proceeding with the layout work. This has the pleasant effect of coalescing some redundant layouts.
This commit is contained in:
parent
23f4ff7247
commit
13361bc47d
1 changed files with 4 additions and 0 deletions
|
@ -430,6 +430,8 @@ void Document::update_layout()
|
||||||
if (!browsing_context())
|
if (!browsing_context())
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
update_style();
|
||||||
|
|
||||||
if (!m_layout_root) {
|
if (!m_layout_root) {
|
||||||
Layout::TreeBuilder tree_builder;
|
Layout::TreeBuilder tree_builder;
|
||||||
m_layout_root = static_ptr_cast<Layout::InitialContainingBlock>(tree_builder.build(*this));
|
m_layout_root = static_ptr_cast<Layout::InitialContainingBlock>(tree_builder.build(*this));
|
||||||
|
@ -468,6 +470,8 @@ void Document::update_style()
|
||||||
{
|
{
|
||||||
if (!browsing_context())
|
if (!browsing_context())
|
||||||
return;
|
return;
|
||||||
|
if (!needs_style_update() && !child_needs_style_update())
|
||||||
|
return;
|
||||||
update_style_recursively(*this);
|
update_style_recursively(*this);
|
||||||
set_needs_layout();
|
set_needs_layout();
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue