dymokomi/luce-browser-engine
Source of release 0.6.0
0.6.0 / src / web / css / style_values / custom_ident_style_value.lucb
#==============================================================================================
#
# custom_ident_style_value - CustomIdentStyleValue: a <custom-ident>
#
# DESCRIPTION:
# Port of LibWeb/CSS/StyleValues/CustomIdentStyleValue.cpp (lines 1-25) and the inline
# members of CustomIdentStyleValue.h.
#
# Copyright (c) 2025, Sam Atkins <sam@ladybird.org>
# Copyright (c) 2023-2025, Sam Atkins <sam@ladybird.org>
# SPDX-License-Identifier: BSD-2-Clause
#
#==============================================================================================
# https://www.w3.org/TR/css-values-4/#custom-idents
## Ported from Libraries/LibWeb/CSS/StyleValues/CustomIdentStyleValue.h:18 Web::CSS::CustomIdentStyleValue::create.
pub func css_custom_ident_style_value_create(custom_ident: ak.FlyString) -> CssCustomIdentStyleValue*:
let this = &(new CssCustomIdentStyleValue[1] --- else trap("out of memory"))[0]
css_custom_ident_style_value_construct(this, custom_ident)
return this
## Ported from Libraries/LibWeb/CSS/StyleValues/CustomIdentStyleValue.h:35 Web::CSS::CustomIdentStyleValue::CustomIdentStyleValue.
pub func css_custom_ident_style_value_construct(this: CssCustomIdentStyleValue*, custom_ident: ak.FlyString):
css_style_value_construct(this.css_style_value(), CssStyleValueType.custom_ident)
css_style_value_set_class(this.css_style_value(), (const CssStyleValueVTable*)&css_custom_ident_style_value_vtable, &css_custom_ident_style_value_class)
this.m_custom_ident = custom_ident
## Ported from Libraries/LibWeb/CSS/StyleValues/CustomIdentStyleValue.h:24 Web::CSS::CustomIdentStyleValue::custom_ident.
pub func css_custom_ident_style_value_custom_ident(this: CssCustomIdentStyleValue*) -> ak.FlyString:
return this.m_custom_ident
## Ported from Libraries/LibWeb/CSS/StyleValues/CustomIdentStyleValue.h:26 Web::CSS::CustomIdentStyleValue::serialize (override).
pub func css_custom_ident_style_value_serialize_impl(base: CssStyleValue*, builder: ak.StringBuilder*, arg1: css_syntax.SerializationMode):
_ = arg1
let this = (CssCustomIdentStyleValue*)base
let custom_ident = ak.fly_string_to_string_const(&this.m_custom_ident)
let serialized = css_syntax.serialize_an_identifier_string_view(ak.string_bytes_as_string_view(&custom_ident))
ak.string_builder_append_string_view(builder, ak.string_bytes_as_string_view(&serialized))
## Ported from Libraries/LibWeb/CSS/StyleValues/CustomIdentStyleValue.cpp:13 Web::CSS::CustomIdentStyleValue::tokenize (override).
pub func css_custom_ident_style_value_tokenize_impl(base: CssStyleValue*) -> ak.Vector[css_syntax.ComponentValue]:
let this = (CssCustomIdentStyleValue*)base
var values = ak.Vector[css_syntax.ComponentValue]()
ak.vector_append_t(&values, css_syntax.component_value_from_token(css_syntax.token_create_ident(this.m_custom_ident, ak.String())))
return values
# https://drafts.css-houdini.org/css-typed-om-1/#reify-ident
## Ported from Libraries/LibWeb/CSS/StyleValues/CustomIdentStyleValue.cpp:19 Web::CSS::CustomIdentStyleValue::reify (override).
pub func css_custom_ident_style_value_reify_impl(base: CssStyleValue*, realm: Realm*, arg1: ak.FlyString) -> CssCssStyleValue*:
_ = arg1
let this = (CssCustomIdentStyleValue*)base
# 1. Return a new CSSKeywordValue with its value internal slot set to the serialization of ident.
return (CssCssStyleValue*)css_keyword_value_create(realm, this.m_custom_ident)
## Ported from Libraries/LibWeb/CSS/StyleValues/CustomIdentStyleValue.h:30 Web::CSS::CustomIdentStyleValue::properties_equal.
pub func css_custom_ident_style_value_properties_equal(this: CssCustomIdentStyleValue*, other: CssCustomIdentStyleValue*) -> bool:
return ak.fly_string_eq_fly_string(&this.m_custom_ident, &other.m_custom_ident)
## Ported from Libraries/LibWeb/CSS/StyleValues/StyleValue.h:202 Web::CSS::StyleValueWithDefaultOperators::equals for Web::CSS::CustomIdentStyleValue (CRTP helper) (override).
pub func css_custom_ident_style_value_equals_impl(base: CssStyleValue*, other: CssStyleValue*) -> bool:
if css_style_value_type(base) != css_style_value_type(other):
return false
return css_custom_ident_style_value_properties_equal((CssCustomIdentStyleValue*)base, (CssCustomIdentStyleValue*)other)
## Ported from Libraries/LibWeb/CSS/StyleValues/CustomIdentStyleValue.h:32 Web::CSS::CustomIdentStyleValue::is_computationally_independent (override).
pub func css_custom_ident_style_value_is_computationally_independent_impl(base: CssStyleValue*) -> bool:
_ = base
return true