mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-09-22 01:08:56 +00:00
LibWeb: Use ResizeObserver instance as this
in callback function
This commit is contained in:
parent
5c14db868d
commit
1cc9fb6135
Notes:
github-actions[bot]
2025-09-08 16:41:23 +00:00
Author: https://github.com/kalenikaliaksandr
Commit: 1cc9fb6135
Pull-request: https://github.com/LadybirdBrowser/ladybird/pull/6117
Reviewed-by: https://github.com/tcl3
2 changed files with 6 additions and 2 deletions
|
@ -116,7 +116,7 @@ void ResizeObserver::invoke_callback(ReadonlySpan<GC::Ref<ResizeObserverEntry>>
|
|||
MUST(wrapped_records->create_data_property(property_index, record.ptr()));
|
||||
}
|
||||
|
||||
(void)WebIDL::invoke_callback(callback, JS::js_undefined(), WebIDL::ExceptionBehavior::Report, { { wrapped_records } });
|
||||
(void)WebIDL::invoke_callback(callback, this, WebIDL::ExceptionBehavior::Report, { { wrapped_records } });
|
||||
}
|
||||
|
||||
void ResizeObserver::unregister_observer_if_needed()
|
||||
|
|
|
@ -23,7 +23,11 @@
|
|||
});
|
||||
}
|
||||
|
||||
const resizeObserver = new ResizeObserver(entries => {
|
||||
const resizeObserver = new ResizeObserver(function (entries) {
|
||||
if (this !== resizeObserver) {
|
||||
println("this is not the ResizeObserver instance inside callback");
|
||||
}
|
||||
|
||||
for (let entry of entries) {
|
||||
const { width, height } = entry.contentRect;
|
||||
println(`Size changed: ${width}px x ${height}px`);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue