mirror of
https://github.com/RGBCube/serenity
synced 2025-07-25 16:07:47 +00:00
LibWeb: Update layout in Element.getClientRects()
We always have to flush any pending layout updates before inspecting the layout tree.
This commit is contained in:
parent
a0d44026fc
commit
7dcbb403bb
1 changed files with 3 additions and 0 deletions
|
@ -600,6 +600,9 @@ JS::NonnullGCPtr<Geometry::DOMRectList> Element::get_client_rects() const
|
||||||
{
|
{
|
||||||
Vector<JS::Handle<Geometry::DOMRect>> rects;
|
Vector<JS::Handle<Geometry::DOMRect>> rects;
|
||||||
|
|
||||||
|
// NOTE: Ensure that layout is up-to-date before looking at metrics.
|
||||||
|
const_cast<Document&>(document()).update_layout();
|
||||||
|
|
||||||
// 1. If the element on which it was invoked does not have an associated layout box return an empty DOMRectList object and stop this algorithm.
|
// 1. If the element on which it was invoked does not have an associated layout box return an empty DOMRectList object and stop this algorithm.
|
||||||
if (!layout_node() || !layout_node()->is_box())
|
if (!layout_node() || !layout_node()->is_box())
|
||||||
return Geometry::DOMRectList::create(realm(), move(rects));
|
return Geometry::DOMRectList::create(realm(), move(rects));
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue