From beb1c85b6b3490a9f855d4161ac765618d5ef1f2 Mon Sep 17 00:00:00 2001 From: Aliaksandr Kalenik Date: Mon, 29 Jan 2024 06:07:32 +0100 Subject: [PATCH] LibWeb: Force scroll offsets update in Internals::hit_test() Since we might enter Internals::hit_test() before the enclosing scroll offsets are updated in the paintables tree during pre-paint, this update need to be enforced. --- Userland/Libraries/LibWeb/Internals/Internals.cpp | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/Userland/Libraries/LibWeb/Internals/Internals.cpp b/Userland/Libraries/LibWeb/Internals/Internals.cpp index 03d269fd11..c3bde66a92 100644 --- a/Userland/Libraries/LibWeb/Internals/Internals.cpp +++ b/Userland/Libraries/LibWeb/Internals/Internals.cpp @@ -16,6 +16,7 @@ #include #include #include +#include namespace Web::Internals { @@ -51,6 +52,9 @@ JS::Object* Internals::hit_test(double x, double y) // for stacking context traversal, might not exist if this call occurs between the tear_down_layout_tree() // and update_layout() calls active_document->update_layout(); + HashMap scroll_frames; + // NOTE: Make sure that paintables have updated scroll offsets + active_document->paintable()->assign_scroll_frame_ids(scroll_frames); auto result = active_document->paintable_box()->hit_test({ x, y }, Painting::HitTestType::Exact); if (result.has_value()) { auto hit_tŠµsting_result = JS::Object::create(realm(), nullptr);