dymokomi/luce-browser-engine
Source of release 0.6.1
0.6.1 / src / web / css / style_values / calculated_style_value_8.lucb
#==============================================================================================
#
# calculated_style_value_8 - CalculatedStyleValue: calculation results and the
# CalculatedStyleValue itself
#
# DESCRIPTION:
# Port of LibWeb/CSS/StyleValues/CalculatedStyleValue.cpp (lines 2905-3212) and the inline
# members of CalculatedStyleValue.h they belong with: CalculatedStyleValue::CalculationResult,
# and CalculatedStyleValue's construction, serialization, absolutization, equality,
# resolution (resolve_value and the resolve_* of every numeric type), dump and reify.
# CalculatedStyleValue::percentage_resolved_type is declared in the donor's header and
# defined nowhere, so it has no port.
#
# Copyright (c) 2018-2020, Andreas Kling <andreas@ladybird.org>
# Copyright (c) 2021, Tobias Christiansen <tobyase@serenityos.org>
# Copyright (c) 2021-2025, Sam Atkins <sam@ladybird.org>
# Copyright (c) 2022-2023, MacDue <macdue@dueutil.tech>
# SPDX-License-Identifier: BSD-2-Clause
#
#==============================================================================================
# mark: CalculatedStyleValue::CalculationResult =================================================
## Ported from Libraries/LibWeb/CSS/StyleValues/CalculatedStyleValue.h:46 Web::CSS::CalculatedStyleValue::CalculationResult::CalculationResult.
pub func css_calculated_style_value_calculation_result_construct(this: CssCalculatedStyleValueCalculationResult*, value: f64, type_: CssNumericType?):
this.m_value = value
this.m_type = type_
## Ported from Libraries/LibWeb/CSS/StyleValues/CalculatedStyleValue.cpp:2906 Web::CSS::CalculatedStyleValue::CalculationResult::from_value.
pub func css_calculated_style_value_calculation_result_from_value(value: CssCalculationNodeNumericValue, context: CssCalculationResolutionContext, numeric_type: CssNumericType?) -> CssCalculatedStyleValueCalculationResult:
var number = 0.0
match value:
.number(number_value): number = css_syntax.number_value(&number_value)
.css_angle(angle): number = css_angle_to_degrees(&angle)
.css_flex(flex): number = css_flex_to_fr(&flex)
.css_frequency(frequency): number = css_frequency_to_hertz(&frequency)
.css_length(length):
# Handle some common cases first, so we can resolve more without a context
if css_length_is_absolute(&length):
number = css_length_absolute_length_to_px_without_rounding(&length)
# If we don't have a context, we cant resolve the length, so return NAN
elif let length_resolution_context = context.length_resolution_context:
number = css_length_to_px_without_rounding(&length, length_resolution_context)
else:
let length_string = css_length_to_string(&length)
ak.dbgln(f"Failed to resolve length `{ak.string_view_text(ak.string_bytes_as_string_view(&length_string))}`, likely due to calc() being used with relative units and a property not taking it into account")
number = math.nan
.css_resolution(resolution): number = css_resolution_to_dots_per_pixel(&resolution)
.css_time(time): number = css_time_to_seconds(&time)
.css_percentage(percentage): number = css_percentage_value(&percentage)
return css_calculated_style_value_calculation_result_new(number, numeric_type)
## Ported from Libraries/LibWeb/CSS/StyleValues/CalculatedStyleValue.cpp:2933 Web::CSS::CalculatedStyleValue::CalculationResult::add.
pub func css_calculated_style_value_calculation_result_add(this: CssCalculatedStyleValueCalculationResult*, other: const CssCalculatedStyleValueCalculationResult*):
this.m_value = this.m_value + other.m_value
this.m_type = css_optional_numeric_types_added(this.m_type, other.m_type)
## `m_type.has_value() && other.m_type.has_value() ? m_type->added_to(*other.m_type) : OptionalNone {}`.
func css_optional_numeric_types_added(a: CssNumericType?, b: CssNumericType?) -> CssNumericType?:
let left = a else return none
let right = b else return none
return css_numeric_type_added_to(&left, right)
## `m_type.has_value() && other.m_type.has_value() ? m_type->multiplied_by(*other.m_type) : OptionalNone {}`.
func css_optional_numeric_types_multiplied(a: CssNumericType?, b: CssNumericType?) -> CssNumericType?:
let left = a else return none
let right = b else return none
return css_numeric_type_multiplied_by(&left, right)
## Ported from Libraries/LibWeb/CSS/StyleValues/CalculatedStyleValue.cpp:2939 Web::CSS::CalculatedStyleValue::CalculationResult::subtract.
pub func css_calculated_style_value_calculation_result_subtract(this: CssCalculatedStyleValueCalculationResult*, other: const CssCalculatedStyleValueCalculationResult*):
this.m_value = this.m_value - other.m_value
this.m_type = css_optional_numeric_types_added(this.m_type, other.m_type)
## Ported from Libraries/LibWeb/CSS/StyleValues/CalculatedStyleValue.cpp:2945 Web::CSS::CalculatedStyleValue::CalculationResult::multiply_by.
pub func css_calculated_style_value_calculation_result_multiply_by(this: CssCalculatedStyleValueCalculationResult*, other: const CssCalculatedStyleValueCalculationResult*):
this.m_value = this.m_value * other.m_value
this.m_type = css_optional_numeric_types_multiplied(this.m_type, other.m_type)
## Ported from Libraries/LibWeb/CSS/StyleValues/CalculatedStyleValue.cpp:2951 Web::CSS::CalculatedStyleValue::CalculationResult::divide_by.
pub func css_calculated_style_value_calculation_result_divide_by(this: CssCalculatedStyleValueCalculationResult*, other: const CssCalculatedStyleValueCalculationResult*):
var other_copy = *other
css_calculated_style_value_calculation_result_invert(&other_copy)
this.m_value = this.m_value * other_copy.m_value
# NB: The donor multiplies by `other`'s type, not by the inverted copy's.
this.m_type = css_optional_numeric_types_multiplied(this.m_type, other.m_type)
## Ported from Libraries/LibWeb/CSS/StyleValues/CalculatedStyleValue.cpp:2959 Web::CSS::CalculatedStyleValue::CalculationResult::negate.
pub func css_calculated_style_value_calculation_result_negate(this: CssCalculatedStyleValueCalculationResult*):
this.m_value = 0.0 - this.m_value
## Ported from Libraries/LibWeb/CSS/StyleValues/CalculatedStyleValue.cpp:2964 Web::CSS::CalculatedStyleValue::CalculationResult::invert.
pub func css_calculated_style_value_calculation_result_invert(this: CssCalculatedStyleValueCalculationResult*):
# FIXME: Correctly handle division by zero.
this.m_value = 1.0 / this.m_value
if let type_ = this.m_type:
this.m_type = css_numeric_type_inverted(&type_)
## Ported from Libraries/LibWeb/CSS/StyleValues/CalculatedStyleValue.h:57 Web::CSS::CalculatedStyleValue::CalculationResult::value.
pub func css_calculated_style_value_calculation_result_value(this: const CssCalculatedStyleValueCalculationResult*) -> f64:
return this.m_value
## Ported from Libraries/LibWeb/CSS/StyleValues/CalculatedStyleValue.h:58 Web::CSS::CalculatedStyleValue::CalculationResult::type.
pub func css_calculated_style_value_calculation_result_type(this: const CssCalculatedStyleValueCalculationResult*) -> CssNumericType?:
return this.m_type
# mark: CalculatedStyleValue ====================================================================
## Ported from Libraries/LibWeb/CSS/StyleValues/CalculatedStyleValue.h:69 Web::CSS::CalculatedStyleValue::create.
pub func css_calculated_style_value_create(calculation: CssCalculationNode*, resolved_type: CssNumericType, context: CssCalculationContext) -> CssCalculatedStyleValue*:
let this = &(new CssCalculatedStyleValue[1] --- else trap("out of memory"))[0]
css_calculated_style_value_construct(this, calculation, resolved_type, context)
return this
## Ported from Libraries/LibWeb/CSS/StyleValues/CalculatedStyleValue.h:120 Web::CSS::CalculatedStyleValue::CalculatedStyleValue.
pub func css_calculated_style_value_construct(this: CssCalculatedStyleValue*, calculation: CssCalculationNode*, resolved_type: CssNumericType, context: CssCalculationContext):
css_style_value_construct(this.css_style_value(), CssStyleValueType.calculated)
css_style_value_set_class(this.css_style_value(), (const CssStyleValueVTable*)&css_calculated_style_value_vtable, &css_calculated_style_value_class)
this.m_resolved_type = resolved_type
this.m_calculation = calculation
this.m_context = context
## Ported from Libraries/LibWeb/CSS/StyleValues/CalculatedStyleValue.cpp:2972 Web::CSS::CalculatedStyleValue::serialize (override).
pub func css_calculated_style_value_serialize_impl(base: CssStyleValue*, builder: ak.StringBuilder*, mode: css_syntax.SerializationMode):
let this = (CssCalculatedStyleValue*)base
css_serialize_a_math_function(builder, this.m_calculation, this.m_context, mode)
## absolutized's `simplified_percentage_dimension_mix` lambda.
func css_calculated_style_value_simplified_percentage_dimension_mix(this: CssCalculatedStyleValue*, simplified_calculation_tree: CssCalculationNode*) -> CssStyleValue*?:
# NOTE: A percentage dimension mix is a SumCalculationNode with two NumericCalculationNode children which have
# matching base types - only the first of which has a percent hint.
if css_calculation_node_type(simplified_calculation_tree) != CssCalculationNodeType.sum:
return none
let sum_node = as_css_sum_calculation_node(simplified_calculation_tree)
let children = css_calculation_node_children(sum_node.css_calculation_node())
if css_calculation_node_type(*ak.vector_at_const(&children, 0)) != CssCalculationNodeType.numeric or css_calculation_node_type(*ak.vector_at_const(&children, 1)) != CssCalculationNodeType.numeric:
return none
let first_node = as_css_numeric_calculation_node(*ak.vector_at_const(&children, 0))
let second_node = as_css_numeric_calculation_node(*ak.vector_at_const(&children, 1))
let first_type = css_calculation_node_numeric_type(first_node.css_calculation_node()) else trap("VERIFY: has_value")
let second_type = css_calculation_node_numeric_type(second_node.css_calculation_node()) else trap("VERIFY: has_value")
let first_base_type = css_numeric_type_entry_with_value_1_while_all_others_are_0(&first_type)
let second_base_type = css_numeric_type_entry_with_value_1_while_all_others_are_0(&second_type)
if first_base_type == none or first_base_type != second_base_type:
return none
if css_numeric_type_percent_hint(&first_type) == none or css_numeric_type_percent_hint(&second_type) != none:
return none
let dimension_component = css_try_get_value_with_canonical_unit(second_node.css_calculation_node(), this.m_context, CssCalculationResolutionContext()) else trap("VERIFY: has_value")
# https://drafts.csswg.org/css-values-4/#combine-mixed
# The computed value of a percentage-dimension mix is defined as
# - a computed percentage if the dimension component is zero
if dimension_component.m_value == 0.0:
return css_percentage_style_value_create(css_numeric_value_percentage(&first_node.m_value) else trap("VERIFY: Variant::get<Percentage>")).css_style_value()
return none
## Ported from Libraries/LibWeb/CSS/StyleValues/CalculatedStyleValue.cpp:2977 Web::CSS::CalculatedStyleValue::absolutized (override).
pub func css_calculated_style_value_absolutized_impl(base: CssStyleValue*, computation_context: CssComputationContext) -> CssStyleValue*:
let this = (CssCalculatedStyleValue*)base
let simplified_calculation_tree = css_simplify_a_calculation_tree(this.m_calculation, this.m_context, css_calculation_resolution_context_from_computation_context(computation_context))
if let simplified_percentage_dimension_mix = css_calculated_style_value_simplified_percentage_dimension_mix(this, simplified_calculation_tree):
return simplified_percentage_dimension_mix
return css_calculated_style_value_create(simplified_calculation_tree, this.m_resolved_type, this.m_context).css_style_value()
## Ported from Libraries/LibWeb/CSS/StyleValues/CalculatedStyleValue.cpp:3021 Web::CSS::CalculatedStyleValue::equals (override).
pub func css_calculated_style_value_equals_impl(base: CssStyleValue*, other: CssStyleValue*) -> bool:
let this = (CssCalculatedStyleValue*)base
if css_style_value_type(base) != css_style_value_type(other):
return false
return css_calculation_node_equals(this.m_calculation, css_style_value_as_calculated(other).m_calculation)
## Ported from Libraries/LibWeb/CSS/StyleValues/CalculatedStyleValue.cpp:3029 Web::CSS::CalculatedStyleValue::is_computationally_independent (override).
pub func css_calculated_style_value_is_computationally_independent_impl(base: CssStyleValue*) -> bool:
let this = (CssCalculatedStyleValue*)base
return css_calculation_node_is_computationally_independent(this.m_calculation)
## The range a type accepts in this value's context (the if-chain of resolve_value).
func css_calculated_style_value_accepted_range(this: CssCalculatedStyleValue*, type_: const CssNumericType*) -> CssNumericRange?:
let ranges = &this.m_context.accepted_ranges_by_type
let resolve_as = this.m_context.percentages_resolve_as
var value_type: CssValueType? = none
if css_numeric_type_matches_number(type_, resolve_as):
value_type = CssValueType.integer if this.m_context.resolve_numbers_as_integers else CssValueType.number
elif css_numeric_type_matches_angle(type_, resolve_as):
value_type = CssValueType.angle
elif css_numeric_type_matches_flex(type_, resolve_as):
value_type = CssValueType.flex
elif css_numeric_type_matches_frequency(type_, resolve_as):
value_type = CssValueType.frequency
elif css_numeric_type_matches_length(type_, resolve_as):
value_type = CssValueType.length
elif css_numeric_type_matches_percentage(type_):
value_type = CssValueType.percentage
elif css_numeric_type_matches_resolution(type_, resolve_as):
value_type = CssValueType.resolution
elif css_numeric_type_matches_time(type_, resolve_as):
value_type = CssValueType.time
let accepted_type = value_type else return none
if let range = ak.hash_map_get_k_const(ranges, accepted_type):
return *range
return none
## Ported from Libraries/LibWeb/CSS/StyleValues/CalculatedStyleValue.cpp:3035 Web::CSS::CalculatedStyleValue::resolve_value.
# https://drafts.csswg.org/css-values-4/#calc-computed-value
func css_calculated_style_value_resolve_value(this: CssCalculatedStyleValue*, resolution_context: CssCalculationResolutionContext, apply_censoring_and_clamping: bool = true) -> CssCalculatedStyleValueResolvedValue?:
# The calculation tree is again simplified at used value time; with used value time information.
# NOTE: Any nodes which rely on dynamic state should have been simplified away in absolutized so we can pass a nullptr here
let simplified_tree = css_simplify_a_calculation_tree(this.m_calculation, this.m_context, resolution_context)
if not is_css_numeric_calculation_node(simplified_tree):
return none
let value = css_try_get_value_with_canonical_unit(simplified_tree, this.m_context, resolution_context) else trap("VERIFY: value.has_value()")
var raw_value = value.m_value
if apply_censoring_and_clamping:
# https://drafts.csswg.org/css-values/#calc-ieee
# NaN does not escape a top-level calculation; it’s censored into a zero value.
if math.is_nan(raw_value):
raw_value = 0.0
# https://drafts.csswg.org/css-values/#calc-range
# the value resulting from a top-level calculation must be clamped to the range allowed in the target context.
# Clamping is performed on computed values to the extent possible, and also on used values if computation was
# unable to sufficiently simplify the expression to allow range-checking.
let value_type = value.m_type else trap("VERIFY: has_value")
var accepted_range = css_calculated_style_value_accepted_range(this, &value_type)
if accepted_range == none:
if css_libweb_css_debug:
let dumped = css_numeric_type_dump(&value_type)
ak.dbgln(f"FIXME: Calculation context missing accepted range {ak.string_view_text(ak.string_bytes_as_string_view(&dumped))}")
# FIXME: Infinity for integers should be i32 max rather than float max
accepted_range = CssNumericRange(min = (f64)ak.f32_lowest, max = (f64)ak.f32_max)
let range = accepted_range else trap("unreachable")
raw_value = ak.clamp_f64(raw_value, range.min, range.max)
return CssCalculatedStyleValueResolvedValue(value = raw_value, type_ = value.m_type)
## The resolved value when it has a type that `matches`, or none (the shared shape of the resolve_* functions).
func css_calculated_style_value_resolve_matching(this: CssCalculatedStyleValue*, context: CssCalculationResolutionContext, matches: func(const CssNumericType*, CssValueType?) -> bool, apply_censoring_and_clamping: bool = true) -> f64?:
let result = css_calculated_style_value_resolve_value(this, context, apply_censoring_and_clamping) else return none
let type_ = result.type_ else return none
if matches(&type_, this.m_context.percentages_resolve_as):
return result.value
return none
## `NumericType::matches_percentage` with the signature of the other matches_* tests.
func css_numeric_type_matches_percentage_ignoring_context(this: const CssNumericType*, percentages_resolve_as: CssValueType?) -> bool:
_ = percentages_resolve_as
return css_numeric_type_matches_percentage(this)
## Ported from Libraries/LibWeb/CSS/StyleValues/CalculatedStyleValue.cpp:3091 Web::CSS::CalculatedStyleValue::resolve_angle.
pub func css_calculated_style_value_resolve_angle(this: CssCalculatedStyleValue*, context: CssCalculationResolutionContext) -> CssAngle?:
let value = css_calculated_style_value_resolve_matching(this, context, css_numeric_type_matches_angle) else return none
return css_angle_make_degrees(value)
## Ported from Libraries/LibWeb/CSS/StyleValues/CalculatedStyleValue.cpp:3101 Web::CSS::CalculatedStyleValue::resolve_flex.
pub func css_calculated_style_value_resolve_flex(this: CssCalculatedStyleValue*, context: CssCalculationResolutionContext) -> CssFlex?:
let value = css_calculated_style_value_resolve_matching(this, context, css_numeric_type_matches_flex) else return none
return css_flex_make_fr(value)
## Ported from Libraries/LibWeb/CSS/StyleValues/CalculatedStyleValue.cpp:3111 Web::CSS::CalculatedStyleValue::resolve_frequency.
pub func css_calculated_style_value_resolve_frequency(this: CssCalculatedStyleValue*, context: CssCalculationResolutionContext) -> CssFrequency?:
let value = css_calculated_style_value_resolve_matching(this, context, css_numeric_type_matches_frequency) else return none
return css_frequency_make_hertz(value)
## Ported from Libraries/LibWeb/CSS/StyleValues/CalculatedStyleValue.cpp:3121 Web::CSS::CalculatedStyleValue::resolve_length.
pub func css_calculated_style_value_resolve_length(this: CssCalculatedStyleValue*, context: CssCalculationResolutionContext) -> CssLength?:
let value = css_calculated_style_value_resolve_matching(this, context, css_numeric_type_matches_length) else return none
return css_length_make_px_f64(value)
## Ported from Libraries/LibWeb/CSS/StyleValues/CalculatedStyleValue.cpp:3131 Web::CSS::CalculatedStyleValue::resolve_raw_length.
pub func css_calculated_style_value_resolve_raw_length(this: CssCalculatedStyleValue*, context: CssCalculationResolutionContext) -> f64?:
return css_calculated_style_value_resolve_matching(this, context, css_numeric_type_matches_length, false)
## Ported from Libraries/LibWeb/CSS/StyleValues/CalculatedStyleValue.cpp:3141 Web::CSS::CalculatedStyleValue::resolve_percentage.
pub func css_calculated_style_value_resolve_percentage(this: CssCalculatedStyleValue*, context: CssCalculationResolutionContext) -> CssPercentage?:
let value = css_calculated_style_value_resolve_matching(this, context, css_numeric_type_matches_percentage_ignoring_context) else return none
return css_percentage_new(value)
## Ported from Libraries/LibWeb/CSS/StyleValues/CalculatedStyleValue.cpp:3151 Web::CSS::CalculatedStyleValue::resolve_resolution.
pub func css_calculated_style_value_resolve_resolution(this: CssCalculatedStyleValue*, context: CssCalculationResolutionContext) -> CssResolution?:
let value = css_calculated_style_value_resolve_matching(this, context, css_numeric_type_matches_resolution) else return none
return css_resolution_make_dots_per_pixel(value)
## Ported from Libraries/LibWeb/CSS/StyleValues/CalculatedStyleValue.cpp:3161 Web::CSS::CalculatedStyleValue::resolve_time.
pub func css_calculated_style_value_resolve_time(this: CssCalculatedStyleValue*, context: CssCalculationResolutionContext) -> CssTime?:
let value = css_calculated_style_value_resolve_matching(this, context, css_numeric_type_matches_time) else return none
return css_time_make_seconds(value)
## Ported from Libraries/LibWeb/CSS/StyleValues/CalculatedStyleValue.cpp:3171 Web::CSS::CalculatedStyleValue::resolve_number.
pub func css_calculated_style_value_resolve_number(this: CssCalculatedStyleValue*, context: CssCalculationResolutionContext) -> f64?:
return css_calculated_style_value_resolve_matching(this, context, css_numeric_type_matches_number)
## Ported from Libraries/LibWeb/CSS/StyleValues/CalculatedStyleValue.cpp:3181 Web::CSS::CalculatedStyleValue::resolve_integer.
pub func css_calculated_style_value_resolve_integer(this: CssCalculatedStyleValue*, context: CssCalculationResolutionContext) -> i32?:
let value = css_calculated_style_value_resolve_matching(this, context, css_numeric_type_matches_number) else return none
return css_syntax.round_to_nearest_integer(value)
## Ported from Libraries/LibWeb/CSS/StyleValues/CalculatedStyleValue.cpp:3191 Web::CSS::CalculatedStyleValue::contains_percentage.
pub func css_calculated_style_value_contains_percentage(this: CssCalculatedStyleValue*) -> bool:
return css_calculation_node_contains_percentage(this.m_calculation)
## Ported from Libraries/LibWeb/CSS/StyleValues/CalculatedStyleValue.cpp:3196 Web::CSS::CalculatedStyleValue::dump.
pub func css_calculated_style_value_dump(this: CssCalculatedStyleValue*) -> ak.String:
var builder = ak.StringBuilder()
ak.string_builder_construct(&builder)
css_calculation_node_dump(this.m_calculation, &builder, 0)
return ak.string_builder_to_string_without_validation(&builder)
## Ported from Libraries/LibWeb/CSS/StyleValues/CalculatedStyleValue.cpp:3204 Web::CSS::CalculatedStyleValue::reify (override).
# https://drafts.css-houdini.org/css-typed-om-1/#reify-a-math-expression
pub func css_calculated_style_value_reify_impl(base: CssStyleValue*, realm: Realm*, associated_property: ak.FlyString) -> CssCssStyleValue*:
let this = (CssCalculatedStyleValue*)base
# NB: This spec algorithm isn't really implementable here - it's incomplete, and assumes we don't already have a
# calculation tree. So we have a per-node method instead.
if let reified = css_calculation_node_reify(this.m_calculation, realm):
return (CssCssStyleValue*)reified
# Some math functions are not reifiable yet. If we contain one, we have to fall back to CSSStyleValue.
# https://github.com/w3c/css-houdini-drafts/issues/1090
return css_style_value_reify_impl(base, realm, associated_property)
## Ported from Libraries/LibWeb/CSS/StyleValues/CalculatedStyleValue.h:79 Web::CSS::CalculatedStyleValue::calculation.
pub func css_calculated_style_value_calculation(this: CssCalculatedStyleValue*) -> CssCalculationNode*:
return this.m_calculation
## Ported from Libraries/LibWeb/CSS/StyleValues/CalculatedStyleValue.h:81 Web::CSS::CalculatedStyleValue::resolves_to_angle.
pub func css_calculated_style_value_resolves_to_angle(this: CssCalculatedStyleValue*) -> bool:
return css_numeric_type_matches_angle(&this.m_resolved_type, this.m_context.percentages_resolve_as)
## Ported from Libraries/LibWeb/CSS/StyleValues/CalculatedStyleValue.h:82 Web::CSS::CalculatedStyleValue::resolves_to_angle_percentage.
pub func css_calculated_style_value_resolves_to_angle_percentage(this: CssCalculatedStyleValue*) -> bool:
return css_numeric_type_matches_angle_percentage(&this.m_resolved_type, this.m_context.percentages_resolve_as)
## Ported from Libraries/LibWeb/CSS/StyleValues/CalculatedStyleValue.h:85 Web::CSS::CalculatedStyleValue::resolves_to_flex.
pub func css_calculated_style_value_resolves_to_flex(this: CssCalculatedStyleValue*) -> bool:
return css_numeric_type_matches_flex(&this.m_resolved_type, this.m_context.percentages_resolve_as)
## Ported from Libraries/LibWeb/CSS/StyleValues/CalculatedStyleValue.h:88 Web::CSS::CalculatedStyleValue::resolves_to_frequency.
pub func css_calculated_style_value_resolves_to_frequency(this: CssCalculatedStyleValue*) -> bool:
return css_numeric_type_matches_frequency(&this.m_resolved_type, this.m_context.percentages_resolve_as)
## Ported from Libraries/LibWeb/CSS/StyleValues/CalculatedStyleValue.h:89 Web::CSS::CalculatedStyleValue::resolves_to_frequency_percentage.
pub func css_calculated_style_value_resolves_to_frequency_percentage(this: CssCalculatedStyleValue*) -> bool:
return css_numeric_type_matches_frequency_percentage(&this.m_resolved_type, this.m_context.percentages_resolve_as)
## Ported from Libraries/LibWeb/CSS/StyleValues/CalculatedStyleValue.h:92 Web::CSS::CalculatedStyleValue::resolves_to_length.
pub func css_calculated_style_value_resolves_to_length(this: CssCalculatedStyleValue*) -> bool:
return css_numeric_type_matches_length(&this.m_resolved_type, this.m_context.percentages_resolve_as)
## Ported from Libraries/LibWeb/CSS/StyleValues/CalculatedStyleValue.h:93 Web::CSS::CalculatedStyleValue::resolves_to_length_percentage.
pub func css_calculated_style_value_resolves_to_length_percentage(this: CssCalculatedStyleValue*) -> bool:
return css_numeric_type_matches_length_percentage(&this.m_resolved_type, this.m_context.percentages_resolve_as)
## Ported from Libraries/LibWeb/CSS/StyleValues/CalculatedStyleValue.h:97 Web::CSS::CalculatedStyleValue::resolves_to_percentage.
pub func css_calculated_style_value_resolves_to_percentage(this: CssCalculatedStyleValue*) -> bool:
return css_numeric_type_matches_percentage(&this.m_resolved_type)
## Ported from Libraries/LibWeb/CSS/StyleValues/CalculatedStyleValue.h:100 Web::CSS::CalculatedStyleValue::resolves_to_resolution.
pub func css_calculated_style_value_resolves_to_resolution(this: CssCalculatedStyleValue*) -> bool:
return css_numeric_type_matches_resolution(&this.m_resolved_type, this.m_context.percentages_resolve_as)
## Ported from Libraries/LibWeb/CSS/StyleValues/CalculatedStyleValue.h:103 Web::CSS::CalculatedStyleValue::resolves_to_time.
pub func css_calculated_style_value_resolves_to_time(this: CssCalculatedStyleValue*) -> bool:
return css_numeric_type_matches_time(&this.m_resolved_type, this.m_context.percentages_resolve_as)
## Ported from Libraries/LibWeb/CSS/StyleValues/CalculatedStyleValue.h:104 Web::CSS::CalculatedStyleValue::resolves_to_time_percentage.
pub func css_calculated_style_value_resolves_to_time_percentage(this: CssCalculatedStyleValue*) -> bool:
return css_numeric_type_matches_time_percentage(&this.m_resolved_type, this.m_context.percentages_resolve_as)
## Ported from Libraries/LibWeb/CSS/StyleValues/CalculatedStyleValue.h:107 Web::CSS::CalculatedStyleValue::resolves_to_number.
pub func css_calculated_style_value_resolves_to_number(this: CssCalculatedStyleValue*) -> bool:
return css_numeric_type_matches_number(&this.m_resolved_type, this.m_context.percentages_resolve_as)
## Ported from Libraries/LibWeb/CSS/StyleValues/CalculatedStyleValue.h:111 Web::CSS::CalculatedStyleValue::resolves_to_dimension.
pub func css_calculated_style_value_resolves_to_dimension(this: CssCalculatedStyleValue*) -> bool:
return css_numeric_type_matches_dimension(&this.m_resolved_type)