dymokomi/luce-browser-engine
Source of release 0.6.0
0.6.0 / src / web / layout / field_set_box.lucb
#==============================================================================================
#
# field_set_box - Layout::FieldSetBox: the box of <fieldset>
#
# DESCRIPTION:
# Port of LibWeb/Layout/FieldSetBox.cpp (lines 1-45) and FieldSetBox.h: the constructor,
# the rendered legend and the FieldSetPaintable.
#
# Copyright (c) 2024, Kostya Farber <kostya.farber@gmail.com>
# SPDX-License-Identifier: BSD-2-Clause
#
#==============================================================================================
## Ported from Libraries/LibWeb/Layout/FieldSetBox.cpp:15 Web::Layout::FieldSetBox::FieldSetBox.
pub func layout_field_set_box_construct(this: LayoutFieldSetBox*, document: DomDocument*, element: DomElement*, style: CssComputedProperties*):
layout_block_container_construct_css_computed_properties(this.layout_block_container(), document, element.dom_node(), style)
## Ported from Libraries/LibWeb/Layout/FieldSetBox.h:24 Web::Layout::FieldSetBox::dom_node.
pub func layout_field_set_box_dom_node(this: LayoutFieldSetBox*) -> DomElement*:
let dom_node = layout_node_dom_node(this.layout_node()) else trap("VERIFY: a fieldset box has a DOM node")
return (DomElement*)dom_node
## Ported from Libraries/LibWeb/Layout/FieldSetBox.h:25 Web::Layout::FieldSetBox::dom_node.
pub func layout_field_set_box_dom_node_const(this: LayoutFieldSetBox*) -> DomElement*:
return layout_field_set_box_dom_node(this)
## Ported from Libraries/LibWeb/Layout/FieldSetBox.cpp:22 Web::Layout::FieldSetBox::rendered_legend.
pub func layout_field_set_box_rendered_legend(this: LayoutFieldSetBox*) -> LayoutLegendBox*?:
# https://html.spec.whatwg.org/multipage/rendering.html#rendered-legend
# If the element's box has a child box that matches the conditions in the list below, then the first such child box
# is the 'fieldset' element's rendered legend:
# * The child is a legend element.
# * The child's used value of 'float' is 'none'.
# * The child's used value of 'position' is not 'absolute' or 'fixed'.
for child_node in layout_node_children(this.layout_node()):
let child = as_if_layout_box(child_node) else continue
if not layout_node_is_legend_box(child.layout_node()) or not layout_node_is_in_flow(child.layout_node()):
continue
return (LayoutLegendBox*)child
return none
## Ported from Libraries/LibWeb/Layout/FieldSetBox.cpp:40 Web::Layout::FieldSetBox::create_paintable (override).
pub func layout_field_set_box_create_paintable_impl(base: LayoutNode*) -> PaintPaintable*?:
return paint_field_set_paintable_create((LayoutFieldSetBox*)base).paint_paintable()
## Ported from Libraries/LibWeb/Layout/FieldSetBox.h:31 Web::Layout::FieldSetBox::is_fieldset_box (override).
pub func layout_field_set_box_is_fieldset_box_impl(base: LayoutNode*) -> bool:
_ = base
return true