1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-31 10:38:11 +00:00

LibWeb: Move box_type_agnostic_position() from layout node to paintable

For this method, there is no need to go through the layout node when we
can directly reach the paintable.
This commit is contained in:
Aliaksandr Kalenik 2024-01-14 11:14:20 +01:00 committed by Andreas Kling
parent 31e5b5f5de
commit 814bed33b4
8 changed files with 39 additions and 36 deletions

View file

@ -33,6 +33,7 @@
#include <LibWeb/Layout/Viewport.h>
#include <LibWeb/Namespace.h>
#include <LibWeb/Page/Page.h>
#include <LibWeb/Painting/Paintable.h>
#include <LibWeb/URL/URL.h>
namespace Web::HTML {
@ -391,9 +392,9 @@ CSSPixelPoint BrowsingContext::to_top_level_position(CSSPixelPoint a_position)
break;
if (!ancestor->container())
return {};
if (!ancestor->container()->layout_node())
if (!ancestor->container()->paintable())
return {};
position.translate_by(ancestor->container()->layout_node()->box_type_agnostic_position());
position.translate_by(ancestor->container()->paintable()->box_type_agnostic_position());
}
return position;
}