| 
									
										
										
										
											2023-03-30 17:34:14 +01:00
										 |  |  | /*
 | 
					
						
							| 
									
										
										
										
											2024-10-04 13:19:50 +02:00
										 |  |  |  * Copyright (c) 2018-2020, Andreas Kling <andreas@ladybird.org> | 
					
						
							| 
									
										
										
										
											2023-03-30 17:34:14 +01:00
										 |  |  |  * Copyright (c) 2021, Tobias Christiansen <tobyase@serenityos.org> | 
					
						
							| 
									
										
										
											
												LibWeb/CSS: Wrap calc()-resolution data in a struct
Initially I added this to the existing CalculationContext, but in
reality, we have some data at parse-time and different data at
resolve-time, so it made more sense to keep those separate.
Instead of needing a variety of methods for resolving a Foo, depending
on whether we have a Layout::Node available, or a percentage basis, or
a length resolution context... put those in a
CalculationResolutionContext, and just pass that one thing to these
methods. This also removes the need for separate resolve_*_percentage()
methods, because we can just pass the percentage basis in to the regular
resolve_foo() method.
This also corrects the issue that *any* calculation may need to resolve
lengths, but we previously only passed a length resolution context to
specific types in some situations. Now, they can all have one available,
though it's up to the caller to provide it.
											
										 
											2025-01-22 16:05:32 +00:00
										 |  |  |  * Copyright (c) 2021-2025, Sam Atkins <sam@ladybird.org> | 
					
						
							| 
									
										
										
										
											2023-03-30 17:34:14 +01:00
										 |  |  |  * Copyright (c) 2022-2023, MacDue <macdue@dueutil.tech> | 
					
						
							|  |  |  |  * | 
					
						
							|  |  |  |  * SPDX-License-Identifier: BSD-2-Clause | 
					
						
							|  |  |  |  */ | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | #pragma once
 | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2023-07-09 11:40:17 +03:30
										 |  |  | #include <AK/Function.h>
 | 
					
						
							| 
									
										
										
										
											2023-03-30 17:34:14 +01:00
										 |  |  | #include <LibWeb/CSS/Angle.h>
 | 
					
						
							| 
									
										
										
										
											2025-02-17 16:21:50 +00:00
										 |  |  | #include <LibWeb/CSS/Enums.h>
 | 
					
						
							| 
									
										
										
										
											2023-09-28 15:18:14 +01:00
										 |  |  | #include <LibWeb/CSS/Flex.h>
 | 
					
						
							| 
									
										
										
										
											2023-03-30 17:34:14 +01:00
										 |  |  | #include <LibWeb/CSS/Frequency.h>
 | 
					
						
							|  |  |  | #include <LibWeb/CSS/Length.h>
 | 
					
						
							| 
									
										
										
										
											2025-08-06 22:15:01 +12:00
										 |  |  | #include <LibWeb/CSS/Number.h>
 | 
					
						
							| 
									
										
										
										
											2025-08-15 12:55:58 +01:00
										 |  |  | #include <LibWeb/CSS/NumericType.h>
 | 
					
						
							| 
									
										
										
										
											2023-03-30 17:34:14 +01:00
										 |  |  | #include <LibWeb/CSS/Percentage.h>
 | 
					
						
							| 
									
										
										
										
											2023-12-30 17:05:23 +00:00
										 |  |  | #include <LibWeb/CSS/Resolution.h>
 | 
					
						
							| 
									
										
										
										
											2025-08-08 10:11:51 +01:00
										 |  |  | #include <LibWeb/CSS/StyleValues/StyleValue.h>
 | 
					
						
							| 
									
										
										
										
											2023-03-30 17:34:14 +01:00
										 |  |  | #include <LibWeb/CSS/Time.h>
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | namespace Web::CSS { | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2023-04-11 15:48:06 +01:00
										 |  |  | class CalculationNode; | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2025-06-17 10:59:50 +01:00
										 |  |  | // https://drafts.csswg.org/css-values-4/#calc-context
 | 
					
						
							| 
									
										
										
											
												LibWeb/CSS: Wrap calc()-resolution data in a struct
Initially I added this to the existing CalculationContext, but in
reality, we have some data at parse-time and different data at
resolve-time, so it made more sense to keep those separate.
Instead of needing a variety of methods for resolving a Foo, depending
on whether we have a Layout::Node available, or a percentage basis, or
a length resolution context... put those in a
CalculationResolutionContext, and just pass that one thing to these
methods. This also removes the need for separate resolve_*_percentage()
methods, because we can just pass the percentage basis in to the regular
resolve_foo() method.
This also corrects the issue that *any* calculation may need to resolve
lengths, but we previously only passed a length resolution context to
specific types in some situations. Now, they can all have one available,
though it's up to the caller to provide it.
											
										 
											2025-01-22 16:05:32 +00:00
										 |  |  | // Contains the context available at parse-time.
 | 
					
						
							| 
									
										
										
										
											2025-01-08 16:14:17 +00:00
										 |  |  | struct CalculationContext { | 
					
						
							|  |  |  |     Optional<ValueType> percentages_resolve_as {}; | 
					
						
							| 
									
										
										
										
											2025-01-28 15:49:55 +00:00
										 |  |  |     bool resolve_numbers_as_integers = false; | 
					
						
							| 
									
										
										
										
											2025-08-06 16:09:09 +12:00
										 |  |  |     AcceptedTypeRangeMap accepted_type_ranges {}; | 
					
						
							| 
									
										
										
										
											2025-01-08 16:14:17 +00:00
										 |  |  | }; | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2025-08-08 10:11:51 +01:00
										 |  |  | class CalculatedStyleValue : public StyleValue { | 
					
						
							| 
									
										
										
										
											2023-03-30 17:34:14 +01:00
										 |  |  | public: | 
					
						
							|  |  |  |     class CalculationResult { | 
					
						
							|  |  |  |     public: | 
					
						
							| 
									
										
										
										
											2023-12-30 17:05:23 +00:00
										 |  |  |         using Value = Variant<Number, Angle, Flex, Frequency, Length, Percentage, Resolution, Time>; | 
					
						
							| 
									
										
										
										
											2025-08-15 12:55:58 +01:00
										 |  |  |         static CalculationResult from_value(Value const&, CalculationResolutionContext const&, Optional<NumericType>); | 
					
						
							| 
									
										
										
										
											2024-12-18 13:15:26 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2025-08-15 12:55:58 +01:00
										 |  |  |         CalculationResult(double value, Optional<NumericType> type) | 
					
						
							| 
									
										
										
										
											2024-12-18 13:15:26 +00:00
										 |  |  |             : m_value(value) | 
					
						
							|  |  |  |             , m_type(move(type)) | 
					
						
							| 
									
										
										
										
											2023-03-30 17:34:14 +01:00
										 |  |  |         { | 
					
						
							|  |  |  |         } | 
					
						
							| 
									
										
										
										
											2024-12-18 13:15:26 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
											
												LibWeb/CSS: Wrap calc()-resolution data in a struct
Initially I added this to the existing CalculationContext, but in
reality, we have some data at parse-time and different data at
resolve-time, so it made more sense to keep those separate.
Instead of needing a variety of methods for resolving a Foo, depending
on whether we have a Layout::Node available, or a percentage basis, or
a length resolution context... put those in a
CalculationResolutionContext, and just pass that one thing to these
methods. This also removes the need for separate resolve_*_percentage()
methods, because we can just pass the percentage basis in to the regular
resolve_foo() method.
This also corrects the issue that *any* calculation may need to resolve
lengths, but we previously only passed a length resolution context to
specific types in some situations. Now, they can all have one available,
though it's up to the caller to provide it.
											
										 
											2025-01-22 16:05:32 +00:00
										 |  |  |         void add(CalculationResult const& other); | 
					
						
							|  |  |  |         void subtract(CalculationResult const& other); | 
					
						
							|  |  |  |         void multiply_by(CalculationResult const& other); | 
					
						
							|  |  |  |         void divide_by(CalculationResult const& other); | 
					
						
							| 
									
										
										
										
											2023-04-11 15:48:06 +01:00
										 |  |  |         void negate(); | 
					
						
							|  |  |  |         void invert(); | 
					
						
							| 
									
										
										
										
											2023-03-30 17:34:14 +01:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2024-12-18 13:15:26 +00:00
										 |  |  |         double value() const { return m_value; } | 
					
						
							| 
									
										
										
										
											2025-08-15 12:55:58 +01:00
										 |  |  |         Optional<NumericType> const& type() const { return m_type; } | 
					
						
							| 
									
										
										
										
											2024-09-17 17:51:48 +02:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2024-01-09 12:41:43 +01:00
										 |  |  |         [[nodiscard]] bool operator==(CalculationResult const&) const = default; | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2023-03-30 17:34:14 +01:00
										 |  |  |     private: | 
					
						
							| 
									
										
										
										
											2024-12-18 13:15:26 +00:00
										 |  |  |         double m_value; | 
					
						
							| 
									
										
										
										
											2025-08-15 12:55:58 +01:00
										 |  |  |         Optional<NumericType> m_type; | 
					
						
							| 
									
										
										
										
											2023-03-30 17:34:14 +01:00
										 |  |  |     }; | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2025-08-15 12:55:58 +01:00
										 |  |  |     static ValueComparingNonnullRefPtr<CalculatedStyleValue const> create(NonnullRefPtr<CalculationNode const> calculation, NumericType resolved_type, CalculationContext context) | 
					
						
							| 
									
										
										
										
											2023-03-30 17:34:14 +01:00
										 |  |  |     { | 
					
						
							| 
									
										
										
										
											2025-01-08 16:14:17 +00:00
										 |  |  |         return adopt_ref(*new (nothrow) CalculatedStyleValue(move(calculation), move(resolved_type), move(context))); | 
					
						
							| 
									
										
										
										
											2023-03-30 17:34:14 +01:00
										 |  |  |     } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2024-12-07 00:59:49 +01:00
										 |  |  |     virtual String to_string(SerializationMode) const override; | 
					
						
							| 
									
										
										
										
											2025-08-08 10:11:51 +01:00
										 |  |  |     virtual ValueComparingNonnullRefPtr<StyleValue const> absolutized(CSSPixelRect const& viewport_rect, Length::FontMetrics const& font_metrics, Length::FontMetrics const& root_font_metrics) const override; | 
					
						
							|  |  |  |     virtual bool equals(StyleValue const& other) const override; | 
					
						
							| 
									
										
										
										
											2023-03-30 17:34:14 +01:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2025-01-09 17:23:20 +00:00
										 |  |  |     bool resolves_to_angle() const { return m_resolved_type.matches_angle(m_context.percentages_resolve_as); } | 
					
						
							|  |  |  |     bool resolves_to_angle_percentage() const { return m_resolved_type.matches_angle_percentage(m_context.percentages_resolve_as); } | 
					
						
							| 
									
										
										
										
											2025-07-02 19:12:33 +12:00
										 |  |  |     Optional<Angle> resolve_angle_deprecated(CalculationResolutionContext const&) const; | 
					
						
							| 
									
										
										
										
											2025-07-02 19:50:16 +12:00
										 |  |  |     Optional<Angle> resolve_angle(CalculationResolutionContext const&) const; | 
					
						
							| 
									
										
										
										
											2023-03-30 17:34:14 +01:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2025-01-09 17:23:20 +00:00
										 |  |  |     bool resolves_to_flex() const { return m_resolved_type.matches_flex(m_context.percentages_resolve_as); } | 
					
						
							| 
									
										
										
										
											2025-07-02 19:12:33 +12:00
										 |  |  |     Optional<Flex> resolve_flex_deprecated(CalculationResolutionContext const&) const; | 
					
						
							| 
									
										
										
										
											2025-07-02 19:50:16 +12:00
										 |  |  |     Optional<Flex> resolve_flex(CalculationResolutionContext const&) const; | 
					
						
							| 
									
										
										
										
											2023-09-28 15:18:14 +01:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2025-01-09 17:23:20 +00:00
										 |  |  |     bool resolves_to_frequency() const { return m_resolved_type.matches_frequency(m_context.percentages_resolve_as); } | 
					
						
							|  |  |  |     bool resolves_to_frequency_percentage() const { return m_resolved_type.matches_frequency_percentage(m_context.percentages_resolve_as); } | 
					
						
							| 
									
										
										
										
											2025-07-02 19:12:33 +12:00
										 |  |  |     Optional<Frequency> resolve_frequency_deprecated(CalculationResolutionContext const&) const; | 
					
						
							| 
									
										
										
										
											2025-07-02 19:50:16 +12:00
										 |  |  |     Optional<Frequency> resolve_frequency(CalculationResolutionContext const&) const; | 
					
						
							| 
									
										
										
										
											2023-03-30 17:34:14 +01:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2025-01-09 17:23:20 +00:00
										 |  |  |     bool resolves_to_length() const { return m_resolved_type.matches_length(m_context.percentages_resolve_as); } | 
					
						
							|  |  |  |     bool resolves_to_length_percentage() const { return m_resolved_type.matches_length_percentage(m_context.percentages_resolve_as); } | 
					
						
							| 
									
										
										
										
											2025-07-02 19:12:33 +12:00
										 |  |  |     Optional<Length> resolve_length_deprecated(CalculationResolutionContext const&) const; | 
					
						
							| 
									
										
										
										
											2025-07-02 19:50:16 +12:00
										 |  |  |     Optional<Length> resolve_length(CalculationResolutionContext const&) const; | 
					
						
							| 
									
										
										
										
											2023-03-30 17:34:14 +01:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2023-06-30 16:29:06 +01:00
										 |  |  |     bool resolves_to_percentage() const { return m_resolved_type.matches_percentage(); } | 
					
						
							| 
									
										
										
										
											2025-07-02 19:12:33 +12:00
										 |  |  |     Optional<Percentage> resolve_percentage_deprecated(CalculationResolutionContext const&) const; | 
					
						
							| 
									
										
										
										
											2025-07-02 19:50:16 +12:00
										 |  |  |     Optional<Percentage> resolve_percentage(CalculationResolutionContext const&) const; | 
					
						
							| 
									
										
										
										
											2023-03-30 17:34:14 +01:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2025-01-09 17:23:20 +00:00
										 |  |  |     bool resolves_to_resolution() const { return m_resolved_type.matches_resolution(m_context.percentages_resolve_as); } | 
					
						
							| 
									
										
										
										
											2025-07-02 19:12:33 +12:00
										 |  |  |     Optional<Resolution> resolve_resolution_deprecated(CalculationResolutionContext const&) const; | 
					
						
							| 
									
										
										
										
											2025-07-02 19:50:16 +12:00
										 |  |  |     Optional<Resolution> resolve_resolution(CalculationResolutionContext const&) const; | 
					
						
							| 
									
										
										
										
											2023-12-30 17:05:23 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2025-01-09 17:23:20 +00:00
										 |  |  |     bool resolves_to_time() const { return m_resolved_type.matches_time(m_context.percentages_resolve_as); } | 
					
						
							|  |  |  |     bool resolves_to_time_percentage() const { return m_resolved_type.matches_time_percentage(m_context.percentages_resolve_as); } | 
					
						
							| 
									
										
										
										
											2025-07-02 19:12:33 +12:00
										 |  |  |     Optional<Time> resolve_time_deprecated(CalculationResolutionContext const&) const; | 
					
						
							| 
									
										
										
										
											2025-07-02 19:50:16 +12:00
										 |  |  |     Optional<Time> resolve_time(CalculationResolutionContext const&) const; | 
					
						
							| 
									
										
										
										
											2023-03-30 17:34:14 +01:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2025-01-09 17:23:20 +00:00
										 |  |  |     bool resolves_to_number() const { return m_resolved_type.matches_number(m_context.percentages_resolve_as); } | 
					
						
							| 
									
										
										
										
											2025-07-02 19:12:33 +12:00
										 |  |  |     Optional<double> resolve_number_deprecated(CalculationResolutionContext const&) const; | 
					
						
							| 
									
										
										
										
											2025-07-02 19:50:16 +12:00
										 |  |  |     Optional<double> resolve_number(CalculationResolutionContext const&) const; | 
					
						
							| 
									
										
										
										
											2025-07-02 19:12:33 +12:00
										 |  |  |     Optional<i64> resolve_integer_deprecated(CalculationResolutionContext const&) const; | 
					
						
							| 
									
										
										
										
											2025-07-02 19:50:16 +12:00
										 |  |  |     Optional<i64> resolve_integer(CalculationResolutionContext const&) const; | 
					
						
							| 
									
										
										
										
											2023-03-30 17:34:14 +01:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2024-08-16 09:41:10 +01:00
										 |  |  |     bool resolves_to_dimension() const { return m_resolved_type.matches_dimension(); } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2023-03-30 17:34:14 +01:00
										 |  |  |     bool contains_percentage() const; | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2024-08-16 16:42:58 +01:00
										 |  |  |     String dump() const; | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2025-08-22 11:10:24 +01:00
										 |  |  |     virtual GC::Ref<CSSStyleValue> reify(JS::Realm&, String const& associated_property) const override; | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2023-03-30 17:34:14 +01:00
										 |  |  | private: | 
					
						
							| 
									
										
										
										
											2025-08-15 12:55:58 +01:00
										 |  |  |     explicit CalculatedStyleValue(NonnullRefPtr<CalculationNode const> calculation, NumericType resolved_type, CalculationContext context) | 
					
						
							| 
									
										
										
										
											2025-08-08 10:11:51 +01:00
										 |  |  |         : StyleValue(Type::Calculated) | 
					
						
							| 
									
										
										
										
											2025-01-08 16:14:17 +00:00
										 |  |  |         , m_resolved_type(move(resolved_type)) | 
					
						
							| 
									
										
										
										
											2023-04-11 15:48:06 +01:00
										 |  |  |         , m_calculation(move(calculation)) | 
					
						
							| 
									
										
										
										
											2025-01-08 16:14:17 +00:00
										 |  |  |         , m_context(move(context)) | 
					
						
							| 
									
										
										
										
											2023-03-30 17:34:14 +01:00
										 |  |  |     { | 
					
						
							|  |  |  |     } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2025-08-06 16:16:43 +12:00
										 |  |  |     struct ResolvedValue { | 
					
						
							|  |  |  |         double value; | 
					
						
							| 
									
										
										
										
											2025-08-15 12:55:58 +01:00
										 |  |  |         Optional<NumericType> type; | 
					
						
							| 
									
										
										
										
											2025-08-06 16:16:43 +12:00
										 |  |  |     }; | 
					
						
							|  |  |  |     Optional<ResolvedValue> resolve_value(CalculationResolutionContext const&) const; | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2025-01-09 17:23:20 +00:00
										 |  |  |     Optional<ValueType> percentage_resolved_type() const; | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2025-08-15 12:55:58 +01:00
										 |  |  |     NumericType m_resolved_type; | 
					
						
							| 
									
										
										
										
											2025-04-15 15:21:37 -06:00
										 |  |  |     NonnullRefPtr<CalculationNode const> m_calculation; | 
					
						
							| 
									
										
										
										
											2025-01-08 16:14:17 +00:00
										 |  |  |     CalculationContext m_context; | 
					
						
							| 
									
										
										
										
											2023-04-11 15:48:06 +01:00
										 |  |  | }; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | // https://www.w3.org/TR/css-values-4/#calculation-tree
 | 
					
						
							| 
									
										
										
										
											2025-01-22 16:50:54 +00:00
										 |  |  | class CalculationNode : public RefCounted<CalculationNode> { | 
					
						
							| 
									
										
										
										
											2023-04-11 15:48:06 +01:00
										 |  |  | public: | 
					
						
							|  |  |  |     enum class Type { | 
					
						
							|  |  |  |         Numeric, | 
					
						
							|  |  |  |         // NOTE: Currently, any value with a `var()` or `attr()` function in it is always an
 | 
					
						
							|  |  |  |         //       UnresolvedStyleValue so we do not have to implement a NonMathFunction type here.
 | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2023-05-26 11:21:49 +02:00
										 |  |  |         // Comparison function nodes, a sub-type of operator node
 | 
					
						
							|  |  |  |         // https://drafts.csswg.org/css-values-4/#comp-func
 | 
					
						
							|  |  |  |         Min, | 
					
						
							|  |  |  |         Max, | 
					
						
							|  |  |  |         Clamp, | 
					
						
							| 
									
										
										
										
											2023-04-11 15:48:06 +01:00
										 |  |  | 
 | 
					
						
							|  |  |  |         // Calc-operator nodes, a sub-type of operator node
 | 
					
						
							|  |  |  |         // https://www.w3.org/TR/css-values-4/#calculation-tree-calc-operator-nodes
 | 
					
						
							|  |  |  |         Sum, | 
					
						
							|  |  |  |         Product, | 
					
						
							|  |  |  |         Negate, | 
					
						
							|  |  |  |         Invert, | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2023-05-27 22:56:41 +02:00
										 |  |  |         // Sign-Related Functions, a sub-type of operator node
 | 
					
						
							|  |  |  |         // https://drafts.csswg.org/css-values-4/#sign-funcs
 | 
					
						
							|  |  |  |         Abs, | 
					
						
							|  |  |  |         Sign, | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2023-05-27 23:50:33 +02:00
										 |  |  |         // Trigonometric functions, a sub-type of operator node
 | 
					
						
							|  |  |  |         // https://drafts.csswg.org/css-values-4/#trig-funcs
 | 
					
						
							|  |  |  |         Sin, | 
					
						
							|  |  |  |         Cos, | 
					
						
							|  |  |  |         Tan, | 
					
						
							|  |  |  |         Asin, | 
					
						
							|  |  |  |         Acos, | 
					
						
							|  |  |  |         Atan, | 
					
						
							|  |  |  |         Atan2, | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2023-05-28 11:26:42 +02:00
										 |  |  |         // Exponential functions, a sub-type of operator node
 | 
					
						
							|  |  |  |         // https://drafts.csswg.org/css-values-4/#exponent-funcs
 | 
					
						
							|  |  |  |         Pow, | 
					
						
							|  |  |  |         Sqrt, | 
					
						
							|  |  |  |         Hypot, | 
					
						
							|  |  |  |         Log, | 
					
						
							|  |  |  |         Exp, | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2023-05-27 16:07:50 +02:00
										 |  |  |         // Stepped value functions, a sub-type of operator node
 | 
					
						
							|  |  |  |         // https://drafts.csswg.org/css-values-4/#round-func
 | 
					
						
							|  |  |  |         Round, | 
					
						
							|  |  |  |         Mod, | 
					
						
							|  |  |  |         Rem, | 
					
						
							| 
									
										
										
										
											2023-04-11 15:48:06 +01:00
										 |  |  |     }; | 
					
						
							| 
									
										
										
										
											2024-12-11 15:05:56 +00:00
										 |  |  |     using NumericValue = CalculatedStyleValue::CalculationResult::Value; | 
					
						
							| 
									
										
										
										
											2023-04-11 15:48:06 +01:00
										 |  |  | 
 | 
					
						
							|  |  |  |     virtual ~CalculationNode(); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     Type type() const { return m_type; } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2023-07-04 16:08:19 +01:00
										 |  |  |     // https://www.w3.org/TR/css-values-4/#calculation-tree-operator-nodes
 | 
					
						
							| 
									
										
										
										
											2023-04-11 15:48:06 +01:00
										 |  |  |     bool is_operator_node() const | 
					
						
							|  |  |  |     { | 
					
						
							| 
									
										
										
										
											2023-07-04 16:08:19 +01:00
										 |  |  |         return is_calc_operator_node() || is_math_function_node(); | 
					
						
							| 
									
										
										
										
											2023-04-11 15:48:06 +01:00
										 |  |  |     } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2023-07-04 16:08:19 +01:00
										 |  |  |     bool is_math_function_node() const | 
					
						
							|  |  |  |     { | 
					
						
							|  |  |  |         switch (m_type) { | 
					
						
							|  |  |  |         case Type::Min: | 
					
						
							|  |  |  |         case Type::Max: | 
					
						
							|  |  |  |         case Type::Clamp: | 
					
						
							|  |  |  |         case Type::Abs: | 
					
						
							|  |  |  |         case Type::Sign: | 
					
						
							|  |  |  |         case Type::Sin: | 
					
						
							|  |  |  |         case Type::Cos: | 
					
						
							|  |  |  |         case Type::Tan: | 
					
						
							|  |  |  |         case Type::Asin: | 
					
						
							|  |  |  |         case Type::Acos: | 
					
						
							|  |  |  |         case Type::Atan: | 
					
						
							|  |  |  |         case Type::Atan2: | 
					
						
							|  |  |  |         case Type::Pow: | 
					
						
							|  |  |  |         case Type::Sqrt: | 
					
						
							|  |  |  |         case Type::Hypot: | 
					
						
							|  |  |  |         case Type::Log: | 
					
						
							|  |  |  |         case Type::Exp: | 
					
						
							|  |  |  |         case Type::Round: | 
					
						
							|  |  |  |         case Type::Mod: | 
					
						
							|  |  |  |         case Type::Rem: | 
					
						
							|  |  |  |             return true; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |         default: | 
					
						
							|  |  |  |             return false; | 
					
						
							|  |  |  |         } | 
					
						
							|  |  |  |     } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     // https://www.w3.org/TR/css-values-4/#calculation-tree-calc-operator-nodes
 | 
					
						
							| 
									
										
										
										
											2023-04-11 15:48:06 +01:00
										 |  |  |     bool is_calc_operator_node() const | 
					
						
							|  |  |  |     { | 
					
						
							|  |  |  |         return first_is_one_of(m_type, Type::Sum, Type::Product, Type::Negate, Type::Invert); | 
					
						
							|  |  |  |     } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2025-02-26 14:08:20 +00:00
										 |  |  |     StringView name() const; | 
					
						
							| 
									
										
										
										
											2025-04-15 15:21:37 -06:00
										 |  |  |     virtual Vector<NonnullRefPtr<CalculationNode const>> children() const = 0; | 
					
						
							| 
									
										
										
										
											2025-02-26 14:08:20 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2025-08-15 12:55:58 +01:00
										 |  |  |     Optional<NumericType> const& numeric_type() const { return m_numeric_type; } | 
					
						
							| 
									
										
										
										
											2023-04-11 15:48:06 +01:00
										 |  |  |     virtual bool contains_percentage() const = 0; | 
					
						
							| 
									
										
										
											
												LibWeb/CSS: Wrap calc()-resolution data in a struct
Initially I added this to the existing CalculationContext, but in
reality, we have some data at parse-time and different data at
resolve-time, so it made more sense to keep those separate.
Instead of needing a variety of methods for resolving a Foo, depending
on whether we have a Layout::Node available, or a percentage basis, or
a length resolution context... put those in a
CalculationResolutionContext, and just pass that one thing to these
methods. This also removes the need for separate resolve_*_percentage()
methods, because we can just pass the percentage basis in to the regular
resolve_foo() method.
This also corrects the issue that *any* calculation may need to resolve
lengths, but we previously only passed a length resolution context to
specific types in some situations. Now, they can all have one available,
though it's up to the caller to provide it.
											
										 
											2025-01-22 16:05:32 +00:00
										 |  |  |     virtual CalculatedStyleValue::CalculationResult resolve(CalculationResolutionContext const&) const = 0; | 
					
						
							| 
									
										
										
										
											2025-04-15 15:21:37 -06:00
										 |  |  |     virtual NonnullRefPtr<CalculationNode const> with_simplified_children(CalculationContext const&, CalculationResolutionContext const&) const = 0; | 
					
						
							|  |  |  |     // Step 4 of simpliRfy_a_calculation_tree(). Only valid for math-function nodes.
 | 
					
						
							| 
									
										
										
										
											2025-01-23 17:02:32 +00:00
										 |  |  |     virtual Optional<CalculatedStyleValue::CalculationResult> run_operation_if_possible(CalculationContext const&, CalculationResolutionContext const&) const { VERIFY_NOT_REACHED(); } | 
					
						
							| 
									
										
										
										
											2024-12-18 13:15:26 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2023-08-22 14:13:22 +01:00
										 |  |  |     virtual void dump(StringBuilder&, int indent) const = 0; | 
					
						
							| 
									
										
										
										
											2024-01-09 12:41:43 +01:00
										 |  |  |     virtual bool equals(CalculationNode const&) const = 0; | 
					
						
							| 
									
										
										
										
											2025-08-22 11:10:24 +01:00
										 |  |  |     virtual GC::Ptr<CSSNumericValue> reify(JS::Realm&) const { return nullptr; } | 
					
						
							| 
									
										
										
										
											2023-04-11 15:48:06 +01:00
										 |  |  | 
 | 
					
						
							|  |  |  | protected: | 
					
						
							| 
									
										
										
										
											2025-08-15 12:55:58 +01:00
										 |  |  |     CalculationNode(Type, Optional<NumericType>); | 
					
						
							| 
									
										
										
										
											2023-04-11 15:48:06 +01:00
										 |  |  | 
 | 
					
						
							|  |  |  | private: | 
					
						
							|  |  |  |     Type m_type; | 
					
						
							| 
									
										
										
										
											2025-08-15 12:55:58 +01:00
										 |  |  |     Optional<NumericType> m_numeric_type; | 
					
						
							| 
									
										
										
										
											2023-04-11 15:48:06 +01:00
										 |  |  | }; | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2025-02-26 14:08:20 +00:00
										 |  |  | enum class NonFiniteValue { | 
					
						
							|  |  |  |     Infinity, | 
					
						
							|  |  |  |     NegativeInfinity, | 
					
						
							|  |  |  |     NaN, | 
					
						
							|  |  |  | }; | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2023-04-11 15:48:06 +01:00
										 |  |  | class NumericCalculationNode final : public CalculationNode { | 
					
						
							|  |  |  | public: | 
					
						
							| 
									
										
										
										
											2025-04-15 15:21:37 -06:00
										 |  |  |     static NonnullRefPtr<NumericCalculationNode const> create(NumericValue, CalculationContext const&); | 
					
						
							|  |  |  |     static RefPtr<NumericCalculationNode const> from_keyword(Keyword, CalculationContext const&); | 
					
						
							| 
									
										
										
										
											2023-04-11 15:48:06 +01:00
										 |  |  |     ~NumericCalculationNode(); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     virtual bool contains_percentage() const override; | 
					
						
							| 
									
										
										
										
											2025-01-23 17:02:32 +00:00
										 |  |  |     bool is_in_canonical_unit() const; | 
					
						
							| 
									
										
										
											
												LibWeb/CSS: Wrap calc()-resolution data in a struct
Initially I added this to the existing CalculationContext, but in
reality, we have some data at parse-time and different data at
resolve-time, so it made more sense to keep those separate.
Instead of needing a variety of methods for resolving a Foo, depending
on whether we have a Layout::Node available, or a percentage basis, or
a length resolution context... put those in a
CalculationResolutionContext, and just pass that one thing to these
methods. This also removes the need for separate resolve_*_percentage()
methods, because we can just pass the percentage basis in to the regular
resolve_foo() method.
This also corrects the issue that *any* calculation may need to resolve
lengths, but we previously only passed a length resolution context to
specific types in some situations. Now, they can all have one available,
though it's up to the caller to provide it.
											
										 
											2025-01-22 16:05:32 +00:00
										 |  |  |     virtual CalculatedStyleValue::CalculationResult resolve(CalculationResolutionContext const&) const override; | 
					
						
							| 
									
										
										
										
											2025-04-15 15:21:37 -06:00
										 |  |  |     virtual NonnullRefPtr<CalculationNode const> with_simplified_children(CalculationContext const&, CalculationResolutionContext const&) const override { return *this; } | 
					
						
							| 
									
										
										
										
											2025-01-23 17:02:32 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2025-08-08 10:11:51 +01:00
										 |  |  |     RefPtr<StyleValue const> to_style_value(CalculationContext const&) const; | 
					
						
							| 
									
										
										
										
											2025-01-28 16:24:39 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2025-04-15 15:21:37 -06:00
										 |  |  |     virtual Vector<NonnullRefPtr<CalculationNode const>> children() const override { return {}; } | 
					
						
							| 
									
										
										
										
											2025-01-23 17:02:32 +00:00
										 |  |  |     NumericValue const& value() const { return m_value; } | 
					
						
							| 
									
										
										
										
											2025-02-27 14:07:04 +00:00
										 |  |  |     String value_to_string() const; | 
					
						
							| 
									
										
										
										
											2024-12-18 13:15:26 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2025-02-26 14:08:20 +00:00
										 |  |  |     Optional<NonFiniteValue> infinite_or_nan_value() const; | 
					
						
							|  |  |  |     bool is_negative() const; | 
					
						
							| 
									
										
										
										
											2025-04-15 15:21:37 -06:00
										 |  |  |     NonnullRefPtr<NumericCalculationNode const> negated(CalculationContext const&) const; | 
					
						
							| 
									
										
										
										
											2025-02-26 14:08:20 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2023-08-22 14:13:22 +01:00
										 |  |  |     virtual void dump(StringBuilder&, int indent) const override; | 
					
						
							| 
									
										
										
										
											2024-01-09 12:41:43 +01:00
										 |  |  |     virtual bool equals(CalculationNode const&) const override; | 
					
						
							| 
									
										
										
										
											2025-08-22 11:10:24 +01:00
										 |  |  |     virtual GC::Ptr<CSSNumericValue> reify(JS::Realm&) const override; | 
					
						
							| 
									
										
										
										
											2023-04-11 15:48:06 +01:00
										 |  |  | 
 | 
					
						
							|  |  |  | private: | 
					
						
							| 
									
										
										
										
											2025-08-15 12:55:58 +01:00
										 |  |  |     NumericCalculationNode(NumericValue, NumericType); | 
					
						
							| 
									
										
										
										
											2023-04-11 15:48:06 +01:00
										 |  |  |     NumericValue m_value; | 
					
						
							|  |  |  | }; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | class SumCalculationNode final : public CalculationNode { | 
					
						
							|  |  |  | public: | 
					
						
							| 
									
										
										
										
											2025-04-15 15:21:37 -06:00
										 |  |  |     static NonnullRefPtr<SumCalculationNode const> create(Vector<NonnullRefPtr<CalculationNode const>>); | 
					
						
							| 
									
										
										
										
											2023-04-11 15:48:06 +01:00
										 |  |  |     ~SumCalculationNode(); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     virtual bool contains_percentage() const override; | 
					
						
							| 
									
										
										
											
												LibWeb/CSS: Wrap calc()-resolution data in a struct
Initially I added this to the existing CalculationContext, but in
reality, we have some data at parse-time and different data at
resolve-time, so it made more sense to keep those separate.
Instead of needing a variety of methods for resolving a Foo, depending
on whether we have a Layout::Node available, or a percentage basis, or
a length resolution context... put those in a
CalculationResolutionContext, and just pass that one thing to these
methods. This also removes the need for separate resolve_*_percentage()
methods, because we can just pass the percentage basis in to the regular
resolve_foo() method.
This also corrects the issue that *any* calculation may need to resolve
lengths, but we previously only passed a length resolution context to
specific types in some situations. Now, they can all have one available,
though it's up to the caller to provide it.
											
										 
											2025-01-22 16:05:32 +00:00
										 |  |  |     virtual CalculatedStyleValue::CalculationResult resolve(CalculationResolutionContext const&) const override; | 
					
						
							| 
									
										
										
										
											2025-04-15 15:21:37 -06:00
										 |  |  |     virtual NonnullRefPtr<CalculationNode const> with_simplified_children(CalculationContext const&, CalculationResolutionContext const&) const override; | 
					
						
							| 
									
										
										
										
											2025-01-23 17:02:32 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2025-04-15 15:21:37 -06:00
										 |  |  |     virtual Vector<NonnullRefPtr<CalculationNode const>> children() const override { return m_values; } | 
					
						
							| 
									
										
										
										
											2024-12-18 13:15:26 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2023-08-22 14:13:22 +01:00
										 |  |  |     virtual void dump(StringBuilder&, int indent) const override; | 
					
						
							| 
									
										
										
										
											2024-01-09 12:41:43 +01:00
										 |  |  |     virtual bool equals(CalculationNode const&) const override; | 
					
						
							| 
									
										
										
										
											2025-08-22 11:10:24 +01:00
										 |  |  |     virtual GC::Ptr<CSSNumericValue> reify(JS::Realm&) const override; | 
					
						
							| 
									
										
										
										
											2023-04-11 15:48:06 +01:00
										 |  |  | 
 | 
					
						
							|  |  |  | private: | 
					
						
							| 
									
										
										
										
											2025-08-15 12:55:58 +01:00
										 |  |  |     SumCalculationNode(Vector<NonnullRefPtr<CalculationNode const>>, Optional<NumericType>); | 
					
						
							| 
									
										
										
										
											2025-04-15 15:21:37 -06:00
										 |  |  |     Vector<NonnullRefPtr<CalculationNode const>> m_values; | 
					
						
							| 
									
										
										
										
											2023-04-11 15:48:06 +01:00
										 |  |  | }; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | class ProductCalculationNode final : public CalculationNode { | 
					
						
							|  |  |  | public: | 
					
						
							| 
									
										
										
										
											2025-04-15 15:21:37 -06:00
										 |  |  |     static NonnullRefPtr<ProductCalculationNode const> create(Vector<NonnullRefPtr<CalculationNode const>>); | 
					
						
							| 
									
										
										
										
											2023-04-11 15:48:06 +01:00
										 |  |  |     ~ProductCalculationNode(); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     virtual bool contains_percentage() const override; | 
					
						
							| 
									
										
										
											
												LibWeb/CSS: Wrap calc()-resolution data in a struct
Initially I added this to the existing CalculationContext, but in
reality, we have some data at parse-time and different data at
resolve-time, so it made more sense to keep those separate.
Instead of needing a variety of methods for resolving a Foo, depending
on whether we have a Layout::Node available, or a percentage basis, or
a length resolution context... put those in a
CalculationResolutionContext, and just pass that one thing to these
methods. This also removes the need for separate resolve_*_percentage()
methods, because we can just pass the percentage basis in to the regular
resolve_foo() method.
This also corrects the issue that *any* calculation may need to resolve
lengths, but we previously only passed a length resolution context to
specific types in some situations. Now, they can all have one available,
though it's up to the caller to provide it.
											
										 
											2025-01-22 16:05:32 +00:00
										 |  |  |     virtual CalculatedStyleValue::CalculationResult resolve(CalculationResolutionContext const&) const override; | 
					
						
							| 
									
										
										
										
											2025-04-15 15:21:37 -06:00
										 |  |  |     virtual NonnullRefPtr<CalculationNode const> with_simplified_children(CalculationContext const&, CalculationResolutionContext const&) const override; | 
					
						
							| 
									
										
										
										
											2025-01-23 17:02:32 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2025-04-15 15:21:37 -06:00
										 |  |  |     virtual Vector<NonnullRefPtr<CalculationNode const>> children() const override { return m_values; } | 
					
						
							| 
									
										
										
										
											2024-12-18 13:15:26 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2023-08-22 14:13:22 +01:00
										 |  |  |     virtual void dump(StringBuilder&, int indent) const override; | 
					
						
							| 
									
										
										
										
											2024-01-09 12:41:43 +01:00
										 |  |  |     virtual bool equals(CalculationNode const&) const override; | 
					
						
							| 
									
										
										
										
											2025-08-22 11:10:24 +01:00
										 |  |  |     virtual GC::Ptr<CSSNumericValue> reify(JS::Realm&) const override; | 
					
						
							| 
									
										
										
										
											2023-04-11 15:48:06 +01:00
										 |  |  | 
 | 
					
						
							|  |  |  | private: | 
					
						
							| 
									
										
										
										
											2025-08-15 12:55:58 +01:00
										 |  |  |     ProductCalculationNode(Vector<NonnullRefPtr<CalculationNode const>>, Optional<NumericType>); | 
					
						
							| 
									
										
										
										
											2025-04-15 15:21:37 -06:00
										 |  |  |     Vector<NonnullRefPtr<CalculationNode const>> m_values; | 
					
						
							| 
									
										
										
										
											2023-04-11 15:48:06 +01:00
										 |  |  | }; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | class NegateCalculationNode final : public CalculationNode { | 
					
						
							|  |  |  | public: | 
					
						
							| 
									
										
										
										
											2025-04-15 15:21:37 -06:00
										 |  |  |     static NonnullRefPtr<NegateCalculationNode const> create(NonnullRefPtr<CalculationNode const>); | 
					
						
							| 
									
										
										
										
											2023-04-11 15:48:06 +01:00
										 |  |  |     ~NegateCalculationNode(); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     virtual bool contains_percentage() const override; | 
					
						
							| 
									
										
										
											
												LibWeb/CSS: Wrap calc()-resolution data in a struct
Initially I added this to the existing CalculationContext, but in
reality, we have some data at parse-time and different data at
resolve-time, so it made more sense to keep those separate.
Instead of needing a variety of methods for resolving a Foo, depending
on whether we have a Layout::Node available, or a percentage basis, or
a length resolution context... put those in a
CalculationResolutionContext, and just pass that one thing to these
methods. This also removes the need for separate resolve_*_percentage()
methods, because we can just pass the percentage basis in to the regular
resolve_foo() method.
This also corrects the issue that *any* calculation may need to resolve
lengths, but we previously only passed a length resolution context to
specific types in some situations. Now, they can all have one available,
though it's up to the caller to provide it.
											
										 
											2025-01-22 16:05:32 +00:00
										 |  |  |     virtual CalculatedStyleValue::CalculationResult resolve(CalculationResolutionContext const&) const override; | 
					
						
							| 
									
										
										
										
											2025-04-15 15:21:37 -06:00
										 |  |  |     virtual NonnullRefPtr<CalculationNode const> with_simplified_children(CalculationContext const&, CalculationResolutionContext const&) const override; | 
					
						
							| 
									
										
										
										
											2025-01-23 17:02:32 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2025-04-15 15:21:37 -06:00
										 |  |  |     virtual Vector<NonnullRefPtr<CalculationNode const>> children() const override { return { { m_value } }; } | 
					
						
							| 
									
										
										
										
											2025-01-23 17:02:32 +00:00
										 |  |  |     CalculationNode const& child() const { return m_value; } | 
					
						
							| 
									
										
										
										
											2024-12-18 13:15:26 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2023-08-22 14:13:22 +01:00
										 |  |  |     virtual void dump(StringBuilder&, int indent) const override; | 
					
						
							| 
									
										
										
										
											2024-01-09 12:41:43 +01:00
										 |  |  |     virtual bool equals(CalculationNode const&) const override; | 
					
						
							| 
									
										
										
										
											2025-08-22 11:10:24 +01:00
										 |  |  |     virtual GC::Ptr<CSSNumericValue> reify(JS::Realm&) const override; | 
					
						
							| 
									
										
										
										
											2023-04-11 15:48:06 +01:00
										 |  |  | 
 | 
					
						
							|  |  |  | private: | 
					
						
							| 
									
										
										
										
											2025-04-15 15:21:37 -06:00
										 |  |  |     explicit NegateCalculationNode(NonnullRefPtr<CalculationNode const>); | 
					
						
							|  |  |  |     NonnullRefPtr<CalculationNode const> m_value; | 
					
						
							| 
									
										
										
										
											2023-04-11 15:48:06 +01:00
										 |  |  | }; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | class InvertCalculationNode final : public CalculationNode { | 
					
						
							|  |  |  | public: | 
					
						
							| 
									
										
										
										
											2025-04-15 15:21:37 -06:00
										 |  |  |     static NonnullRefPtr<InvertCalculationNode const> create(NonnullRefPtr<CalculationNode const>); | 
					
						
							| 
									
										
										
										
											2023-04-11 15:48:06 +01:00
										 |  |  |     ~InvertCalculationNode(); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     virtual bool contains_percentage() const override; | 
					
						
							| 
									
										
										
											
												LibWeb/CSS: Wrap calc()-resolution data in a struct
Initially I added this to the existing CalculationContext, but in
reality, we have some data at parse-time and different data at
resolve-time, so it made more sense to keep those separate.
Instead of needing a variety of methods for resolving a Foo, depending
on whether we have a Layout::Node available, or a percentage basis, or
a length resolution context... put those in a
CalculationResolutionContext, and just pass that one thing to these
methods. This also removes the need for separate resolve_*_percentage()
methods, because we can just pass the percentage basis in to the regular
resolve_foo() method.
This also corrects the issue that *any* calculation may need to resolve
lengths, but we previously only passed a length resolution context to
specific types in some situations. Now, they can all have one available,
though it's up to the caller to provide it.
											
										 
											2025-01-22 16:05:32 +00:00
										 |  |  |     virtual CalculatedStyleValue::CalculationResult resolve(CalculationResolutionContext const&) const override; | 
					
						
							| 
									
										
										
										
											2025-04-15 15:21:37 -06:00
										 |  |  |     virtual NonnullRefPtr<CalculationNode const> with_simplified_children(CalculationContext const&, CalculationResolutionContext const&) const override; | 
					
						
							| 
									
										
										
										
											2025-01-23 17:02:32 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2025-04-15 15:21:37 -06:00
										 |  |  |     virtual Vector<NonnullRefPtr<CalculationNode const>> children() const override { return { { m_value } }; } | 
					
						
							| 
									
										
										
										
											2025-01-23 17:02:32 +00:00
										 |  |  |     CalculationNode const& child() const { return m_value; } | 
					
						
							| 
									
										
										
										
											2024-12-18 13:15:26 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2023-08-22 14:13:22 +01:00
										 |  |  |     virtual void dump(StringBuilder&, int indent) const override; | 
					
						
							| 
									
										
										
										
											2024-01-09 12:41:43 +01:00
										 |  |  |     virtual bool equals(CalculationNode const&) const override; | 
					
						
							| 
									
										
										
										
											2025-08-22 11:10:24 +01:00
										 |  |  |     virtual GC::Ptr<CSSNumericValue> reify(JS::Realm&) const override; | 
					
						
							| 
									
										
										
										
											2023-04-11 15:48:06 +01:00
										 |  |  | 
 | 
					
						
							|  |  |  | private: | 
					
						
							| 
									
										
										
										
											2025-08-15 12:55:58 +01:00
										 |  |  |     InvertCalculationNode(NonnullRefPtr<CalculationNode const>, Optional<NumericType>); | 
					
						
							| 
									
										
										
										
											2025-04-15 15:21:37 -06:00
										 |  |  |     NonnullRefPtr<CalculationNode const> m_value; | 
					
						
							| 
									
										
										
										
											2023-03-30 17:34:14 +01:00
										 |  |  | }; | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2023-05-26 11:21:49 +02:00
										 |  |  | class MinCalculationNode final : public CalculationNode { | 
					
						
							|  |  |  | public: | 
					
						
							| 
									
										
										
										
											2025-04-15 15:21:37 -06:00
										 |  |  |     static NonnullRefPtr<MinCalculationNode const> create(Vector<NonnullRefPtr<CalculationNode const>>); | 
					
						
							| 
									
										
										
										
											2023-05-26 11:21:49 +02:00
										 |  |  |     ~MinCalculationNode(); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     virtual bool contains_percentage() const override; | 
					
						
							| 
									
										
										
											
												LibWeb/CSS: Wrap calc()-resolution data in a struct
Initially I added this to the existing CalculationContext, but in
reality, we have some data at parse-time and different data at
resolve-time, so it made more sense to keep those separate.
Instead of needing a variety of methods for resolving a Foo, depending
on whether we have a Layout::Node available, or a percentage basis, or
a length resolution context... put those in a
CalculationResolutionContext, and just pass that one thing to these
methods. This also removes the need for separate resolve_*_percentage()
methods, because we can just pass the percentage basis in to the regular
resolve_foo() method.
This also corrects the issue that *any* calculation may need to resolve
lengths, but we previously only passed a length resolution context to
specific types in some situations. Now, they can all have one available,
though it's up to the caller to provide it.
											
										 
											2025-01-22 16:05:32 +00:00
										 |  |  |     virtual CalculatedStyleValue::CalculationResult resolve(CalculationResolutionContext const&) const override; | 
					
						
							| 
									
										
										
										
											2025-04-15 15:21:37 -06:00
										 |  |  |     virtual NonnullRefPtr<CalculationNode const> with_simplified_children(CalculationContext const&, CalculationResolutionContext const&) const override; | 
					
						
							| 
									
										
										
										
											2025-01-23 17:02:32 +00:00
										 |  |  |     virtual Optional<CalculatedStyleValue::CalculationResult> run_operation_if_possible(CalculationContext const&, CalculationResolutionContext const&) const override; | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2025-04-15 15:21:37 -06:00
										 |  |  |     virtual Vector<NonnullRefPtr<CalculationNode const>> children() const override { return m_values; } | 
					
						
							| 
									
										
										
										
											2023-05-26 11:21:49 +02:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2023-08-22 14:13:22 +01:00
										 |  |  |     virtual void dump(StringBuilder&, int indent) const override; | 
					
						
							| 
									
										
										
										
											2024-01-09 12:41:43 +01:00
										 |  |  |     virtual bool equals(CalculationNode const&) const override; | 
					
						
							| 
									
										
										
										
											2025-08-22 11:10:24 +01:00
										 |  |  |     virtual GC::Ptr<CSSNumericValue> reify(JS::Realm&) const override; | 
					
						
							| 
									
										
										
										
											2023-05-26 11:21:49 +02:00
										 |  |  | 
 | 
					
						
							|  |  |  | private: | 
					
						
							| 
									
										
										
										
											2025-08-15 12:55:58 +01:00
										 |  |  |     MinCalculationNode(Vector<NonnullRefPtr<CalculationNode const>>, Optional<NumericType>); | 
					
						
							| 
									
										
										
										
											2025-04-15 15:21:37 -06:00
										 |  |  |     Vector<NonnullRefPtr<CalculationNode const>> m_values; | 
					
						
							| 
									
										
										
										
											2023-05-26 11:21:49 +02:00
										 |  |  | }; | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2023-05-26 15:00:22 +02:00
										 |  |  | class MaxCalculationNode final : public CalculationNode { | 
					
						
							|  |  |  | public: | 
					
						
							| 
									
										
										
										
											2025-04-15 15:21:37 -06:00
										 |  |  |     static NonnullRefPtr<MaxCalculationNode const> create(Vector<NonnullRefPtr<CalculationNode const>>); | 
					
						
							| 
									
										
										
										
											2023-05-26 15:00:22 +02:00
										 |  |  |     ~MaxCalculationNode(); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     virtual bool contains_percentage() const override; | 
					
						
							| 
									
										
										
											
												LibWeb/CSS: Wrap calc()-resolution data in a struct
Initially I added this to the existing CalculationContext, but in
reality, we have some data at parse-time and different data at
resolve-time, so it made more sense to keep those separate.
Instead of needing a variety of methods for resolving a Foo, depending
on whether we have a Layout::Node available, or a percentage basis, or
a length resolution context... put those in a
CalculationResolutionContext, and just pass that one thing to these
methods. This also removes the need for separate resolve_*_percentage()
methods, because we can just pass the percentage basis in to the regular
resolve_foo() method.
This also corrects the issue that *any* calculation may need to resolve
lengths, but we previously only passed a length resolution context to
specific types in some situations. Now, they can all have one available,
though it's up to the caller to provide it.
											
										 
											2025-01-22 16:05:32 +00:00
										 |  |  |     virtual CalculatedStyleValue::CalculationResult resolve(CalculationResolutionContext const&) const override; | 
					
						
							| 
									
										
										
										
											2025-04-15 15:21:37 -06:00
										 |  |  |     virtual NonnullRefPtr<CalculationNode const> with_simplified_children(CalculationContext const&, CalculationResolutionContext const&) const override; | 
					
						
							| 
									
										
										
										
											2025-01-23 17:02:32 +00:00
										 |  |  |     virtual Optional<CalculatedStyleValue::CalculationResult> run_operation_if_possible(CalculationContext const&, CalculationResolutionContext const&) const override; | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2025-04-15 15:21:37 -06:00
										 |  |  |     virtual Vector<NonnullRefPtr<CalculationNode const>> children() const override { return m_values; } | 
					
						
							| 
									
										
										
										
											2024-12-18 13:15:26 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2023-08-22 14:13:22 +01:00
										 |  |  |     virtual void dump(StringBuilder&, int indent) const override; | 
					
						
							| 
									
										
										
										
											2024-01-09 12:41:43 +01:00
										 |  |  |     virtual bool equals(CalculationNode const&) const override; | 
					
						
							| 
									
										
										
										
											2025-08-22 11:10:24 +01:00
										 |  |  |     virtual GC::Ptr<CSSNumericValue> reify(JS::Realm&) const override; | 
					
						
							| 
									
										
										
										
											2023-05-26 15:00:22 +02:00
										 |  |  | 
 | 
					
						
							|  |  |  | private: | 
					
						
							| 
									
										
										
										
											2025-08-15 12:55:58 +01:00
										 |  |  |     MaxCalculationNode(Vector<NonnullRefPtr<CalculationNode const>>, Optional<NumericType>); | 
					
						
							| 
									
										
										
										
											2025-04-15 15:21:37 -06:00
										 |  |  |     Vector<NonnullRefPtr<CalculationNode const>> m_values; | 
					
						
							| 
									
										
										
										
											2023-05-26 15:00:22 +02:00
										 |  |  | }; | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2023-05-26 15:40:39 +02:00
										 |  |  | class ClampCalculationNode final : public CalculationNode { | 
					
						
							|  |  |  | public: | 
					
						
							| 
									
										
										
										
											2025-04-15 15:21:37 -06:00
										 |  |  |     static NonnullRefPtr<ClampCalculationNode const> create(NonnullRefPtr<CalculationNode const>, NonnullRefPtr<CalculationNode const>, NonnullRefPtr<CalculationNode const>); | 
					
						
							| 
									
										
										
										
											2023-05-26 15:40:39 +02:00
										 |  |  |     ~ClampCalculationNode(); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     virtual bool contains_percentage() const override; | 
					
						
							| 
									
										
										
											
												LibWeb/CSS: Wrap calc()-resolution data in a struct
Initially I added this to the existing CalculationContext, but in
reality, we have some data at parse-time and different data at
resolve-time, so it made more sense to keep those separate.
Instead of needing a variety of methods for resolving a Foo, depending
on whether we have a Layout::Node available, or a percentage basis, or
a length resolution context... put those in a
CalculationResolutionContext, and just pass that one thing to these
methods. This also removes the need for separate resolve_*_percentage()
methods, because we can just pass the percentage basis in to the regular
resolve_foo() method.
This also corrects the issue that *any* calculation may need to resolve
lengths, but we previously only passed a length resolution context to
specific types in some situations. Now, they can all have one available,
though it's up to the caller to provide it.
											
										 
											2025-01-22 16:05:32 +00:00
										 |  |  |     virtual CalculatedStyleValue::CalculationResult resolve(CalculationResolutionContext const&) const override; | 
					
						
							| 
									
										
										
										
											2025-04-15 15:21:37 -06:00
										 |  |  |     virtual NonnullRefPtr<CalculationNode const> with_simplified_children(CalculationContext const&, CalculationResolutionContext const&) const override; | 
					
						
							| 
									
										
										
										
											2025-01-23 17:02:32 +00:00
										 |  |  |     virtual Optional<CalculatedStyleValue::CalculationResult> run_operation_if_possible(CalculationContext const&, CalculationResolutionContext const&) const override; | 
					
						
							| 
									
										
										
										
											2023-05-26 15:40:39 +02:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2025-04-15 15:21:37 -06:00
										 |  |  |     virtual Vector<NonnullRefPtr<CalculationNode const>> children() const override { return { { m_min_value, m_center_value, m_max_value } }; } | 
					
						
							| 
									
										
										
										
											2025-02-26 14:08:20 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2023-08-22 14:13:22 +01:00
										 |  |  |     virtual void dump(StringBuilder&, int indent) const override; | 
					
						
							| 
									
										
										
										
											2024-01-09 12:41:43 +01:00
										 |  |  |     virtual bool equals(CalculationNode const&) const override; | 
					
						
							| 
									
										
										
										
											2025-08-22 11:10:24 +01:00
										 |  |  |     virtual GC::Ptr<CSSNumericValue> reify(JS::Realm&) const override; | 
					
						
							| 
									
										
										
										
											2023-05-26 15:40:39 +02:00
										 |  |  | 
 | 
					
						
							|  |  |  | private: | 
					
						
							| 
									
										
										
										
											2025-08-15 12:55:58 +01:00
										 |  |  |     ClampCalculationNode(NonnullRefPtr<CalculationNode const>, NonnullRefPtr<CalculationNode const>, NonnullRefPtr<CalculationNode const>, Optional<NumericType>); | 
					
						
							| 
									
										
										
										
											2025-04-15 15:21:37 -06:00
										 |  |  |     NonnullRefPtr<CalculationNode const> m_min_value; | 
					
						
							|  |  |  |     NonnullRefPtr<CalculationNode const> m_center_value; | 
					
						
							|  |  |  |     NonnullRefPtr<CalculationNode const> m_max_value; | 
					
						
							| 
									
										
										
										
											2023-05-26 15:40:39 +02:00
										 |  |  | }; | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2023-05-27 22:56:41 +02:00
										 |  |  | class AbsCalculationNode final : public CalculationNode { | 
					
						
							|  |  |  | public: | 
					
						
							| 
									
										
										
										
											2025-04-15 15:21:37 -06:00
										 |  |  |     static NonnullRefPtr<AbsCalculationNode const> create(NonnullRefPtr<CalculationNode const>); | 
					
						
							| 
									
										
										
										
											2023-05-27 22:56:41 +02:00
										 |  |  |     ~AbsCalculationNode(); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     virtual bool contains_percentage() const override; | 
					
						
							| 
									
										
										
											
												LibWeb/CSS: Wrap calc()-resolution data in a struct
Initially I added this to the existing CalculationContext, but in
reality, we have some data at parse-time and different data at
resolve-time, so it made more sense to keep those separate.
Instead of needing a variety of methods for resolving a Foo, depending
on whether we have a Layout::Node available, or a percentage basis, or
a length resolution context... put those in a
CalculationResolutionContext, and just pass that one thing to these
methods. This also removes the need for separate resolve_*_percentage()
methods, because we can just pass the percentage basis in to the regular
resolve_foo() method.
This also corrects the issue that *any* calculation may need to resolve
lengths, but we previously only passed a length resolution context to
specific types in some situations. Now, they can all have one available,
though it's up to the caller to provide it.
											
										 
											2025-01-22 16:05:32 +00:00
										 |  |  |     virtual CalculatedStyleValue::CalculationResult resolve(CalculationResolutionContext const&) const override; | 
					
						
							| 
									
										
										
										
											2025-04-15 15:21:37 -06:00
										 |  |  |     virtual NonnullRefPtr<CalculationNode const> with_simplified_children(CalculationContext const&, CalculationResolutionContext const&) const override; | 
					
						
							| 
									
										
										
										
											2025-01-23 17:02:32 +00:00
										 |  |  |     virtual Optional<CalculatedStyleValue::CalculationResult> run_operation_if_possible(CalculationContext const&, CalculationResolutionContext const&) const override; | 
					
						
							| 
									
										
										
										
											2023-05-27 22:56:41 +02:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2025-04-15 15:21:37 -06:00
										 |  |  |     virtual Vector<NonnullRefPtr<CalculationNode const>> children() const override { return { { m_value } }; } | 
					
						
							| 
									
										
										
										
											2025-02-26 14:08:20 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2023-08-22 14:13:22 +01:00
										 |  |  |     virtual void dump(StringBuilder&, int indent) const override; | 
					
						
							| 
									
										
										
										
											2024-01-09 12:41:43 +01:00
										 |  |  |     virtual bool equals(CalculationNode const&) const override; | 
					
						
							| 
									
										
										
										
											2023-05-27 22:56:41 +02:00
										 |  |  | 
 | 
					
						
							|  |  |  | private: | 
					
						
							| 
									
										
										
										
											2025-04-15 15:21:37 -06:00
										 |  |  |     explicit AbsCalculationNode(NonnullRefPtr<CalculationNode const>); | 
					
						
							|  |  |  |     NonnullRefPtr<CalculationNode const> m_value; | 
					
						
							| 
									
										
										
										
											2023-05-27 22:56:41 +02:00
										 |  |  | }; | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2023-05-27 23:02:39 +02:00
										 |  |  | class SignCalculationNode final : public CalculationNode { | 
					
						
							|  |  |  | public: | 
					
						
							| 
									
										
										
										
											2025-04-15 15:21:37 -06:00
										 |  |  |     static NonnullRefPtr<SignCalculationNode const> create(NonnullRefPtr<CalculationNode const>); | 
					
						
							| 
									
										
										
										
											2023-05-27 23:02:39 +02:00
										 |  |  |     ~SignCalculationNode(); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     virtual bool contains_percentage() const override; | 
					
						
							| 
									
										
										
											
												LibWeb/CSS: Wrap calc()-resolution data in a struct
Initially I added this to the existing CalculationContext, but in
reality, we have some data at parse-time and different data at
resolve-time, so it made more sense to keep those separate.
Instead of needing a variety of methods for resolving a Foo, depending
on whether we have a Layout::Node available, or a percentage basis, or
a length resolution context... put those in a
CalculationResolutionContext, and just pass that one thing to these
methods. This also removes the need for separate resolve_*_percentage()
methods, because we can just pass the percentage basis in to the regular
resolve_foo() method.
This also corrects the issue that *any* calculation may need to resolve
lengths, but we previously only passed a length resolution context to
specific types in some situations. Now, they can all have one available,
though it's up to the caller to provide it.
											
										 
											2025-01-22 16:05:32 +00:00
										 |  |  |     virtual CalculatedStyleValue::CalculationResult resolve(CalculationResolutionContext const&) const override; | 
					
						
							| 
									
										
										
										
											2025-04-15 15:21:37 -06:00
										 |  |  |     virtual NonnullRefPtr<CalculationNode const> with_simplified_children(CalculationContext const&, CalculationResolutionContext const&) const override; | 
					
						
							| 
									
										
										
										
											2025-01-23 17:02:32 +00:00
										 |  |  |     virtual Optional<CalculatedStyleValue::CalculationResult> run_operation_if_possible(CalculationContext const&, CalculationResolutionContext const&) const override; | 
					
						
							| 
									
										
										
										
											2023-05-27 23:02:39 +02:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2025-04-15 15:21:37 -06:00
										 |  |  |     virtual Vector<NonnullRefPtr<CalculationNode const>> children() const override { return { { m_value } }; } | 
					
						
							| 
									
										
										
										
											2025-02-26 14:08:20 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2023-08-22 14:13:22 +01:00
										 |  |  |     virtual void dump(StringBuilder&, int indent) const override; | 
					
						
							| 
									
										
										
										
											2024-01-09 12:41:43 +01:00
										 |  |  |     virtual bool equals(CalculationNode const&) const override; | 
					
						
							| 
									
										
										
										
											2023-05-27 23:02:39 +02:00
										 |  |  | 
 | 
					
						
							|  |  |  | private: | 
					
						
							| 
									
										
										
										
											2025-04-15 15:21:37 -06:00
										 |  |  |     explicit SignCalculationNode(NonnullRefPtr<CalculationNode const>); | 
					
						
							|  |  |  |     NonnullRefPtr<CalculationNode const> m_value; | 
					
						
							| 
									
										
										
										
											2023-05-27 23:02:39 +02:00
										 |  |  | }; | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2023-05-27 23:50:33 +02:00
										 |  |  | class SinCalculationNode final : public CalculationNode { | 
					
						
							|  |  |  | public: | 
					
						
							| 
									
										
										
										
											2025-04-15 15:21:37 -06:00
										 |  |  |     static NonnullRefPtr<SinCalculationNode const> create(NonnullRefPtr<CalculationNode const>); | 
					
						
							| 
									
										
										
										
											2023-05-27 23:50:33 +02:00
										 |  |  |     ~SinCalculationNode(); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     virtual bool contains_percentage() const override; | 
					
						
							| 
									
										
										
											
												LibWeb/CSS: Wrap calc()-resolution data in a struct
Initially I added this to the existing CalculationContext, but in
reality, we have some data at parse-time and different data at
resolve-time, so it made more sense to keep those separate.
Instead of needing a variety of methods for resolving a Foo, depending
on whether we have a Layout::Node available, or a percentage basis, or
a length resolution context... put those in a
CalculationResolutionContext, and just pass that one thing to these
methods. This also removes the need for separate resolve_*_percentage()
methods, because we can just pass the percentage basis in to the regular
resolve_foo() method.
This also corrects the issue that *any* calculation may need to resolve
lengths, but we previously only passed a length resolution context to
specific types in some situations. Now, they can all have one available,
though it's up to the caller to provide it.
											
										 
											2025-01-22 16:05:32 +00:00
										 |  |  |     virtual CalculatedStyleValue::CalculationResult resolve(CalculationResolutionContext const&) const override; | 
					
						
							| 
									
										
										
										
											2025-04-15 15:21:37 -06:00
										 |  |  |     virtual NonnullRefPtr<CalculationNode const> with_simplified_children(CalculationContext const&, CalculationResolutionContext const&) const override; | 
					
						
							| 
									
										
										
										
											2025-01-23 17:02:32 +00:00
										 |  |  |     virtual Optional<CalculatedStyleValue::CalculationResult> run_operation_if_possible(CalculationContext const&, CalculationResolutionContext const&) const override; | 
					
						
							| 
									
										
										
										
											2023-05-27 23:50:33 +02:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2025-04-15 15:21:37 -06:00
										 |  |  |     virtual Vector<NonnullRefPtr<CalculationNode const>> children() const override { return { { m_value } }; } | 
					
						
							| 
									
										
										
										
											2025-02-26 14:08:20 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2023-08-22 14:13:22 +01:00
										 |  |  |     virtual void dump(StringBuilder&, int indent) const override; | 
					
						
							| 
									
										
										
										
											2024-01-09 12:41:43 +01:00
										 |  |  |     virtual bool equals(CalculationNode const&) const override; | 
					
						
							| 
									
										
										
										
											2023-05-27 23:50:33 +02:00
										 |  |  | 
 | 
					
						
							|  |  |  | private: | 
					
						
							| 
									
										
										
										
											2025-04-15 15:21:37 -06:00
										 |  |  |     explicit SinCalculationNode(NonnullRefPtr<CalculationNode const>); | 
					
						
							|  |  |  |     NonnullRefPtr<CalculationNode const> m_value; | 
					
						
							| 
									
										
										
										
											2023-05-27 23:50:33 +02:00
										 |  |  | }; | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2023-05-27 23:57:01 +02:00
										 |  |  | class CosCalculationNode final : public CalculationNode { | 
					
						
							|  |  |  | public: | 
					
						
							| 
									
										
										
										
											2025-04-15 15:21:37 -06:00
										 |  |  |     static NonnullRefPtr<CosCalculationNode const> create(NonnullRefPtr<CalculationNode const>); | 
					
						
							| 
									
										
										
										
											2023-05-27 23:57:01 +02:00
										 |  |  |     ~CosCalculationNode(); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     virtual bool contains_percentage() const override; | 
					
						
							| 
									
										
										
											
												LibWeb/CSS: Wrap calc()-resolution data in a struct
Initially I added this to the existing CalculationContext, but in
reality, we have some data at parse-time and different data at
resolve-time, so it made more sense to keep those separate.
Instead of needing a variety of methods for resolving a Foo, depending
on whether we have a Layout::Node available, or a percentage basis, or
a length resolution context... put those in a
CalculationResolutionContext, and just pass that one thing to these
methods. This also removes the need for separate resolve_*_percentage()
methods, because we can just pass the percentage basis in to the regular
resolve_foo() method.
This also corrects the issue that *any* calculation may need to resolve
lengths, but we previously only passed a length resolution context to
specific types in some situations. Now, they can all have one available,
though it's up to the caller to provide it.
											
										 
											2025-01-22 16:05:32 +00:00
										 |  |  |     virtual CalculatedStyleValue::CalculationResult resolve(CalculationResolutionContext const&) const override; | 
					
						
							| 
									
										
										
										
											2025-04-15 15:21:37 -06:00
										 |  |  |     virtual NonnullRefPtr<CalculationNode const> with_simplified_children(CalculationContext const&, CalculationResolutionContext const&) const override; | 
					
						
							| 
									
										
										
										
											2025-01-23 17:02:32 +00:00
										 |  |  |     virtual Optional<CalculatedStyleValue::CalculationResult> run_operation_if_possible(CalculationContext const&, CalculationResolutionContext const&) const override; | 
					
						
							| 
									
										
										
										
											2023-05-27 23:57:01 +02:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2025-04-15 15:21:37 -06:00
										 |  |  |     virtual Vector<NonnullRefPtr<CalculationNode const>> children() const override { return { { m_value } }; } | 
					
						
							| 
									
										
										
										
											2025-02-26 14:08:20 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2023-08-22 14:13:22 +01:00
										 |  |  |     virtual void dump(StringBuilder&, int indent) const override; | 
					
						
							| 
									
										
										
										
											2024-01-09 12:41:43 +01:00
										 |  |  |     virtual bool equals(CalculationNode const&) const override; | 
					
						
							| 
									
										
										
										
											2023-05-27 23:57:01 +02:00
										 |  |  | 
 | 
					
						
							|  |  |  | private: | 
					
						
							| 
									
										
										
										
											2025-04-15 15:21:37 -06:00
										 |  |  |     explicit CosCalculationNode(NonnullRefPtr<CalculationNode const>); | 
					
						
							|  |  |  |     NonnullRefPtr<CalculationNode const> m_value; | 
					
						
							| 
									
										
										
										
											2023-05-27 23:57:01 +02:00
										 |  |  | }; | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2023-05-28 00:02:43 +02:00
										 |  |  | class TanCalculationNode final : public CalculationNode { | 
					
						
							|  |  |  | public: | 
					
						
							| 
									
										
										
										
											2025-04-15 15:21:37 -06:00
										 |  |  |     static NonnullRefPtr<TanCalculationNode const> create(NonnullRefPtr<CalculationNode const>); | 
					
						
							| 
									
										
										
										
											2023-05-28 00:02:43 +02:00
										 |  |  |     ~TanCalculationNode(); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     virtual bool contains_percentage() const override; | 
					
						
							| 
									
										
										
											
												LibWeb/CSS: Wrap calc()-resolution data in a struct
Initially I added this to the existing CalculationContext, but in
reality, we have some data at parse-time and different data at
resolve-time, so it made more sense to keep those separate.
Instead of needing a variety of methods for resolving a Foo, depending
on whether we have a Layout::Node available, or a percentage basis, or
a length resolution context... put those in a
CalculationResolutionContext, and just pass that one thing to these
methods. This also removes the need for separate resolve_*_percentage()
methods, because we can just pass the percentage basis in to the regular
resolve_foo() method.
This also corrects the issue that *any* calculation may need to resolve
lengths, but we previously only passed a length resolution context to
specific types in some situations. Now, they can all have one available,
though it's up to the caller to provide it.
											
										 
											2025-01-22 16:05:32 +00:00
										 |  |  |     virtual CalculatedStyleValue::CalculationResult resolve(CalculationResolutionContext const&) const override; | 
					
						
							| 
									
										
										
										
											2025-04-15 15:21:37 -06:00
										 |  |  |     virtual NonnullRefPtr<CalculationNode const> with_simplified_children(CalculationContext const&, CalculationResolutionContext const&) const override; | 
					
						
							| 
									
										
										
										
											2025-01-23 17:02:32 +00:00
										 |  |  |     virtual Optional<CalculatedStyleValue::CalculationResult> run_operation_if_possible(CalculationContext const&, CalculationResolutionContext const&) const override; | 
					
						
							| 
									
										
										
										
											2023-05-28 00:02:43 +02:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2025-04-15 15:21:37 -06:00
										 |  |  |     virtual Vector<NonnullRefPtr<CalculationNode const>> children() const override { return { { m_value } }; } | 
					
						
							| 
									
										
										
										
											2025-02-26 14:08:20 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2023-08-22 14:13:22 +01:00
										 |  |  |     virtual void dump(StringBuilder&, int indent) const override; | 
					
						
							| 
									
										
										
										
											2024-01-09 12:41:43 +01:00
										 |  |  |     virtual bool equals(CalculationNode const&) const override; | 
					
						
							| 
									
										
										
										
											2023-05-28 00:02:43 +02:00
										 |  |  | 
 | 
					
						
							|  |  |  | private: | 
					
						
							| 
									
										
										
										
											2025-04-15 15:21:37 -06:00
										 |  |  |     explicit TanCalculationNode(NonnullRefPtr<CalculationNode const>); | 
					
						
							|  |  |  |     NonnullRefPtr<CalculationNode const> m_value; | 
					
						
							| 
									
										
										
										
											2023-05-28 00:02:43 +02:00
										 |  |  | }; | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2023-05-28 10:55:52 +02:00
										 |  |  | class AsinCalculationNode final : public CalculationNode { | 
					
						
							|  |  |  | public: | 
					
						
							| 
									
										
										
										
											2025-04-15 15:21:37 -06:00
										 |  |  |     static NonnullRefPtr<AsinCalculationNode const> create(NonnullRefPtr<CalculationNode const>); | 
					
						
							| 
									
										
										
										
											2023-05-28 10:55:52 +02:00
										 |  |  |     ~AsinCalculationNode(); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     virtual bool contains_percentage() const override; | 
					
						
							| 
									
										
										
											
												LibWeb/CSS: Wrap calc()-resolution data in a struct
Initially I added this to the existing CalculationContext, but in
reality, we have some data at parse-time and different data at
resolve-time, so it made more sense to keep those separate.
Instead of needing a variety of methods for resolving a Foo, depending
on whether we have a Layout::Node available, or a percentage basis, or
a length resolution context... put those in a
CalculationResolutionContext, and just pass that one thing to these
methods. This also removes the need for separate resolve_*_percentage()
methods, because we can just pass the percentage basis in to the regular
resolve_foo() method.
This also corrects the issue that *any* calculation may need to resolve
lengths, but we previously only passed a length resolution context to
specific types in some situations. Now, they can all have one available,
though it's up to the caller to provide it.
											
										 
											2025-01-22 16:05:32 +00:00
										 |  |  |     virtual CalculatedStyleValue::CalculationResult resolve(CalculationResolutionContext const&) const override; | 
					
						
							| 
									
										
										
										
											2025-04-15 15:21:37 -06:00
										 |  |  |     virtual NonnullRefPtr<CalculationNode const> with_simplified_children(CalculationContext const&, CalculationResolutionContext const&) const override; | 
					
						
							| 
									
										
										
										
											2025-01-23 17:02:32 +00:00
										 |  |  |     virtual Optional<CalculatedStyleValue::CalculationResult> run_operation_if_possible(CalculationContext const&, CalculationResolutionContext const&) const override; | 
					
						
							| 
									
										
										
										
											2023-05-28 10:55:52 +02:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2025-04-15 15:21:37 -06:00
										 |  |  |     virtual Vector<NonnullRefPtr<CalculationNode const>> children() const override { return { { m_value } }; } | 
					
						
							| 
									
										
										
										
											2025-02-26 14:08:20 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2023-08-22 14:13:22 +01:00
										 |  |  |     virtual void dump(StringBuilder&, int indent) const override; | 
					
						
							| 
									
										
										
										
											2024-01-09 12:41:43 +01:00
										 |  |  |     virtual bool equals(CalculationNode const&) const override; | 
					
						
							| 
									
										
										
										
											2023-05-28 10:55:52 +02:00
										 |  |  | 
 | 
					
						
							|  |  |  | private: | 
					
						
							| 
									
										
										
										
											2025-04-15 15:21:37 -06:00
										 |  |  |     explicit AsinCalculationNode(NonnullRefPtr<CalculationNode const>); | 
					
						
							|  |  |  |     NonnullRefPtr<CalculationNode const> m_value; | 
					
						
							| 
									
										
										
										
											2023-05-28 10:55:52 +02:00
										 |  |  | }; | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2023-05-28 11:00:35 +02:00
										 |  |  | class AcosCalculationNode final : public CalculationNode { | 
					
						
							|  |  |  | public: | 
					
						
							| 
									
										
										
										
											2025-04-15 15:21:37 -06:00
										 |  |  |     static NonnullRefPtr<AcosCalculationNode const> create(NonnullRefPtr<CalculationNode const>); | 
					
						
							| 
									
										
										
										
											2023-05-28 11:00:35 +02:00
										 |  |  |     ~AcosCalculationNode(); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     virtual bool contains_percentage() const override; | 
					
						
							| 
									
										
										
											
												LibWeb/CSS: Wrap calc()-resolution data in a struct
Initially I added this to the existing CalculationContext, but in
reality, we have some data at parse-time and different data at
resolve-time, so it made more sense to keep those separate.
Instead of needing a variety of methods for resolving a Foo, depending
on whether we have a Layout::Node available, or a percentage basis, or
a length resolution context... put those in a
CalculationResolutionContext, and just pass that one thing to these
methods. This also removes the need for separate resolve_*_percentage()
methods, because we can just pass the percentage basis in to the regular
resolve_foo() method.
This also corrects the issue that *any* calculation may need to resolve
lengths, but we previously only passed a length resolution context to
specific types in some situations. Now, they can all have one available,
though it's up to the caller to provide it.
											
										 
											2025-01-22 16:05:32 +00:00
										 |  |  |     virtual CalculatedStyleValue::CalculationResult resolve(CalculationResolutionContext const&) const override; | 
					
						
							| 
									
										
										
										
											2025-04-15 15:21:37 -06:00
										 |  |  |     virtual NonnullRefPtr<CalculationNode const> with_simplified_children(CalculationContext const&, CalculationResolutionContext const&) const override; | 
					
						
							| 
									
										
										
										
											2025-01-23 17:02:32 +00:00
										 |  |  |     virtual Optional<CalculatedStyleValue::CalculationResult> run_operation_if_possible(CalculationContext const&, CalculationResolutionContext const&) const override; | 
					
						
							| 
									
										
										
										
											2023-05-28 11:00:35 +02:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2025-04-15 15:21:37 -06:00
										 |  |  |     virtual Vector<NonnullRefPtr<CalculationNode const>> children() const override { return { { m_value } }; } | 
					
						
							| 
									
										
										
										
											2025-02-26 14:08:20 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2023-08-22 14:13:22 +01:00
										 |  |  |     virtual void dump(StringBuilder&, int indent) const override; | 
					
						
							| 
									
										
										
										
											2024-01-09 12:41:43 +01:00
										 |  |  |     virtual bool equals(CalculationNode const&) const override; | 
					
						
							| 
									
										
										
										
											2023-05-28 11:00:35 +02:00
										 |  |  | 
 | 
					
						
							|  |  |  | private: | 
					
						
							| 
									
										
										
										
											2025-04-15 15:21:37 -06:00
										 |  |  |     explicit AcosCalculationNode(NonnullRefPtr<CalculationNode const>); | 
					
						
							|  |  |  |     NonnullRefPtr<CalculationNode const> m_value; | 
					
						
							| 
									
										
										
										
											2023-05-28 11:00:35 +02:00
										 |  |  | }; | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2023-05-28 11:04:57 +02:00
										 |  |  | class AtanCalculationNode final : public CalculationNode { | 
					
						
							|  |  |  | public: | 
					
						
							| 
									
										
										
										
											2025-04-15 15:21:37 -06:00
										 |  |  |     static NonnullRefPtr<AtanCalculationNode const> create(NonnullRefPtr<CalculationNode const>); | 
					
						
							| 
									
										
										
										
											2023-05-28 11:04:57 +02:00
										 |  |  |     ~AtanCalculationNode(); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     virtual bool contains_percentage() const override; | 
					
						
							| 
									
										
										
											
												LibWeb/CSS: Wrap calc()-resolution data in a struct
Initially I added this to the existing CalculationContext, but in
reality, we have some data at parse-time and different data at
resolve-time, so it made more sense to keep those separate.
Instead of needing a variety of methods for resolving a Foo, depending
on whether we have a Layout::Node available, or a percentage basis, or
a length resolution context... put those in a
CalculationResolutionContext, and just pass that one thing to these
methods. This also removes the need for separate resolve_*_percentage()
methods, because we can just pass the percentage basis in to the regular
resolve_foo() method.
This also corrects the issue that *any* calculation may need to resolve
lengths, but we previously only passed a length resolution context to
specific types in some situations. Now, they can all have one available,
though it's up to the caller to provide it.
											
										 
											2025-01-22 16:05:32 +00:00
										 |  |  |     virtual CalculatedStyleValue::CalculationResult resolve(CalculationResolutionContext const&) const override; | 
					
						
							| 
									
										
										
										
											2025-04-15 15:21:37 -06:00
										 |  |  |     virtual NonnullRefPtr<CalculationNode const> with_simplified_children(CalculationContext const&, CalculationResolutionContext const&) const override; | 
					
						
							| 
									
										
										
										
											2025-01-23 17:02:32 +00:00
										 |  |  |     virtual Optional<CalculatedStyleValue::CalculationResult> run_operation_if_possible(CalculationContext const&, CalculationResolutionContext const&) const override; | 
					
						
							| 
									
										
										
										
											2023-05-28 11:04:57 +02:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2025-04-15 15:21:37 -06:00
										 |  |  |     virtual Vector<NonnullRefPtr<CalculationNode const>> children() const override { return { { m_value } }; } | 
					
						
							| 
									
										
										
										
											2025-02-26 14:08:20 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2023-08-22 14:13:22 +01:00
										 |  |  |     virtual void dump(StringBuilder&, int indent) const override; | 
					
						
							| 
									
										
										
										
											2024-01-09 12:41:43 +01:00
										 |  |  |     virtual bool equals(CalculationNode const&) const override; | 
					
						
							| 
									
										
										
										
											2023-05-28 11:04:57 +02:00
										 |  |  | 
 | 
					
						
							|  |  |  | private: | 
					
						
							| 
									
										
										
										
											2025-04-15 15:21:37 -06:00
										 |  |  |     explicit AtanCalculationNode(NonnullRefPtr<CalculationNode const>); | 
					
						
							|  |  |  |     NonnullRefPtr<CalculationNode const> m_value; | 
					
						
							| 
									
										
										
										
											2023-05-28 11:04:57 +02:00
										 |  |  | }; | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2023-05-28 11:19:10 +02:00
										 |  |  | class Atan2CalculationNode final : public CalculationNode { | 
					
						
							|  |  |  | public: | 
					
						
							| 
									
										
										
										
											2025-04-15 15:21:37 -06:00
										 |  |  |     static NonnullRefPtr<Atan2CalculationNode const> create(NonnullRefPtr<CalculationNode const>, NonnullRefPtr<CalculationNode const>); | 
					
						
							| 
									
										
										
										
											2023-05-28 11:19:10 +02:00
										 |  |  |     ~Atan2CalculationNode(); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     virtual bool contains_percentage() const override; | 
					
						
							| 
									
										
										
											
												LibWeb/CSS: Wrap calc()-resolution data in a struct
Initially I added this to the existing CalculationContext, but in
reality, we have some data at parse-time and different data at
resolve-time, so it made more sense to keep those separate.
Instead of needing a variety of methods for resolving a Foo, depending
on whether we have a Layout::Node available, or a percentage basis, or
a length resolution context... put those in a
CalculationResolutionContext, and just pass that one thing to these
methods. This also removes the need for separate resolve_*_percentage()
methods, because we can just pass the percentage basis in to the regular
resolve_foo() method.
This also corrects the issue that *any* calculation may need to resolve
lengths, but we previously only passed a length resolution context to
specific types in some situations. Now, they can all have one available,
though it's up to the caller to provide it.
											
										 
											2025-01-22 16:05:32 +00:00
										 |  |  |     virtual CalculatedStyleValue::CalculationResult resolve(CalculationResolutionContext const&) const override; | 
					
						
							| 
									
										
										
										
											2025-04-15 15:21:37 -06:00
										 |  |  |     virtual NonnullRefPtr<CalculationNode const> with_simplified_children(CalculationContext const&, CalculationResolutionContext const&) const override; | 
					
						
							| 
									
										
										
										
											2025-01-23 17:02:32 +00:00
										 |  |  |     virtual Optional<CalculatedStyleValue::CalculationResult> run_operation_if_possible(CalculationContext const&, CalculationResolutionContext const&) const override; | 
					
						
							| 
									
										
										
										
											2023-05-28 11:19:10 +02:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2025-04-15 15:21:37 -06:00
										 |  |  |     virtual Vector<NonnullRefPtr<CalculationNode const>> children() const override { return { { m_y, m_x } }; } | 
					
						
							| 
									
										
										
										
											2025-02-26 14:08:20 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2023-08-22 14:13:22 +01:00
										 |  |  |     virtual void dump(StringBuilder&, int indent) const override; | 
					
						
							| 
									
										
										
										
											2024-01-09 12:41:43 +01:00
										 |  |  |     virtual bool equals(CalculationNode const&) const override; | 
					
						
							| 
									
										
										
										
											2023-05-28 11:19:10 +02:00
										 |  |  | 
 | 
					
						
							|  |  |  | private: | 
					
						
							| 
									
										
										
										
											2025-04-15 15:21:37 -06:00
										 |  |  |     Atan2CalculationNode(NonnullRefPtr<CalculationNode const>, NonnullRefPtr<CalculationNode const>); | 
					
						
							|  |  |  |     NonnullRefPtr<CalculationNode const> m_y; | 
					
						
							|  |  |  |     NonnullRefPtr<CalculationNode const> m_x; | 
					
						
							| 
									
										
										
										
											2023-05-28 11:19:10 +02:00
										 |  |  | }; | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2023-05-28 11:26:42 +02:00
										 |  |  | class PowCalculationNode final : public CalculationNode { | 
					
						
							|  |  |  | public: | 
					
						
							| 
									
										
										
										
											2025-04-15 15:21:37 -06:00
										 |  |  |     static NonnullRefPtr<PowCalculationNode const> create(NonnullRefPtr<CalculationNode const>, NonnullRefPtr<CalculationNode const>); | 
					
						
							| 
									
										
										
										
											2023-05-28 11:26:42 +02:00
										 |  |  |     ~PowCalculationNode(); | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2023-07-07 22:48:11 -04:00
										 |  |  |     virtual bool contains_percentage() const override { return false; } | 
					
						
							| 
									
										
										
											
												LibWeb/CSS: Wrap calc()-resolution data in a struct
Initially I added this to the existing CalculationContext, but in
reality, we have some data at parse-time and different data at
resolve-time, so it made more sense to keep those separate.
Instead of needing a variety of methods for resolving a Foo, depending
on whether we have a Layout::Node available, or a percentage basis, or
a length resolution context... put those in a
CalculationResolutionContext, and just pass that one thing to these
methods. This also removes the need for separate resolve_*_percentage()
methods, because we can just pass the percentage basis in to the regular
resolve_foo() method.
This also corrects the issue that *any* calculation may need to resolve
lengths, but we previously only passed a length resolution context to
specific types in some situations. Now, they can all have one available,
though it's up to the caller to provide it.
											
										 
											2025-01-22 16:05:32 +00:00
										 |  |  |     virtual CalculatedStyleValue::CalculationResult resolve(CalculationResolutionContext const&) const override; | 
					
						
							| 
									
										
										
										
											2025-04-15 15:21:37 -06:00
										 |  |  |     virtual NonnullRefPtr<CalculationNode const> with_simplified_children(CalculationContext const&, CalculationResolutionContext const&) const override; | 
					
						
							| 
									
										
										
										
											2025-01-23 17:02:32 +00:00
										 |  |  |     virtual Optional<CalculatedStyleValue::CalculationResult> run_operation_if_possible(CalculationContext const&, CalculationResolutionContext const&) const override; | 
					
						
							| 
									
										
										
										
											2023-05-28 11:26:42 +02:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2025-04-15 15:21:37 -06:00
										 |  |  |     virtual Vector<NonnullRefPtr<CalculationNode const>> children() const override { return { { m_x, m_y } }; } | 
					
						
							| 
									
										
										
										
											2025-02-26 14:08:20 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2023-08-22 14:13:22 +01:00
										 |  |  |     virtual void dump(StringBuilder&, int indent) const override; | 
					
						
							| 
									
										
										
										
											2024-01-09 12:41:43 +01:00
										 |  |  |     virtual bool equals(CalculationNode const&) const override; | 
					
						
							| 
									
										
										
										
											2023-05-28 11:26:42 +02:00
										 |  |  | 
 | 
					
						
							|  |  |  | private: | 
					
						
							| 
									
										
										
										
											2025-04-15 15:21:37 -06:00
										 |  |  |     PowCalculationNode(NonnullRefPtr<CalculationNode const>, NonnullRefPtr<CalculationNode const>); | 
					
						
							|  |  |  |     NonnullRefPtr<CalculationNode const> m_x; | 
					
						
							|  |  |  |     NonnullRefPtr<CalculationNode const> m_y; | 
					
						
							| 
									
										
										
										
											2023-05-28 11:26:42 +02:00
										 |  |  | }; | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2023-05-28 11:31:50 +02:00
										 |  |  | class SqrtCalculationNode final : public CalculationNode { | 
					
						
							|  |  |  | public: | 
					
						
							| 
									
										
										
										
											2025-04-15 15:21:37 -06:00
										 |  |  |     static NonnullRefPtr<SqrtCalculationNode const> create(NonnullRefPtr<CalculationNode const>); | 
					
						
							| 
									
										
										
										
											2023-05-28 11:31:50 +02:00
										 |  |  |     ~SqrtCalculationNode(); | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2023-07-07 22:48:11 -04:00
										 |  |  |     virtual bool contains_percentage() const override { return false; } | 
					
						
							| 
									
										
										
											
												LibWeb/CSS: Wrap calc()-resolution data in a struct
Initially I added this to the existing CalculationContext, but in
reality, we have some data at parse-time and different data at
resolve-time, so it made more sense to keep those separate.
Instead of needing a variety of methods for resolving a Foo, depending
on whether we have a Layout::Node available, or a percentage basis, or
a length resolution context... put those in a
CalculationResolutionContext, and just pass that one thing to these
methods. This also removes the need for separate resolve_*_percentage()
methods, because we can just pass the percentage basis in to the regular
resolve_foo() method.
This also corrects the issue that *any* calculation may need to resolve
lengths, but we previously only passed a length resolution context to
specific types in some situations. Now, they can all have one available,
though it's up to the caller to provide it.
											
										 
											2025-01-22 16:05:32 +00:00
										 |  |  |     virtual CalculatedStyleValue::CalculationResult resolve(CalculationResolutionContext const&) const override; | 
					
						
							| 
									
										
										
										
											2025-04-15 15:21:37 -06:00
										 |  |  |     virtual NonnullRefPtr<CalculationNode const> with_simplified_children(CalculationContext const&, CalculationResolutionContext const&) const override; | 
					
						
							| 
									
										
										
										
											2025-01-23 17:02:32 +00:00
										 |  |  |     virtual Optional<CalculatedStyleValue::CalculationResult> run_operation_if_possible(CalculationContext const&, CalculationResolutionContext const&) const override; | 
					
						
							| 
									
										
										
										
											2023-05-28 11:31:50 +02:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2025-04-15 15:21:37 -06:00
										 |  |  |     virtual Vector<NonnullRefPtr<CalculationNode const>> children() const override { return { { m_value } }; } | 
					
						
							| 
									
										
										
										
											2025-02-26 14:08:20 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2023-08-22 14:13:22 +01:00
										 |  |  |     virtual void dump(StringBuilder&, int indent) const override; | 
					
						
							| 
									
										
										
										
											2024-01-09 12:41:43 +01:00
										 |  |  |     virtual bool equals(CalculationNode const&) const override; | 
					
						
							| 
									
										
										
										
											2023-05-28 11:31:50 +02:00
										 |  |  | 
 | 
					
						
							|  |  |  | private: | 
					
						
							| 
									
										
										
										
											2025-04-15 15:21:37 -06:00
										 |  |  |     explicit SqrtCalculationNode(NonnullRefPtr<CalculationNode const>); | 
					
						
							|  |  |  |     NonnullRefPtr<CalculationNode const> m_value; | 
					
						
							| 
									
										
										
										
											2023-05-28 11:31:50 +02:00
										 |  |  | }; | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2023-05-28 11:43:04 +02:00
										 |  |  | class HypotCalculationNode final : public CalculationNode { | 
					
						
							|  |  |  | public: | 
					
						
							| 
									
										
										
										
											2025-04-15 15:21:37 -06:00
										 |  |  |     static NonnullRefPtr<HypotCalculationNode const> create(Vector<NonnullRefPtr<CalculationNode const>>); | 
					
						
							| 
									
										
										
										
											2023-05-28 11:43:04 +02:00
										 |  |  |     ~HypotCalculationNode(); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     virtual bool contains_percentage() const override; | 
					
						
							| 
									
										
										
											
												LibWeb/CSS: Wrap calc()-resolution data in a struct
Initially I added this to the existing CalculationContext, but in
reality, we have some data at parse-time and different data at
resolve-time, so it made more sense to keep those separate.
Instead of needing a variety of methods for resolving a Foo, depending
on whether we have a Layout::Node available, or a percentage basis, or
a length resolution context... put those in a
CalculationResolutionContext, and just pass that one thing to these
methods. This also removes the need for separate resolve_*_percentage()
methods, because we can just pass the percentage basis in to the regular
resolve_foo() method.
This also corrects the issue that *any* calculation may need to resolve
lengths, but we previously only passed a length resolution context to
specific types in some situations. Now, they can all have one available,
though it's up to the caller to provide it.
											
										 
											2025-01-22 16:05:32 +00:00
										 |  |  |     virtual CalculatedStyleValue::CalculationResult resolve(CalculationResolutionContext const&) const override; | 
					
						
							| 
									
										
										
										
											2025-04-15 15:21:37 -06:00
										 |  |  |     virtual NonnullRefPtr<CalculationNode const> with_simplified_children(CalculationContext const&, CalculationResolutionContext const&) const override; | 
					
						
							| 
									
										
										
										
											2025-01-23 17:02:32 +00:00
										 |  |  |     virtual Optional<CalculatedStyleValue::CalculationResult> run_operation_if_possible(CalculationContext const&, CalculationResolutionContext const&) const override; | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2025-04-15 15:21:37 -06:00
										 |  |  |     virtual Vector<NonnullRefPtr<CalculationNode const>> children() const override { return m_values; } | 
					
						
							| 
									
										
										
										
											2023-05-28 11:43:04 +02:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2023-08-22 14:13:22 +01:00
										 |  |  |     virtual void dump(StringBuilder&, int indent) const override; | 
					
						
							| 
									
										
										
										
											2024-01-09 12:41:43 +01:00
										 |  |  |     virtual bool equals(CalculationNode const&) const override; | 
					
						
							| 
									
										
										
										
											2023-05-28 11:43:04 +02:00
										 |  |  | 
 | 
					
						
							|  |  |  | private: | 
					
						
							| 
									
										
										
										
											2025-08-15 12:55:58 +01:00
										 |  |  |     HypotCalculationNode(Vector<NonnullRefPtr<CalculationNode const>>, Optional<NumericType>); | 
					
						
							| 
									
										
										
										
											2025-04-15 15:21:37 -06:00
										 |  |  |     Vector<NonnullRefPtr<CalculationNode const>> m_values; | 
					
						
							| 
									
										
										
										
											2023-05-28 11:43:04 +02:00
										 |  |  | }; | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2023-05-28 11:53:57 +02:00
										 |  |  | class LogCalculationNode final : public CalculationNode { | 
					
						
							|  |  |  | public: | 
					
						
							| 
									
										
										
										
											2025-04-15 15:21:37 -06:00
										 |  |  |     static NonnullRefPtr<LogCalculationNode const> create(NonnullRefPtr<CalculationNode const>, NonnullRefPtr<CalculationNode const>); | 
					
						
							| 
									
										
										
										
											2023-05-28 11:53:57 +02:00
										 |  |  |     ~LogCalculationNode(); | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2023-07-07 22:48:11 -04:00
										 |  |  |     virtual bool contains_percentage() const override { return false; } | 
					
						
							| 
									
										
										
											
												LibWeb/CSS: Wrap calc()-resolution data in a struct
Initially I added this to the existing CalculationContext, but in
reality, we have some data at parse-time and different data at
resolve-time, so it made more sense to keep those separate.
Instead of needing a variety of methods for resolving a Foo, depending
on whether we have a Layout::Node available, or a percentage basis, or
a length resolution context... put those in a
CalculationResolutionContext, and just pass that one thing to these
methods. This also removes the need for separate resolve_*_percentage()
methods, because we can just pass the percentage basis in to the regular
resolve_foo() method.
This also corrects the issue that *any* calculation may need to resolve
lengths, but we previously only passed a length resolution context to
specific types in some situations. Now, they can all have one available,
though it's up to the caller to provide it.
											
										 
											2025-01-22 16:05:32 +00:00
										 |  |  |     virtual CalculatedStyleValue::CalculationResult resolve(CalculationResolutionContext const&) const override; | 
					
						
							| 
									
										
										
										
											2025-04-15 15:21:37 -06:00
										 |  |  |     virtual NonnullRefPtr<CalculationNode const> with_simplified_children(CalculationContext const&, CalculationResolutionContext const&) const override; | 
					
						
							| 
									
										
										
										
											2025-01-23 17:02:32 +00:00
										 |  |  |     virtual Optional<CalculatedStyleValue::CalculationResult> run_operation_if_possible(CalculationContext const&, CalculationResolutionContext const&) const override; | 
					
						
							| 
									
										
										
										
											2023-05-28 11:53:57 +02:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2025-04-15 15:21:37 -06:00
										 |  |  |     virtual Vector<NonnullRefPtr<CalculationNode const>> children() const override { return { { m_x, m_y } }; } | 
					
						
							| 
									
										
										
										
											2025-02-26 14:08:20 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2023-08-22 14:13:22 +01:00
										 |  |  |     virtual void dump(StringBuilder&, int indent) const override; | 
					
						
							| 
									
										
										
										
											2024-01-09 12:41:43 +01:00
										 |  |  |     virtual bool equals(CalculationNode const&) const override; | 
					
						
							| 
									
										
										
										
											2023-05-28 11:53:57 +02:00
										 |  |  | 
 | 
					
						
							|  |  |  | private: | 
					
						
							| 
									
										
										
										
											2025-04-15 15:21:37 -06:00
										 |  |  |     LogCalculationNode(NonnullRefPtr<CalculationNode const>, NonnullRefPtr<CalculationNode const>); | 
					
						
							|  |  |  |     NonnullRefPtr<CalculationNode const> m_x; | 
					
						
							|  |  |  |     NonnullRefPtr<CalculationNode const> m_y; | 
					
						
							| 
									
										
										
										
											2023-05-28 11:53:57 +02:00
										 |  |  | }; | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2023-05-28 11:58:30 +02:00
										 |  |  | class ExpCalculationNode final : public CalculationNode { | 
					
						
							|  |  |  | public: | 
					
						
							| 
									
										
										
										
											2025-04-15 15:21:37 -06:00
										 |  |  |     static NonnullRefPtr<ExpCalculationNode const> create(NonnullRefPtr<CalculationNode const>); | 
					
						
							| 
									
										
										
										
											2023-05-28 11:58:30 +02:00
										 |  |  |     ~ExpCalculationNode(); | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2023-07-07 22:48:11 -04:00
										 |  |  |     virtual bool contains_percentage() const override { return false; } | 
					
						
							| 
									
										
										
											
												LibWeb/CSS: Wrap calc()-resolution data in a struct
Initially I added this to the existing CalculationContext, but in
reality, we have some data at parse-time and different data at
resolve-time, so it made more sense to keep those separate.
Instead of needing a variety of methods for resolving a Foo, depending
on whether we have a Layout::Node available, or a percentage basis, or
a length resolution context... put those in a
CalculationResolutionContext, and just pass that one thing to these
methods. This also removes the need for separate resolve_*_percentage()
methods, because we can just pass the percentage basis in to the regular
resolve_foo() method.
This also corrects the issue that *any* calculation may need to resolve
lengths, but we previously only passed a length resolution context to
specific types in some situations. Now, they can all have one available,
though it's up to the caller to provide it.
											
										 
											2025-01-22 16:05:32 +00:00
										 |  |  |     virtual CalculatedStyleValue::CalculationResult resolve(CalculationResolutionContext const&) const override; | 
					
						
							| 
									
										
										
										
											2025-04-15 15:21:37 -06:00
										 |  |  |     virtual NonnullRefPtr<CalculationNode const> with_simplified_children(CalculationContext const&, CalculationResolutionContext const&) const override; | 
					
						
							| 
									
										
										
										
											2025-01-23 17:02:32 +00:00
										 |  |  |     virtual Optional<CalculatedStyleValue::CalculationResult> run_operation_if_possible(CalculationContext const&, CalculationResolutionContext const&) const override; | 
					
						
							| 
									
										
										
										
											2023-05-28 11:58:30 +02:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2025-04-15 15:21:37 -06:00
										 |  |  |     virtual Vector<NonnullRefPtr<CalculationNode const>> children() const override { return { { m_value } }; } | 
					
						
							| 
									
										
										
										
											2025-02-26 14:08:20 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2023-08-22 14:13:22 +01:00
										 |  |  |     virtual void dump(StringBuilder&, int indent) const override; | 
					
						
							| 
									
										
										
										
											2024-01-09 12:41:43 +01:00
										 |  |  |     virtual bool equals(CalculationNode const&) const override; | 
					
						
							| 
									
										
										
										
											2023-05-28 11:58:30 +02:00
										 |  |  | 
 | 
					
						
							|  |  |  | private: | 
					
						
							| 
									
										
										
										
											2025-04-15 15:21:37 -06:00
										 |  |  |     explicit ExpCalculationNode(NonnullRefPtr<CalculationNode const>); | 
					
						
							|  |  |  |     NonnullRefPtr<CalculationNode const> m_value; | 
					
						
							| 
									
										
										
										
											2023-05-28 11:58:30 +02:00
										 |  |  | }; | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2023-05-27 16:07:50 +02:00
										 |  |  | class RoundCalculationNode final : public CalculationNode { | 
					
						
							|  |  |  | public: | 
					
						
							| 
									
										
										
										
											2025-04-15 15:21:37 -06:00
										 |  |  |     static NonnullRefPtr<RoundCalculationNode const> create(RoundingStrategy, NonnullRefPtr<CalculationNode const>, NonnullRefPtr<CalculationNode const>); | 
					
						
							| 
									
										
										
										
											2023-05-27 16:07:50 +02:00
										 |  |  |     ~RoundCalculationNode(); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     virtual bool contains_percentage() const override; | 
					
						
							| 
									
										
										
											
												LibWeb/CSS: Wrap calc()-resolution data in a struct
Initially I added this to the existing CalculationContext, but in
reality, we have some data at parse-time and different data at
resolve-time, so it made more sense to keep those separate.
Instead of needing a variety of methods for resolving a Foo, depending
on whether we have a Layout::Node available, or a percentage basis, or
a length resolution context... put those in a
CalculationResolutionContext, and just pass that one thing to these
methods. This also removes the need for separate resolve_*_percentage()
methods, because we can just pass the percentage basis in to the regular
resolve_foo() method.
This also corrects the issue that *any* calculation may need to resolve
lengths, but we previously only passed a length resolution context to
specific types in some situations. Now, they can all have one available,
though it's up to the caller to provide it.
											
										 
											2025-01-22 16:05:32 +00:00
										 |  |  |     virtual CalculatedStyleValue::CalculationResult resolve(CalculationResolutionContext const&) const override; | 
					
						
							| 
									
										
										
										
											2025-04-15 15:21:37 -06:00
										 |  |  |     virtual NonnullRefPtr<CalculationNode const> with_simplified_children(CalculationContext const&, CalculationResolutionContext const&) const override; | 
					
						
							| 
									
										
										
										
											2025-01-23 17:02:32 +00:00
										 |  |  |     virtual Optional<CalculatedStyleValue::CalculationResult> run_operation_if_possible(CalculationContext const&, CalculationResolutionContext const&) const override; | 
					
						
							| 
									
										
										
										
											2023-05-27 16:07:50 +02:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2025-02-26 14:08:20 +00:00
										 |  |  |     // NOTE: This excludes the rounding strategy!
 | 
					
						
							|  |  |  |     RoundingStrategy rounding_strategy() const { return m_strategy; } | 
					
						
							| 
									
										
										
										
											2025-04-15 15:21:37 -06:00
										 |  |  |     virtual Vector<NonnullRefPtr<CalculationNode const>> children() const override { return { { m_x, m_y } }; } | 
					
						
							| 
									
										
										
										
											2025-02-26 14:08:20 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2023-08-22 14:13:22 +01:00
										 |  |  |     virtual void dump(StringBuilder&, int indent) const override; | 
					
						
							| 
									
										
										
										
											2024-01-09 12:41:43 +01:00
										 |  |  |     virtual bool equals(CalculationNode const&) const override; | 
					
						
							| 
									
										
										
										
											2023-05-27 16:07:50 +02:00
										 |  |  | 
 | 
					
						
							|  |  |  | private: | 
					
						
							| 
									
										
										
										
											2025-08-15 12:55:58 +01:00
										 |  |  |     RoundCalculationNode(RoundingStrategy, NonnullRefPtr<CalculationNode const>, NonnullRefPtr<CalculationNode const>, Optional<NumericType>); | 
					
						
							| 
									
										
										
										
											2023-07-13 14:51:11 +01:00
										 |  |  |     RoundingStrategy m_strategy; | 
					
						
							| 
									
										
										
										
											2025-04-15 15:21:37 -06:00
										 |  |  |     NonnullRefPtr<CalculationNode const> m_x; | 
					
						
							|  |  |  |     NonnullRefPtr<CalculationNode const> m_y; | 
					
						
							| 
									
										
										
										
											2023-05-27 16:07:50 +02:00
										 |  |  | }; | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2023-05-27 19:03:07 +02:00
										 |  |  | class ModCalculationNode final : public CalculationNode { | 
					
						
							|  |  |  | public: | 
					
						
							| 
									
										
										
										
											2025-04-15 15:21:37 -06:00
										 |  |  |     static NonnullRefPtr<ModCalculationNode const> create(NonnullRefPtr<CalculationNode const>, NonnullRefPtr<CalculationNode const>); | 
					
						
							| 
									
										
										
										
											2023-05-27 19:03:07 +02:00
										 |  |  |     ~ModCalculationNode(); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     virtual bool contains_percentage() const override; | 
					
						
							| 
									
										
										
											
												LibWeb/CSS: Wrap calc()-resolution data in a struct
Initially I added this to the existing CalculationContext, but in
reality, we have some data at parse-time and different data at
resolve-time, so it made more sense to keep those separate.
Instead of needing a variety of methods for resolving a Foo, depending
on whether we have a Layout::Node available, or a percentage basis, or
a length resolution context... put those in a
CalculationResolutionContext, and just pass that one thing to these
methods. This also removes the need for separate resolve_*_percentage()
methods, because we can just pass the percentage basis in to the regular
resolve_foo() method.
This also corrects the issue that *any* calculation may need to resolve
lengths, but we previously only passed a length resolution context to
specific types in some situations. Now, they can all have one available,
though it's up to the caller to provide it.
											
										 
											2025-01-22 16:05:32 +00:00
										 |  |  |     virtual CalculatedStyleValue::CalculationResult resolve(CalculationResolutionContext const&) const override; | 
					
						
							| 
									
										
										
										
											2025-04-15 15:21:37 -06:00
										 |  |  |     virtual NonnullRefPtr<CalculationNode const> with_simplified_children(CalculationContext const&, CalculationResolutionContext const&) const override; | 
					
						
							| 
									
										
										
										
											2025-01-23 17:02:32 +00:00
										 |  |  |     virtual Optional<CalculatedStyleValue::CalculationResult> run_operation_if_possible(CalculationContext const&, CalculationResolutionContext const&) const override; | 
					
						
							| 
									
										
										
										
											2023-05-27 19:03:07 +02:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2025-04-15 15:21:37 -06:00
										 |  |  |     virtual Vector<NonnullRefPtr<CalculationNode const>> children() const override { return { { m_x, m_y } }; } | 
					
						
							| 
									
										
										
										
											2025-02-26 14:08:20 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2023-08-22 14:13:22 +01:00
										 |  |  |     virtual void dump(StringBuilder&, int indent) const override; | 
					
						
							| 
									
										
										
										
											2024-01-09 12:41:43 +01:00
										 |  |  |     virtual bool equals(CalculationNode const&) const override; | 
					
						
							| 
									
										
										
										
											2023-05-27 19:03:07 +02:00
										 |  |  | 
 | 
					
						
							|  |  |  | private: | 
					
						
							| 
									
										
										
										
											2025-08-15 12:55:58 +01:00
										 |  |  |     ModCalculationNode(NonnullRefPtr<CalculationNode const>, NonnullRefPtr<CalculationNode const>, Optional<NumericType>); | 
					
						
							| 
									
										
										
										
											2025-04-15 15:21:37 -06:00
										 |  |  |     NonnullRefPtr<CalculationNode const> m_x; | 
					
						
							|  |  |  |     NonnullRefPtr<CalculationNode const> m_y; | 
					
						
							| 
									
										
										
										
											2023-05-27 19:03:07 +02:00
										 |  |  | }; | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2023-05-27 19:08:07 +02:00
										 |  |  | class RemCalculationNode final : public CalculationNode { | 
					
						
							|  |  |  | public: | 
					
						
							| 
									
										
										
										
											2025-04-15 15:21:37 -06:00
										 |  |  |     static NonnullRefPtr<RemCalculationNode const> create(NonnullRefPtr<CalculationNode const>, NonnullRefPtr<CalculationNode const>); | 
					
						
							| 
									
										
										
										
											2023-05-27 19:08:07 +02:00
										 |  |  |     ~RemCalculationNode(); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     virtual bool contains_percentage() const override; | 
					
						
							| 
									
										
										
											
												LibWeb/CSS: Wrap calc()-resolution data in a struct
Initially I added this to the existing CalculationContext, but in
reality, we have some data at parse-time and different data at
resolve-time, so it made more sense to keep those separate.
Instead of needing a variety of methods for resolving a Foo, depending
on whether we have a Layout::Node available, or a percentage basis, or
a length resolution context... put those in a
CalculationResolutionContext, and just pass that one thing to these
methods. This also removes the need for separate resolve_*_percentage()
methods, because we can just pass the percentage basis in to the regular
resolve_foo() method.
This also corrects the issue that *any* calculation may need to resolve
lengths, but we previously only passed a length resolution context to
specific types in some situations. Now, they can all have one available,
though it's up to the caller to provide it.
											
										 
											2025-01-22 16:05:32 +00:00
										 |  |  |     virtual CalculatedStyleValue::CalculationResult resolve(CalculationResolutionContext const&) const override; | 
					
						
							| 
									
										
										
										
											2025-04-15 15:21:37 -06:00
										 |  |  |     virtual NonnullRefPtr<CalculationNode const> with_simplified_children(CalculationContext const&, CalculationResolutionContext const&) const override; | 
					
						
							| 
									
										
										
										
											2025-01-23 17:02:32 +00:00
										 |  |  |     virtual Optional<CalculatedStyleValue::CalculationResult> run_operation_if_possible(CalculationContext const&, CalculationResolutionContext const&) const override; | 
					
						
							| 
									
										
										
										
											2023-05-27 19:08:07 +02:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2025-04-15 15:21:37 -06:00
										 |  |  |     virtual Vector<NonnullRefPtr<CalculationNode const>> children() const override { return { { m_x, m_y } }; } | 
					
						
							| 
									
										
										
										
											2025-02-26 14:08:20 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2023-08-22 14:13:22 +01:00
										 |  |  |     virtual void dump(StringBuilder&, int indent) const override; | 
					
						
							| 
									
										
										
										
											2024-01-09 12:41:43 +01:00
										 |  |  |     virtual bool equals(CalculationNode const&) const override; | 
					
						
							| 
									
										
										
										
											2023-05-27 19:08:07 +02:00
										 |  |  | 
 | 
					
						
							|  |  |  | private: | 
					
						
							| 
									
										
										
										
											2025-08-15 12:55:58 +01:00
										 |  |  |     RemCalculationNode(NonnullRefPtr<CalculationNode const>, NonnullRefPtr<CalculationNode const>, Optional<NumericType>); | 
					
						
							| 
									
										
										
										
											2025-04-15 15:21:37 -06:00
										 |  |  |     NonnullRefPtr<CalculationNode const> m_x; | 
					
						
							|  |  |  |     NonnullRefPtr<CalculationNode const> m_y; | 
					
						
							| 
									
										
										
										
											2023-05-27 19:08:07 +02:00
										 |  |  | }; | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2025-01-23 17:02:32 +00:00
										 |  |  | // https://drafts.csswg.org/css-values-4/#calc-simplification
 | 
					
						
							| 
									
										
										
										
											2025-04-15 15:21:37 -06:00
										 |  |  | NonnullRefPtr<CalculationNode const> simplify_a_calculation_tree(CalculationNode const& root, CalculationContext const& context, CalculationResolutionContext const& resolution_context); | 
					
						
							| 
									
										
										
										
											2025-01-23 17:02:32 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2023-03-30 17:34:14 +01:00
										 |  |  | } |