mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2024-08-16 17:00:35 +03: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
Notes:
sideshowbarker
2024-07-17 07:19:16 +09:00
Author: https://github.com/awesomekling Commit: https://github.com/SerenityOS/serenity/commit/b7d8fbbd70
@ -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…
Reference in New Issue
Block a user