mirror of
https://github.com/RGBCube/serenity
synced 2025-07-25 20:07:35 +00:00
LibWeb: Update layout in Element.client{Left,Top}
We have to flush any pending layout changes before getting metrics.
This commit is contained in:
parent
67b3af8025
commit
b7d8fbbd70
1 changed files with 6 additions and 0 deletions
|
@ -603,6 +603,9 @@ JS::NonnullGCPtr<Geometry::DOMRectList> Element::get_client_rects() const
|
|||
|
||||
int Element::client_top() const
|
||||
{
|
||||
// NOTE: Ensure that layout is up-to-date before looking at metrics.
|
||||
const_cast<Document&>(document()).update_layout();
|
||||
|
||||
// 1. If the element has no associated CSS layout box or if the CSS layout box is inline, return zero.
|
||||
if (!layout_node() || !layout_node()->is_box())
|
||||
return 0;
|
||||
|
@ -616,6 +619,9 @@ int Element::client_top() const
|
|||
// https://drafts.csswg.org/cssom-view/#dom-element-clientleft
|
||||
int Element::client_left() const
|
||||
{
|
||||
// NOTE: Ensure that layout is up-to-date before looking at metrics.
|
||||
const_cast<Document&>(document()).update_layout();
|
||||
|
||||
// 1. If the element has no associated CSS layout box or if the CSS layout box is inline, return zero.
|
||||
if (!layout_node() || !layout_node()->is_box())
|
||||
return 0;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue