mirror of
https://github.com/fergalmoran/ladybird.git
synced 2025-12-30 13:19:47 +00:00
LibWeb: Ignore window-forwarded document.body.onfoo in detached DOM
Normally, assigning to e.g document.body.onload will forward to window.onload. However, in a detached DOM tree, there is no associated window, so we have nowhere to forward to, making this a no-op. The bulk of this change is making Document::window() return a nullable pointer, as documents created by DOMParser or DOMImplementation do not have an associated window object, and so must be able to return null from here.
This commit is contained in:
@@ -44,7 +44,7 @@ JS::NonnullGCPtr<ResizeObserverSize> ResizeObserverSize::calculate_box_size(JS::
|
||||
computed_size->set_block_size(paintable_box.content_height().to_double());
|
||||
break;
|
||||
case Bindings::ResizeObserverBoxOptions::DevicePixelContentBox: {
|
||||
auto device_pixel_ratio = target.document().window().device_pixel_ratio();
|
||||
auto device_pixel_ratio = target.document().window()->device_pixel_ratio();
|
||||
// 1. Set computedSize’s inlineSize attribute to target’s content area inline length, in integral device pixels.
|
||||
computed_size->set_inline_size(paintable_box.border_box_width().to_double() * device_pixel_ratio);
|
||||
// 2. Set computedSize’s blockSize attribute to target’s content area block length, in integral device pixels.
|
||||
|
||||
Reference in New Issue
Block a user