dymokomi/luce-browser-engine
Source of release 0.6.0
0.6.0 / src / web / css / style_values / repeat_style_style_value.lucb
#==============================================================================================
#
# repeat_style_style_value - RepeatStyleStyleValue: a <repeat-style>
#
# DESCRIPTION:
# Port of LibWeb/CSS/StyleValues/RepeatStyleStyleValue.cpp (lines 1-43) and the inline
# members of RepeatStyleStyleValue.h.
#
# Copyright (c) 2018-2020, Andreas Kling <andreas@ladybird.org>
# Copyright (c) 2021, Tobias Christiansen <tobyase@serenityos.org>
# Copyright (c) 2021-2023, Sam Atkins <atkinssj@serenityos.org>
# Copyright (c) 2022-2023, MacDue <macdue@dueutil.tech>
# SPDX-License-Identifier: BSD-2-Clause
#
#==============================================================================================
## Ported from Libraries/LibWeb/CSS/StyleValues/RepeatStyleStyleValue.h:18 Web::CSS::RepeatStyleStyleValue::create.
pub func css_repeat_style_style_value_create(repeat_x: css_data.Repetition, repeat_y: css_data.Repetition) -> CssRepeatStyleStyleValue*:
let this = &(new CssRepeatStyleStyleValue[1] --- else trap("out of memory"))[0]
css_repeat_style_style_value_construct(this, repeat_x, repeat_y)
return this
## Ported from Libraries/LibWeb/CSS/StyleValues/RepeatStyleStyleValue.cpp:16 Web::CSS::RepeatStyleStyleValue::RepeatStyleStyleValue.
pub func css_repeat_style_style_value_construct(this: CssRepeatStyleStyleValue*, repeat_x: css_data.Repetition, repeat_y: css_data.Repetition):
css_style_value_construct(this.css_style_value(), CssStyleValueType.repeat_style)
css_style_value_set_class(this.css_style_value(), (const CssStyleValueVTable*)&css_repeat_style_style_value_vtable, &css_repeat_style_style_value_class)
this.m_properties = CssRepeatStyleStyleValueProperties(repeat_x = repeat_x, repeat_y = repeat_y)
## Ported from Libraries/LibWeb/CSS/StyleValues/RepeatStyleStyleValue.h:24 Web::CSS::RepeatStyleStyleValue::repeat_x.
pub func css_repeat_style_style_value_repeat_x(this: CssRepeatStyleStyleValue*) -> css_data.Repetition:
return this.m_properties.repeat_x
## Ported from Libraries/LibWeb/CSS/StyleValues/RepeatStyleStyleValue.h:25 Web::CSS::RepeatStyleStyleValue::repeat_y.
pub func css_repeat_style_style_value_repeat_y(this: CssRepeatStyleStyleValue*) -> css_data.Repetition:
return this.m_properties.repeat_y
## Ported from Libraries/LibWeb/CSS/StyleValues/RepeatStyleStyleValue.cpp:24 Web::CSS::RepeatStyleStyleValue::serialize (override).
pub func css_repeat_style_style_value_serialize_impl(base: CssStyleValue*, builder: ak.StringBuilder*, arg1: css_syntax.SerializationMode):
_ = arg1
let this = (CssRepeatStyleStyleValue*)base
if this.m_properties.repeat_x == this.m_properties.repeat_y:
ak.string_builder_append_string_view(builder, css_data.to_string_repetition(this.m_properties.repeat_x))
return
if this.m_properties.repeat_x == css_data.Repetition.repeat and this.m_properties.repeat_y == css_data.Repetition.no_repeat:
ak.string_builder_append(builder, "repeat-x")
return
if this.m_properties.repeat_x == css_data.Repetition.no_repeat and this.m_properties.repeat_y == css_data.Repetition.repeat:
ak.string_builder_append(builder, "repeat-y")
return
css_appendff(builder, "{} {}", [ak.arg_string_view(css_data.to_string_repetition(this.m_properties.repeat_x)), ak.arg_string_view(css_data.to_string_repetition(this.m_properties.repeat_y))])
## Ported from Libraries/LibWeb/CSS/StyleValues/RepeatStyleStyleValue.h:29 Web::CSS::RepeatStyleStyleValue::properties_equal.
pub func css_repeat_style_style_value_properties_equal(this: CssRepeatStyleStyleValue*, other: CssRepeatStyleStyleValue*) -> bool:
return this.m_properties.repeat_x == other.m_properties.repeat_x and this.m_properties.repeat_y == other.m_properties.repeat_y
## Ported from Libraries/LibWeb/CSS/StyleValues/StyleValue.h:202 Web::CSS::StyleValueWithDefaultOperators::equals for Web::CSS::RepeatStyleStyleValue (CRTP helper) (override).
pub func css_repeat_style_style_value_equals_impl(base: CssStyleValue*, other: CssStyleValue*) -> bool:
if css_style_value_type(base) != css_style_value_type(other):
return false
return css_repeat_style_style_value_properties_equal((CssRepeatStyleStyleValue*)base, (CssRepeatStyleStyleValue*)other)
## Ported from Libraries/LibWeb/CSS/StyleValues/RepeatStyleStyleValue.h:31 Web::CSS::RepeatStyleStyleValue::is_computationally_independent (override).
pub func css_repeat_style_style_value_is_computationally_independent_impl(base: CssStyleValue*) -> bool:
_ = base
return true