LibWeb: Pass ResizeObserver instance as a second argument to callback

This commit is contained in:
Aliaksandr Kalenik 2025-09-07 17:02:33 +02:00 committed by Alexander Kalenik
commit ad15edf2ff
Notes: github-actions[bot] 2025-09-08 16:41:18 +00:00
2 changed files with 5 additions and 2 deletions

View file

@ -116,7 +116,7 @@ void ResizeObserver::invoke_callback(ReadonlySpan<GC::Ref<ResizeObserverEntry>>
MUST(wrapped_records->create_data_property(property_index, record.ptr())); MUST(wrapped_records->create_data_property(property_index, record.ptr()));
} }
(void)WebIDL::invoke_callback(callback, this, WebIDL::ExceptionBehavior::Report, { { wrapped_records } }); (void)WebIDL::invoke_callback(callback, this, WebIDL::ExceptionBehavior::Report, { { wrapped_records, this } });
} }
void ResizeObserver::unregister_observer_if_needed() void ResizeObserver::unregister_observer_if_needed()

View file

@ -23,10 +23,13 @@
}); });
} }
const resizeObserver = new ResizeObserver(function (entries) { const resizeObserver = new ResizeObserver(function (entries, ro) {
if (this !== resizeObserver) { if (this !== resizeObserver) {
println("this is not the ResizeObserver instance inside callback"); println("this is not the ResizeObserver instance inside callback");
} }
if (ro !== resizeObserver) {
println("observer argument is not the ResizeObserver instance inside callback");
}
for (let entry of entries) { for (let entry of entries) {
const { width, height } = entry.contentRect; const { width, height } = entry.contentRect;