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

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

This commit is contained in:
Aliaksandr Kalenik 2024-02-16 02:27:03 +01:00 committed by Andreas Kling
parent 656f764b1b
commit 639e9b5012

View file

@ -1371,6 +1371,9 @@ int Element::scroll_width() 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 width be the width of the viewport excluding the width of the scroll bar, if any,
// or zero if there is no viewport.
auto viewport_width = document.viewport_rect().width().to_int();