diff options
author | Andreas Kling <kling@serenityos.org> | 2022-03-16 21:25:24 +0100 |
---|---|---|
committer | Andreas Kling <kling@serenityos.org> | 2022-03-16 21:30:39 +0100 |
commit | d71b0e46381c2bb211233bb72d9f7f457a72c5d4 (patch) | |
tree | 436efa51e39098140833cba6045b7c520d4096b0 | |
parent | bec0c96aea47df6cbe13a35fcb70292b3329e7c4 (diff) | |
download | serenity-d71b0e46381c2bb211233bb72d9f7f457a72c5d4.zip |
LibWeb: Don't discard update_style_recursively() return value
This was causing us to miss layout invalidations. With this fixed, we
can remove the invalidation from Element::recompute_style() along with
the associated FIXME.
Thanks to Idan for spotting this! :^)
-rw-r--r-- | Userland/Libraries/LibWeb/DOM/Document.cpp | 4 | ||||
-rw-r--r-- | Userland/Libraries/LibWeb/DOM/Element.cpp | 3 |
2 files changed, 2 insertions, 5 deletions
diff --git a/Userland/Libraries/LibWeb/DOM/Document.cpp b/Userland/Libraries/LibWeb/DOM/Document.cpp index 9bf17e9bbf..53478cf250 100644 --- a/Userland/Libraries/LibWeb/DOM/Document.cpp +++ b/Userland/Libraries/LibWeb/DOM/Document.cpp @@ -595,7 +595,7 @@ void Document::update_layout() m_layout_update_timer->stop(); } -static bool update_style_recursively(DOM::Node& node) +[[nodiscard]] static bool update_style_recursively(DOM::Node& node) { bool needs_relayout = false; @@ -613,7 +613,7 @@ static bool update_style_recursively(DOM::Node& node) } node.for_each_child([&](auto& child) { if (child.needs_style_update() || child.child_needs_style_update()) - update_style_recursively(child); + needs_relayout |= update_style_recursively(child); return IterationDecision::Continue; }); } diff --git a/Userland/Libraries/LibWeb/DOM/Element.cpp b/Userland/Libraries/LibWeb/DOM/Element.cpp index df9d378059..de3ac9d8bd 100644 --- a/Userland/Libraries/LibWeb/DOM/Element.cpp +++ b/Userland/Libraries/LibWeb/DOM/Element.cpp @@ -317,9 +317,6 @@ Element::NeedsRelayout Element::recompute_style() return NeedsRelayout::No; } - // FIXME: Get rid of this layout invalidation and let Document take care of it. - // There seems to be some missing invalidation somewhere else that this is papering over. - document().invalidate_layout(); return NeedsRelayout::Yes; } |