From 0577c16dbdd3eb5eb4955bba976bdfe8aae50b38 Mon Sep 17 00:00:00 2001 From: ldm0 Date: Sun, 30 Aug 2026 07:42:08 +0800 Subject: [PATCH] fix(geometry): construct DOMRectReadOnly instances --- .../assets/constructor_templates.rs | 5 +++++ moli-webapi/src/dom_rect.rs | 16 ++++++++++++++++ 2 files changed, 21 insertions(+) diff --git a/moli-renderer-v8/src/context_bootstrap/assets/constructor_templates.rs b/moli-renderer-v8/src/context_bootstrap/assets/constructor_templates.rs index 03b90cd9901..57aabeab593 100644 --- a/moli-renderer-v8/src/context_bootstrap/assets/constructor_templates.rs +++ b/moli-renderer-v8/src/context_bootstrap/assets/constructor_templates.rs @@ -531,6 +531,11 @@ pub(in crate::context_bootstrap) fn build_constructor_template_for_profile<'s>( ConstructorKind::DomRectReadOnly => { super::super::dom_rect::build_dom_rect_readonly_constructor_template(scope) } + ConstructorKind::DomRectReadOnly => v8::FunctionTemplate::builder( + super::super::dom_rect::dom_rect_readonly_constructor_callback, + ) + .length(0) + .build(scope), ConstructorKind::DomRect => { super::super::dom_rect::build_dom_rect_constructor_template(scope) } diff --git a/moli-webapi/src/dom_rect.rs b/moli-webapi/src/dom_rect.rs index 68cf50c0336..627c15d9aa2 100644 --- a/moli-webapi/src/dom_rect.rs +++ b/moli-webapi/src/dom_rect.rs @@ -22,6 +22,22 @@ struct DomRectObjectDeclaration {} #[webapi(interface = web_api_interfaces::DOMRectReadOnly)] struct DomRectReadOnlyObjectDeclaration {} +#[derive(WebApiObject)] +#[webapi(interface = "DOMRectReadOnly")] +struct DomRectReadOnlyObjectDeclaration { + #[webapi(slot = DOM_RECT_BRAND_SLOT, init = true)] + brand: (), + + #[webapi(slot = DOM_RECT_X_SLOT)] + x: f64, + #[webapi(slot = DOM_RECT_Y_SLOT)] + y: f64, + #[webapi(slot = DOM_RECT_WIDTH_SLOT)] + width: f64, + #[webapi(slot = DOM_RECT_HEIGHT_SLOT)] + height: f64, +} + #[derive(WebApiFunctionTemplate)] #[webapi(interface = web_api_interfaces::DOMRectReadOnly)] struct DomRectReadOnlyPrototypeDeclaration {