mirror of
https://github.com/RGBCube/serenity
synced 2025-07-26 19:27:45 +00:00
LibWeb: Make sure layout is up to date in Element::scroll_width()
This commit is contained in:
parent
656f764b1b
commit
639e9b5012
1 changed files with 3 additions and 0 deletions
|
@ -1371,6 +1371,9 @@ int Element::scroll_width() const
|
||||||
if (!document.is_active())
|
if (!document.is_active())
|
||||||
return 0;
|
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,
|
// 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.
|
// or zero if there is no viewport.
|
||||||
auto viewport_width = document.viewport_rect().width().to_int();
|
auto viewport_width = document.viewport_rect().width().to_int();
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue