dymokomi/luce-browser-engine
Source of release 0.6.0
0.6.0 / src / web / geometry / dom_rect.lucb
#==============================================================================================
#
# dom_rect - Geometry::DOMRectReadOnly and Geometry::DOMRect, the parts phase 1 creates
#
# DESCRIPTION:
# Port of LibWeb/Geometry/DOMRectReadOnly.cpp (lines 18-52) and DOMRect.cpp (lines
# 16-54) with their headers' accessors: creation, construction, initialize and the
# x/y/width/height getters and setters. Ported by region r55 because an <svg>'s viewBox
# (SVGAnimatedRect) holds two DOMRects; from_rect (a DOMRectInit dictionary from JS),
# the derived edges (top, right, bottom, left) and structured serialization are
# phase 3. The x/y/width/height getters take a DOMRect, as region r18's callers do.
#
#==============================================================================================
# mark: DOMRectReadOnly ==========================================================================
## Ported from Libraries/LibWeb/Geometry/DOMRectReadOnly.cpp:18 Web::Geometry::DOMRectReadOnly::construct_impl.
pub func geometry_dom_rect_read_only_construct_impl(realm: Realm*, x: f64 = 0.0, y: f64 = 0.0, width: f64 = 0.0, height: f64 = 0.0) -> GeometryDomRectReadOnly*!:
return realm_create_geometry_dom_rect_read_only(realm, realm, x, y, width, height)
## Ported from Libraries/LibWeb/Geometry/DOMRectReadOnly.cpp:30 Web::Geometry::DOMRectReadOnly::create.
pub func geometry_dom_rect_read_only_create(realm: Realm*) -> GeometryDomRectReadOnly*:
return realm_create_geometry_dom_rect_read_only_realm(realm, realm)
## Ported from Libraries/LibWeb/Geometry/DOMRectReadOnly.cpp:35 Web::Geometry::DOMRectReadOnly::DOMRectReadOnly.
pub func geometry_dom_rect_read_only_construct_f64(this: GeometryDomRectReadOnly*, realm: Realm*, x: f64, y: f64, width: f64, height: f64):
bind_platform_object_construct_realm(this.bind_platform_object(), realm)
this.m_rect = GeometryDoubleRect(m_x = x, m_y = y, m_width = width, m_height = height)
## Ported from Libraries/LibWeb/Geometry/DOMRectReadOnly.cpp:41 Web::Geometry::DOMRectReadOnly::DOMRectReadOnly.
pub func geometry_dom_rect_read_only_construct_realm(this: GeometryDomRectReadOnly*, realm: Realm*):
bind_platform_object_construct_realm(this.bind_platform_object(), realm)
## Ported from Libraries/LibWeb/Geometry/DOMRectReadOnly.cpp:48 Web::Geometry::DOMRectReadOnly::initialize (override).
pub func geometry_dom_rect_read_only_initialize_impl(base: JsCell*, realm: Realm*):
web_set_prototype_for_interface(base, realm, BindInterfaceName.dom_rect_read_only)
js_cell_initialize_impl(base, realm)
## Ported from Libraries/LibWeb/Geometry/DOMRectReadOnly.h:39 Web::Geometry::DOMRectReadOnly::x.
pub func geometry_dom_rect_read_only_x(this: GeometryDomRect*) -> f64:
return this.dom_rect_read_only.m_rect.m_x
## Ported from Libraries/LibWeb/Geometry/DOMRectReadOnly.h:40 Web::Geometry::DOMRectReadOnly::y.
pub func geometry_dom_rect_read_only_y(this: GeometryDomRect*) -> f64:
return this.dom_rect_read_only.m_rect.m_y
## Ported from Libraries/LibWeb/Geometry/DOMRectReadOnly.h:41 Web::Geometry::DOMRectReadOnly::width.
pub func geometry_dom_rect_read_only_width(this: GeometryDomRect*) -> f64:
return this.dom_rect_read_only.m_rect.m_width
## Ported from Libraries/LibWeb/Geometry/DOMRectReadOnly.h:42 Web::Geometry::DOMRectReadOnly::height.
pub func geometry_dom_rect_read_only_height(this: GeometryDomRect*) -> f64:
return this.dom_rect_read_only.m_rect.m_height
# mark: DOMRect ==================================================================================
## Ported from Libraries/LibWeb/Geometry/DOMRect.cpp:16 Web::Geometry::DOMRect::construct_impl.
pub func geometry_dom_rect_construct_impl(realm: Realm*, x: f64, y: f64, width: f64, height: f64) -> GeometryDomRect*!:
return geometry_dom_rect_create(realm, gfx.FloatRect(m_location = gfx.FloatPoint(m_x = (f32)x, m_y = (f32)y), m_size = gfx.FloatSize(m_width = (f32)width, m_height = (f32)height)))
## Ported from Libraries/LibWeb/Geometry/DOMRect.cpp:21 Web::Geometry::DOMRect::create.
pub func geometry_dom_rect_create(realm: Realm*, rect: gfx.FloatRect) -> GeometryDomRect*:
return realm_create_geometry_dom_rect(realm, realm, f64(rect.m_location.m_x), f64(rect.m_location.m_y), f64(rect.m_size.m_width), f64(rect.m_size.m_height))
## Ported from Libraries/LibWeb/Geometry/DOMRect.cpp:26 Web::Geometry::DOMRect::create.
pub func geometry_dom_rect_create_realm(realm: Realm*) -> GeometryDomRect*:
return realm_create_geometry_dom_rect_realm(realm, realm)
## Ported from Libraries/LibWeb/Geometry/DOMRect.cpp:38 Web::Geometry::DOMRect::DOMRect.
pub func geometry_dom_rect_construct_f64(this: GeometryDomRect*, realm: Realm*, x: f64, y: f64, width: f64, height: f64):
geometry_dom_rect_read_only_construct_f64(this.geometry_dom_rect_read_only(), realm, x, y, width, height)
## Ported from Libraries/LibWeb/Geometry/DOMRect.cpp:43 Web::Geometry::DOMRect::DOMRect.
pub func geometry_dom_rect_construct_realm(this: GeometryDomRect*, realm: Realm*):
geometry_dom_rect_read_only_construct_realm(this.geometry_dom_rect_read_only(), realm)
## Ported from Libraries/LibWeb/Geometry/DOMRect.cpp:50 Web::Geometry::DOMRect::initialize (override).
pub func geometry_dom_rect_initialize_impl(base: JsCell*, realm: Realm*):
web_set_prototype_for_interface(base, realm, BindInterfaceName.dom_rect)
geometry_dom_rect_read_only_initialize_impl(base, realm)
## Ported from Libraries/LibWeb/Geometry/DOMRect.h:31 Web::Geometry::DOMRect::set_x.
pub func geometry_dom_rect_set_x(this: GeometryDomRect*, x: f64):
this.dom_rect_read_only.m_rect.m_x = x
## Ported from Libraries/LibWeb/Geometry/DOMRect.h:32 Web::Geometry::DOMRect::set_y.
pub func geometry_dom_rect_set_y(this: GeometryDomRect*, y: f64):
this.dom_rect_read_only.m_rect.m_y = y
## Ported from Libraries/LibWeb/Geometry/DOMRect.h:33 Web::Geometry::DOMRect::set_width.
pub func geometry_dom_rect_set_width(this: GeometryDomRect*, width: f64):
this.dom_rect_read_only.m_rect.m_width = width
## Ported from Libraries/LibWeb/Geometry/DOMRect.h:34 Web::Geometry::DOMRect::set_height.
pub func geometry_dom_rect_set_height(this: GeometryDomRect*, height: f64):
this.dom_rect_read_only.m_rect.m_height = height