1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-25 18:07:34 +00:00

LibWeb: Always call update_style() in update_layout()

If the style is dirty, update_style() may cause layout to become dirty.
Therefore we must always update style when updating layout, to ensure
up-to-date results.
This commit is contained in:
Andreas Kling 2022-03-09 17:56:34 +01:00
parent c988cbb8b1
commit bca3c2a443

View file

@ -554,6 +554,8 @@ void Document::ensure_layout()
void Document::update_layout()
{
update_style();
if (!m_needs_layout && m_layout_root)
return;
@ -562,8 +564,6 @@ void Document::update_layout()
auto viewport_rect = browsing_context()->viewport_rect();
update_style();
if (!m_layout_root) {
Layout::TreeBuilder tree_builder;
m_layout_root = static_ptr_cast<Layout::InitialContainingBlock>(tree_builder.build(*this));