Luce packages
LuceLuce BaseLuciaOS

dymokomi/luce-browser-engine

Source of release 0.6.1

0.6.1 / src / web / css / style_values / grid_auto_flow_style_value.lucb

#==============================================================================================
#
#   grid_auto_flow_style_value - GridAutoFlowStyleValue: grid-auto-flow
#
#   DESCRIPTION:
#       Port of LibWeb/CSS/StyleValues/GridAutoFlowStyleValue.cpp (lines 1-29) and the inline
#       members of GridAutoFlowStyleValue.h.
#
#       Copyright (c) 2023, Andreas Kling <andreas@ladybird.org>
#       SPDX-License-Identifier: BSD-2-Clause
#
#==============================================================================================

## Ported from Libraries/LibWeb/CSS/StyleValues/GridAutoFlowStyleValue.cpp:11 Web::CSS::GridAutoFlowStyleValue::create.
pub func css_grid_auto_flow_style_value_create(axis: CssGridAutoFlowStyleValueAxis, dense: CssGridAutoFlowStyleValueDense) -> CssGridAutoFlowStyleValue*:
    let this = &(new CssGridAutoFlowStyleValue[1] --- else trap("out of memory"))[0]
    css_grid_auto_flow_style_value_construct(this, axis, dense)
    return this

## Ported from Libraries/LibWeb/CSS/StyleValues/GridAutoFlowStyleValue.h:36 Web::CSS::GridAutoFlowStyleValue::GridAutoFlowStyleValue.
pub func css_grid_auto_flow_style_value_construct(this: CssGridAutoFlowStyleValue*, axis: CssGridAutoFlowStyleValueAxis, dense: CssGridAutoFlowStyleValueDense):
    css_style_value_construct(this.css_style_value(), CssStyleValueType.grid_auto_flow)
    css_style_value_set_class(this.css_style_value(), (const CssStyleValueVTable*)&css_grid_auto_flow_style_value_vtable, &css_grid_auto_flow_style_value_class)
    this.m_row = axis == CssGridAutoFlowStyleValueAxis.row
    this.m_dense = dense == CssGridAutoFlowStyleValueDense.yes

## Ported from Libraries/LibWeb/CSS/StyleValues/GridAutoFlowStyleValue.h:26 Web::CSS::GridAutoFlowStyleValue::is_row.
pub func css_grid_auto_flow_style_value_is_row(this: CssGridAutoFlowStyleValue*) -> bool:
    return this.m_row

## Ported from Libraries/LibWeb/CSS/StyleValues/GridAutoFlowStyleValue.h:27 Web::CSS::GridAutoFlowStyleValue::is_column.
pub func css_grid_auto_flow_style_value_is_column(this: CssGridAutoFlowStyleValue*) -> bool:
    return not this.m_row

## Ported from Libraries/LibWeb/CSS/StyleValues/GridAutoFlowStyleValue.h:28 Web::CSS::GridAutoFlowStyleValue::is_dense.
pub func css_grid_auto_flow_style_value_is_dense(this: CssGridAutoFlowStyleValue*) -> bool:
    return this.m_dense

## Ported from Libraries/LibWeb/CSS/StyleValues/GridAutoFlowStyleValue.cpp:16 Web::CSS::GridAutoFlowStyleValue::serialize (override).
pub func css_grid_auto_flow_style_value_serialize_impl(base: CssStyleValue*, builder: ak.StringBuilder*, arg1: css_syntax.SerializationMode):
    _ = arg1
    let this = (CssGridAutoFlowStyleValue*)base
    if this.m_row and not this.m_dense:
        ak.string_builder_append(builder, "row")
    elif not this.m_row:
        ak.string_builder_append(builder, "column")
    if this.m_dense:
        if not this.m_row:
            ak.string_builder_append_u8(builder, ' ')
        ak.string_builder_append(builder, "dense")

## Ported from Libraries/LibWeb/CSS/StyleValues/GridAutoFlowStyleValue.h:31 Web::CSS::GridAutoFlowStyleValue::properties_equal.
pub func css_grid_auto_flow_style_value_properties_equal(this: CssGridAutoFlowStyleValue*, other: CssGridAutoFlowStyleValue*) -> bool:
    return this.m_row == other.m_row and this.m_dense == other.m_dense

## Ported from Libraries/LibWeb/CSS/StyleValues/GridAutoFlowStyleValue.h:33 Web::CSS::GridAutoFlowStyleValue::is_computationally_independent (override).
pub func css_grid_auto_flow_style_value_is_computationally_independent_impl(base: CssStyleValue*) -> bool:
    _ = base
    return true

## Ported from Libraries/LibWeb/CSS/StyleValues/StyleValue.h:202 Web::CSS::StyleValueWithDefaultOperators::equals for Web::CSS::GridAutoFlowStyleValue (CRTP helper) (override).
pub func css_grid_auto_flow_style_value_equals_impl(base: CssStyleValue*, other: CssStyleValue*) -> bool:
    if css_style_value_type(base) != css_style_value_type(other):
        return false
    return css_grid_auto_flow_style_value_properties_equal((CssGridAutoFlowStyleValue*)base, (CssGridAutoFlowStyleValue*)other)