LibWeb: Make sure layout is up to date in Element::scroll_height()

This commit is contained in:
Aliaksandr Kalenik 2024-02-16 02:28:00 +01:00 committed by Andreas Kling
parent 639e9b5012
commit 89319cd0c9
Notes: sideshowbarker 2024-07-17 02:59:43 +09:00

View file

@ -1407,6 +1407,9 @@ int Element::scroll_height() const
if (!document.is_active())
return 0;
// NOTE: Ensure that layout is up-to-date before looking at metrics.
const_cast<Document&>(document).update_layout();
// 3. Let viewport height be the height of the viewport excluding the height of the scroll bar, if any,
// or zero if there is no viewport.
auto viewport_height = document.viewport_rect().height().to_int();