Luce packages
LuceLuce BaseLuciaOS

dymokomi/luce-browser-engine

Source of release 0.6.0

0.6.0 / src / web / css / style_values / guaranteed_invalid_style_value.lucb

#==============================================================================================
#
#   guaranteed_invalid_style_value - GuaranteedInvalidStyleValue: the guaranteed-invalid value
#
#   DESCRIPTION:
#       Port of the inline members of LibWeb/CSS/StyleValues/GuaranteedInvalidStyleValue.h
#       (lines 1-39).
#       Its static instance is a module variable made in the C heap on first use.
#
#       Copyright (c) 2025, Sam Atkins <sam@ladybird.org>
#       SPDX-License-Identifier: BSD-2-Clause
#
#==============================================================================================

# https://drafts.csswg.org/css-variables/#guaranteed-invalid-value

# The static `instance` of GuaranteedInvalidStyleValue::create, made on first use.
var css_guaranteed_invalid_style_value_instance: CssGuaranteedInvalidStyleValue*?

## Ported from Libraries/LibWeb/CSS/StyleValues/GuaranteedInvalidStyleValue.h:16 Web::CSS::GuaranteedInvalidStyleValue::create.
pub func css_guaranteed_invalid_style_value_create() -> CssGuaranteedInvalidStyleValue*:
    if let instance = css_guaranteed_invalid_style_value_instance:
        return instance
    let saved_atomic_allocator = ak.atomic_allocator
    ak.atomic_allocator = none
    defer ak.atomic_allocator = saved_atomic_allocator
    with memory.heap:
        let instance = &(new CssGuaranteedInvalidStyleValue[1] --- else trap("out of memory"))[0]
        css_guaranteed_invalid_style_value_construct(instance)
        css_guaranteed_invalid_style_value_instance = instance
        return instance

## Ported from Libraries/LibWeb/CSS/StyleValues/GuaranteedInvalidStyleValue.h:33 Web::CSS::GuaranteedInvalidStyleValue::GuaranteedInvalidStyleValue.
pub func css_guaranteed_invalid_style_value_construct(this: CssGuaranteedInvalidStyleValue*):
    css_style_value_construct(this.css_style_value(), CssStyleValueType.guaranteed_invalid)
    css_style_value_set_class(this.css_style_value(), (const CssStyleValueVTable*)&css_guaranteed_invalid_style_value_vtable, &css_guaranteed_invalid_style_value_class)

## Ported from Libraries/LibWeb/CSS/StyleValues/GuaranteedInvalidStyleValue.h:22 Web::CSS::GuaranteedInvalidStyleValue::serialize (override).
pub func css_guaranteed_invalid_style_value_serialize_impl(base: CssStyleValue*, arg0: ak.StringBuilder*, arg1: css_syntax.SerializationMode):
    _ = base
    _ = arg0
    _ = arg1

## Ported from Libraries/LibWeb/CSS/StyleValues/GuaranteedInvalidStyleValue.h:23 Web::CSS::GuaranteedInvalidStyleValue::tokenize (override).
pub func css_guaranteed_invalid_style_value_tokenize_impl(base: CssStyleValue*) -> ak.Vector[css_syntax.ComponentValue]:
    _ = base
    var values = ak.Vector[css_syntax.ComponentValue]()
    ak.vector_append_t(&values, css_syntax.component_value_from_guaranteed_invalid_value(css_syntax.GuaranteedInvalidValue()))
    return values

## Ported from Libraries/LibWeb/CSS/StyleValues/GuaranteedInvalidStyleValue.h:28 Web::CSS::GuaranteedInvalidStyleValue::properties_equal.
pub func css_guaranteed_invalid_style_value_properties_equal(this: CssGuaranteedInvalidStyleValue*, arg0: CssGuaranteedInvalidStyleValue*) -> bool:
    _ = this
    _ = arg0
    return true

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

## Ported from Libraries/LibWeb/CSS/StyleValues/GuaranteedInvalidStyleValue.h:30 Web::CSS::GuaranteedInvalidStyleValue::is_computationally_independent (override).
pub func css_guaranteed_invalid_style_value_is_computationally_independent_impl(base: CssStyleValue*) -> bool:
    _ = base
    trap("VERIFY_NOT_REACHED")