| 
									
										
										
										
											2020-01-18 09:38:21 +01:00
										 |  |  | /*
 | 
					
						
							| 
									
										
										
										
											2024-10-04 13:19:50 +02:00
										 |  |  |  * Copyright (c) 2018-2023, Andreas Kling <andreas@ladybird.org> | 
					
						
							| 
									
										
										
										
											2021-08-09 21:28:56 +02:00
										 |  |  |  * Copyright (c) 2021, Tobias Christiansen <tobyase@serenityos.org> | 
					
						
							| 
									
										
										
										
											2025-02-21 13:04:20 +00:00
										 |  |  |  * Copyright (c) 2021-2025, Sam Atkins <sam@ladybird.org> | 
					
						
							| 
									
										
										
										
											2023-01-13 23:44:44 +00:00
										 |  |  |  * Copyright (c) 2022-2023, MacDue <macdue@dueutil.tech> | 
					
						
							| 
									
										
										
										
											2020-01-18 09:38:21 +01:00
										 |  |  |  * | 
					
						
							| 
									
										
										
										
											2021-04-22 01:24:48 -07:00
										 |  |  |  * SPDX-License-Identifier: BSD-2-Clause | 
					
						
							| 
									
										
										
										
											2020-01-18 09:38:21 +01:00
										 |  |  |  */ | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2019-06-20 23:25:25 +02:00
										 |  |  | #pragma once
 | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2022-07-31 01:11:59 +01:00
										 |  |  | #include <AK/GenericShorthands.h>
 | 
					
						
							| 
									
										
										
										
											2021-07-22 23:01:39 +02:00
										 |  |  | #include <AK/NonnullOwnPtr.h>
 | 
					
						
							| 
									
										
										
										
											2019-06-21 18:58:45 +02:00
										 |  |  | #include <AK/RefCounted.h>
 | 
					
						
							| 
									
										
										
										
											2019-06-22 21:48:21 +02:00
										 |  |  | #include <AK/RefPtr.h>
 | 
					
						
							| 
									
										
										
										
											2023-01-06 19:02:26 +01:00
										 |  |  | #include <AK/String.h>
 | 
					
						
							| 
									
										
										
										
											2019-06-22 21:48:21 +02:00
										 |  |  | #include <AK/StringView.h>
 | 
					
						
							| 
									
										
										
										
											2021-07-22 23:01:39 +02:00
										 |  |  | #include <AK/Vector.h>
 | 
					
						
							| 
									
										
										
										
											2019-10-19 11:49:46 +02:00
										 |  |  | #include <AK/WeakPtr.h>
 | 
					
						
							| 
									
										
										
										
											2023-07-09 11:40:17 +03:30
										 |  |  | #include <LibGfx/Color.h>
 | 
					
						
							| 
									
										
										
										
											2025-03-26 14:40:23 +00:00
										 |  |  | #include <LibJS/Heap/Cell.h>
 | 
					
						
							| 
									
										
										
										
											2024-03-18 16:22:27 +13:00
										 |  |  | #include <LibURL/URL.h>
 | 
					
						
							| 
									
										
										
										
											2024-08-14 14:06:03 +01:00
										 |  |  | #include <LibWeb/CSS/Keyword.h>
 | 
					
						
							| 
									
										
										
										
											2020-03-07 10:32:51 +01:00
										 |  |  | #include <LibWeb/CSS/Length.h>
 | 
					
						
							| 
									
										
										
										
											2025-05-16 19:20:24 +01:00
										 |  |  | #include <LibWeb/CSS/SerializationMode.h>
 | 
					
						
							| 
									
										
										
										
											2020-07-21 16:23:08 +02:00
										 |  |  | #include <LibWeb/Forward.h>
 | 
					
						
							| 
									
										
										
										
											2019-06-20 23:25:25 +02:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2020-07-21 16:23:08 +02:00
										 |  |  | namespace Web::CSS { | 
					
						
							| 
									
										
										
										
											2019-10-06 10:25:08 +02:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2023-02-20 00:41:51 +00:00
										 |  |  | template<typename T> | 
					
						
							|  |  |  | struct ValueComparingNonnullRefPtr : public NonnullRefPtr<T> { | 
					
						
							|  |  |  |     using NonnullRefPtr<T>::NonnullRefPtr; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     ValueComparingNonnullRefPtr(NonnullRefPtr<T> const& other) | 
					
						
							|  |  |  |         : NonnullRefPtr<T>(other) | 
					
						
							|  |  |  |     { | 
					
						
							|  |  |  |     } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     ValueComparingNonnullRefPtr(NonnullRefPtr<T>&& other) | 
					
						
							|  |  |  |         : NonnullRefPtr<T>(move(other)) | 
					
						
							|  |  |  |     { | 
					
						
							|  |  |  |     } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     bool operator==(ValueComparingNonnullRefPtr const& other) const | 
					
						
							|  |  |  |     { | 
					
						
							|  |  |  |         return this->ptr() == other.ptr() || this->ptr()->equals(*other); | 
					
						
							|  |  |  |     } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | private: | 
					
						
							|  |  |  |     using NonnullRefPtr<T>::operator==; | 
					
						
							|  |  |  | }; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | template<typename T> | 
					
						
							|  |  |  | struct ValueComparingRefPtr : public RefPtr<T> { | 
					
						
							|  |  |  |     using RefPtr<T>::RefPtr; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     ValueComparingRefPtr(RefPtr<T> const& other) | 
					
						
							|  |  |  |         : RefPtr<T>(other) | 
					
						
							|  |  |  |     { | 
					
						
							|  |  |  |     } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     ValueComparingRefPtr(RefPtr<T>&& other) | 
					
						
							|  |  |  |         : RefPtr<T>(move(other)) | 
					
						
							|  |  |  |     { | 
					
						
							|  |  |  |     } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     template<typename U> | 
					
						
							|  |  |  |     bool operator==(ValueComparingNonnullRefPtr<U> const& other) const | 
					
						
							|  |  |  |     { | 
					
						
							|  |  |  |         return this->ptr() == other.ptr() || (this->ptr() && this->ptr()->equals(*other)); | 
					
						
							|  |  |  |     } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     bool operator==(ValueComparingRefPtr const& other) const | 
					
						
							|  |  |  |     { | 
					
						
							|  |  |  |         return this->ptr() == other.ptr() || (this->ptr() && other.ptr() && this->ptr()->equals(*other)); | 
					
						
							|  |  |  |     } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | private: | 
					
						
							|  |  |  |     using RefPtr<T>::operator==; | 
					
						
							|  |  |  | }; | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2024-08-14 11:10:54 +01:00
										 |  |  | using StyleValueVector = Vector<ValueComparingNonnullRefPtr<CSSStyleValue const>>; | 
					
						
							| 
									
										
										
										
											2023-02-20 00:41:51 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2024-08-14 11:10:54 +01:00
										 |  |  | // https://drafts.css-houdini.org/css-typed-om-1/#cssstylevalue
 | 
					
						
							|  |  |  | class CSSStyleValue : public RefCounted<CSSStyleValue> { | 
					
						
							| 
									
										
										
										
											2019-06-20 23:25:25 +02:00
										 |  |  | public: | 
					
						
							| 
									
										
										
										
											2024-08-14 11:10:54 +01:00
										 |  |  |     virtual ~CSSStyleValue() = default; | 
					
						
							| 
									
										
										
										
											2019-06-20 23:25:25 +02:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2019-07-03 07:55:22 +02:00
										 |  |  |     enum class Type { | 
					
						
							| 
									
										
										
										
											2024-08-14 10:54:09 +01:00
										 |  |  |         Angle, | 
					
						
							|  |  |  |         BackgroundRepeat, | 
					
						
							|  |  |  |         BackgroundSize, | 
					
						
							| 
									
										
										
										
											2025-06-10 16:58:54 +01:00
										 |  |  |         BorderImageSlice, | 
					
						
							| 
									
										
										
										
											2024-08-14 10:54:09 +01:00
										 |  |  |         BasicShape, | 
					
						
							|  |  |  |         BorderRadius, | 
					
						
							| 
									
										
										
										
											2024-12-11 15:05:56 +00:00
										 |  |  |         Calculated, | 
					
						
							| 
									
										
										
										
											2024-08-14 10:54:09 +01:00
										 |  |  |         Color, | 
					
						
							| 
									
										
										
										
											2025-01-02 12:59:09 +11:00
										 |  |  |         ColorScheme, | 
					
						
							| 
									
										
										
										
											2024-08-14 10:54:09 +01:00
										 |  |  |         ConicGradient, | 
					
						
							|  |  |  |         Content, | 
					
						
							|  |  |  |         Counter, | 
					
						
							|  |  |  |         CounterDefinitions, | 
					
						
							| 
									
										
										
										
											2025-02-21 13:04:20 +00:00
										 |  |  |         Cursor, | 
					
						
							| 
									
										
										
										
											2024-08-14 10:54:09 +01:00
										 |  |  |         CustomIdent, | 
					
						
							|  |  |  |         Display, | 
					
						
							|  |  |  |         Easing, | 
					
						
							|  |  |  |         Edge, | 
					
						
							|  |  |  |         FilterValueList, | 
					
						
							| 
									
										
										
										
											2025-02-26 18:16:36 +01:00
										 |  |  |         FitContent, | 
					
						
							| 
									
										
										
										
											2024-08-14 10:54:09 +01:00
										 |  |  |         Flex, | 
					
						
							| 
									
										
										
										
											2025-04-02 17:01:16 +01:00
										 |  |  |         FontSource, | 
					
						
							| 
									
										
										
										
											2025-05-02 13:55:58 +01:00
										 |  |  |         FontStyle, | 
					
						
							| 
									
										
										
										
											2024-08-14 10:54:09 +01:00
										 |  |  |         Frequency, | 
					
						
							|  |  |  |         GridAutoFlow, | 
					
						
							|  |  |  |         GridTemplateArea, | 
					
						
							|  |  |  |         GridTrackPlacement, | 
					
						
							|  |  |  |         GridTrackSizeList, | 
					
						
							| 
									
										
										
										
											2025-03-12 15:29:12 +00:00
										 |  |  |         GuaranteedInvalid, | 
					
						
							| 
									
										
										
										
											2024-08-14 10:54:09 +01:00
										 |  |  |         Image, | 
					
						
							|  |  |  |         Integer, | 
					
						
							| 
									
										
										
										
											2024-08-14 11:46:56 +01:00
										 |  |  |         Keyword, | 
					
						
							| 
									
										
										
										
											2024-08-14 10:54:09 +01:00
										 |  |  |         Length, | 
					
						
							|  |  |  |         LinearGradient, | 
					
						
							|  |  |  |         MathDepth, | 
					
						
							|  |  |  |         Number, | 
					
						
							| 
									
										
										
										
											2024-09-30 17:05:52 +01:00
										 |  |  |         OpenTypeTagged, | 
					
						
							| 
									
										
										
										
											2025-03-12 19:24:59 +00:00
										 |  |  |         PendingSubstitution, | 
					
						
							| 
									
										
										
										
											2024-08-14 10:54:09 +01:00
										 |  |  |         Percentage, | 
					
						
							|  |  |  |         Position, | 
					
						
							|  |  |  |         RadialGradient, | 
					
						
							|  |  |  |         Ratio, | 
					
						
							|  |  |  |         Rect, | 
					
						
							|  |  |  |         Resolution, | 
					
						
							| 
									
										
										
										
											2025-05-26 22:36:12 +01:00
										 |  |  |         ScrollbarColor, | 
					
						
							| 
									
										
										
										
											2024-08-14 10:54:09 +01:00
										 |  |  |         ScrollbarGutter, | 
					
						
							|  |  |  |         Shadow, | 
					
						
							|  |  |  |         Shorthand, | 
					
						
							|  |  |  |         String, | 
					
						
							|  |  |  |         Time, | 
					
						
							|  |  |  |         Transformation, | 
					
						
							|  |  |  |         Transition, | 
					
						
							| 
									
										
										
										
											2025-03-27 17:35:06 +00:00
										 |  |  |         UnicodeRange, | 
					
						
							| 
									
										
										
										
											2024-08-14 10:54:09 +01:00
										 |  |  |         Unresolved, | 
					
						
							|  |  |  |         URL, | 
					
						
							|  |  |  |         ValueList, | 
					
						
							| 
									
										
										
										
											2019-06-20 23:25:25 +02:00
										 |  |  |     }; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     Type type() const { return m_type; } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2023-08-20 13:48:13 +01:00
										 |  |  |     bool is_abstract_image() const | 
					
						
							|  |  |  |     { | 
					
						
							|  |  |  |         return AK::first_is_one_of(type(), Type::Image, Type::LinearGradient, Type::ConicGradient, Type::RadialGradient); | 
					
						
							|  |  |  |     } | 
					
						
							| 
									
										
										
										
											2022-07-31 01:11:59 +01:00
										 |  |  |     AbstractImageStyleValue const& as_abstract_image() const; | 
					
						
							| 
									
										
										
										
											2024-08-14 11:10:54 +01:00
										 |  |  |     AbstractImageStyleValue& as_abstract_image() { return const_cast<AbstractImageStyleValue&>(const_cast<CSSStyleValue const&>(*this).as_abstract_image()); } | 
					
						
							| 
									
										
										
										
											2023-08-20 13:48:13 +01:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2024-08-14 10:54:09 +01:00
										 |  |  |     bool is_angle() const { return type() == Type::Angle; } | 
					
						
							|  |  |  |     AngleStyleValue const& as_angle() const; | 
					
						
							| 
									
										
										
										
											2024-08-14 11:10:54 +01:00
										 |  |  |     AngleStyleValue& as_angle() { return const_cast<AngleStyleValue&>(const_cast<CSSStyleValue const&>(*this).as_angle()); } | 
					
						
							| 
									
										
										
										
											2024-08-14 10:54:09 +01:00
										 |  |  | 
 | 
					
						
							|  |  |  |     bool is_background_repeat() const { return type() == Type::BackgroundRepeat; } | 
					
						
							|  |  |  |     BackgroundRepeatStyleValue const& as_background_repeat() const; | 
					
						
							| 
									
										
										
										
											2024-08-14 11:10:54 +01:00
										 |  |  |     BackgroundRepeatStyleValue& as_background_repeat() { return const_cast<BackgroundRepeatStyleValue&>(const_cast<CSSStyleValue const&>(*this).as_background_repeat()); } | 
					
						
							| 
									
										
										
										
											2024-08-14 10:54:09 +01:00
										 |  |  | 
 | 
					
						
							|  |  |  |     bool is_background_size() const { return type() == Type::BackgroundSize; } | 
					
						
							|  |  |  |     BackgroundSizeStyleValue const& as_background_size() const; | 
					
						
							| 
									
										
										
										
											2024-08-14 11:10:54 +01:00
										 |  |  |     BackgroundSizeStyleValue& as_background_size() { return const_cast<BackgroundSizeStyleValue&>(const_cast<CSSStyleValue const&>(*this).as_background_size()); } | 
					
						
							| 
									
										
										
										
											2024-08-14 10:54:09 +01:00
										 |  |  | 
 | 
					
						
							|  |  |  |     bool is_basic_shape() const { return type() == Type::BasicShape; } | 
					
						
							|  |  |  |     BasicShapeStyleValue const& as_basic_shape() const; | 
					
						
							| 
									
										
										
										
											2024-08-14 11:10:54 +01:00
										 |  |  |     BasicShapeStyleValue& as_basic_shape() { return const_cast<BasicShapeStyleValue&>(const_cast<CSSStyleValue const&>(*this).as_basic_shape()); } | 
					
						
							| 
									
										
										
										
											2024-08-14 10:54:09 +01:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2025-06-10 16:58:54 +01:00
										 |  |  |     bool is_border_image_slice() const { return type() == Type::BorderImageSlice; } | 
					
						
							|  |  |  |     BorderImageSliceStyleValue const& as_border_image_slice() const; | 
					
						
							|  |  |  |     BorderImageSliceStyleValue& as_border_image_slice() { return const_cast<BorderImageSliceStyleValue&>(const_cast<CSSStyleValue const&>(*this).as_border_image_slice()); } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2024-08-14 10:54:09 +01:00
										 |  |  |     bool is_border_radius() const { return type() == Type::BorderRadius; } | 
					
						
							|  |  |  |     BorderRadiusStyleValue const& as_border_radius() const; | 
					
						
							| 
									
										
										
										
											2024-08-14 11:10:54 +01:00
										 |  |  |     BorderRadiusStyleValue& as_border_radius() { return const_cast<BorderRadiusStyleValue&>(const_cast<CSSStyleValue const&>(*this).as_border_radius()); } | 
					
						
							| 
									
										
										
										
											2024-08-14 10:54:09 +01:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2024-12-11 15:05:56 +00:00
										 |  |  |     bool is_calculated() const { return type() == Type::Calculated; } | 
					
						
							|  |  |  |     CalculatedStyleValue const& as_calculated() const; | 
					
						
							|  |  |  |     CalculatedStyleValue& as_calculated() { return const_cast<CalculatedStyleValue&>(const_cast<CSSStyleValue const&>(*this).as_calculated()); } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2024-08-14 10:54:09 +01:00
										 |  |  |     bool is_color() const { return type() == Type::Color; } | 
					
						
							| 
									
										
										
										
											2024-08-14 16:37:02 +01:00
										 |  |  |     CSSColorValue const& as_color() const; | 
					
						
							|  |  |  |     CSSColorValue& as_color() { return const_cast<CSSColorValue&>(const_cast<CSSStyleValue const&>(*this).as_color()); } | 
					
						
							| 
									
										
										
										
											2025-04-05 23:27:50 +01:00
										 |  |  |     virtual bool is_color_function() const { return false; } | 
					
						
							| 
									
										
										
										
											2024-08-14 10:54:09 +01:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2025-01-02 12:59:09 +11:00
										 |  |  |     bool is_color_scheme() const { return type() == Type::ColorScheme; } | 
					
						
							|  |  |  |     ColorSchemeStyleValue const& as_color_scheme() const; | 
					
						
							|  |  |  |     ColorSchemeStyleValue& as_color_scheme() { return const_cast<ColorSchemeStyleValue&>(const_cast<CSSStyleValue const&>(*this).as_color_scheme()); } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2024-08-14 10:54:09 +01:00
										 |  |  |     bool is_conic_gradient() const { return type() == Type::ConicGradient; } | 
					
						
							|  |  |  |     ConicGradientStyleValue const& as_conic_gradient() const; | 
					
						
							| 
									
										
										
										
											2024-08-14 11:10:54 +01:00
										 |  |  |     ConicGradientStyleValue& as_conic_gradient() { return const_cast<ConicGradientStyleValue&>(const_cast<CSSStyleValue const&>(*this).as_conic_gradient()); } | 
					
						
							| 
									
										
										
										
											2024-08-14 10:54:09 +01:00
										 |  |  | 
 | 
					
						
							|  |  |  |     bool is_content() const { return type() == Type::Content; } | 
					
						
							|  |  |  |     ContentStyleValue const& as_content() const; | 
					
						
							| 
									
										
										
										
											2024-08-14 11:10:54 +01:00
										 |  |  |     ContentStyleValue& as_content() { return const_cast<ContentStyleValue&>(const_cast<CSSStyleValue const&>(*this).as_content()); } | 
					
						
							| 
									
										
										
										
											2024-08-14 10:54:09 +01:00
										 |  |  | 
 | 
					
						
							|  |  |  |     bool is_counter() const { return type() == Type::Counter; } | 
					
						
							|  |  |  |     CounterStyleValue const& as_counter() const; | 
					
						
							| 
									
										
										
										
											2024-08-14 11:10:54 +01:00
										 |  |  |     CounterStyleValue& as_counter() { return const_cast<CounterStyleValue&>(const_cast<CSSStyleValue const&>(*this).as_counter()); } | 
					
						
							| 
									
										
										
										
											2024-08-14 10:54:09 +01:00
										 |  |  | 
 | 
					
						
							|  |  |  |     bool is_counter_definitions() const { return type() == Type::CounterDefinitions; } | 
					
						
							|  |  |  |     CounterDefinitionsStyleValue const& as_counter_definitions() const; | 
					
						
							| 
									
										
										
										
											2024-08-14 11:10:54 +01:00
										 |  |  |     CounterDefinitionsStyleValue& as_counter_definitions() { return const_cast<CounterDefinitionsStyleValue&>(const_cast<CSSStyleValue const&>(*this).as_counter_definitions()); } | 
					
						
							| 
									
										
										
										
											2024-08-14 10:54:09 +01:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2025-02-21 13:04:20 +00:00
										 |  |  |     bool is_cursor() const { return type() == Type::Cursor; } | 
					
						
							|  |  |  |     CursorStyleValue const& as_cursor() const; | 
					
						
							|  |  |  |     CursorStyleValue& as_cursor() { return const_cast<CursorStyleValue&>(const_cast<CSSStyleValue const&>(*this).as_cursor()); } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2024-08-14 10:54:09 +01:00
										 |  |  |     bool is_custom_ident() const { return type() == Type::CustomIdent; } | 
					
						
							|  |  |  |     CustomIdentStyleValue const& as_custom_ident() const; | 
					
						
							| 
									
										
										
										
											2024-08-14 11:10:54 +01:00
										 |  |  |     CustomIdentStyleValue& as_custom_ident() { return const_cast<CustomIdentStyleValue&>(const_cast<CSSStyleValue const&>(*this).as_custom_ident()); } | 
					
						
							| 
									
										
										
										
											2024-08-14 10:54:09 +01:00
										 |  |  | 
 | 
					
						
							|  |  |  |     bool is_display() const { return type() == Type::Display; } | 
					
						
							|  |  |  |     DisplayStyleValue const& as_display() const; | 
					
						
							| 
									
										
										
										
											2024-08-14 11:10:54 +01:00
										 |  |  |     DisplayStyleValue& as_display() { return const_cast<DisplayStyleValue&>(const_cast<CSSStyleValue const&>(*this).as_display()); } | 
					
						
							| 
									
										
										
										
											2024-08-14 10:54:09 +01:00
										 |  |  | 
 | 
					
						
							|  |  |  |     bool is_easing() const { return type() == Type::Easing; } | 
					
						
							|  |  |  |     EasingStyleValue const& as_easing() const; | 
					
						
							| 
									
										
										
										
											2024-08-14 11:10:54 +01:00
										 |  |  |     EasingStyleValue& as_easing() { return const_cast<EasingStyleValue&>(const_cast<CSSStyleValue const&>(*this).as_easing()); } | 
					
						
							| 
									
										
										
										
											2024-08-14 10:54:09 +01:00
										 |  |  | 
 | 
					
						
							|  |  |  |     bool is_edge() const { return type() == Type::Edge; } | 
					
						
							|  |  |  |     EdgeStyleValue const& as_edge() const; | 
					
						
							| 
									
										
										
										
											2024-08-14 11:10:54 +01:00
										 |  |  |     EdgeStyleValue& as_edge() { return const_cast<EdgeStyleValue&>(const_cast<CSSStyleValue const&>(*this).as_edge()); } | 
					
						
							| 
									
										
										
										
											2024-08-14 10:54:09 +01:00
										 |  |  | 
 | 
					
						
							|  |  |  |     bool is_filter_value_list() const { return type() == Type::FilterValueList; } | 
					
						
							|  |  |  |     FilterValueListStyleValue const& as_filter_value_list() const; | 
					
						
							| 
									
										
										
										
											2024-08-14 11:10:54 +01:00
										 |  |  |     FilterValueListStyleValue& as_filter_value_list() { return const_cast<FilterValueListStyleValue&>(const_cast<CSSStyleValue const&>(*this).as_filter_value_list()); } | 
					
						
							| 
									
										
										
										
											2024-08-14 10:54:09 +01:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2025-02-26 18:16:36 +01:00
										 |  |  |     [[nodiscard]] bool is_fit_content() const { return type() == Type::FitContent; } | 
					
						
							|  |  |  |     [[nodiscard]] FitContentStyleValue const& as_fit_content() const; | 
					
						
							|  |  |  |     [[nodiscard]] FitContentStyleValue& as_fit_content() { return const_cast<FitContentStyleValue&>(const_cast<CSSStyleValue const&>(*this).as_fit_content()); } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2024-08-14 10:54:09 +01:00
										 |  |  |     bool is_flex() const { return type() == Type::Flex; } | 
					
						
							|  |  |  |     FlexStyleValue const& as_flex() const; | 
					
						
							| 
									
										
										
										
											2024-08-14 11:10:54 +01:00
										 |  |  |     FlexStyleValue& as_flex() { return const_cast<FlexStyleValue&>(const_cast<CSSStyleValue const&>(*this).as_flex()); } | 
					
						
							| 
									
										
										
										
											2024-08-14 10:54:09 +01:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2025-04-02 17:01:16 +01:00
										 |  |  |     bool is_font_source() const { return type() == Type::FontSource; } | 
					
						
							|  |  |  |     FontSourceStyleValue const& as_font_source() const; | 
					
						
							|  |  |  |     FontSourceStyleValue& as_font_source() { return const_cast<FontSourceStyleValue&>(const_cast<CSSStyleValue const&>(*this).as_font_source()); } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2025-05-02 13:55:58 +01:00
										 |  |  |     bool is_font_style() const { return type() == Type::FontStyle; } | 
					
						
							|  |  |  |     FontStyleStyleValue const& as_font_style() const; | 
					
						
							|  |  |  |     FontStyleStyleValue& as_font_style() { return const_cast<FontStyleStyleValue&>(const_cast<CSSStyleValue const&>(*this).as_font_style()); } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2024-08-14 10:54:09 +01:00
										 |  |  |     bool is_frequency() const { return type() == Type::Frequency; } | 
					
						
							|  |  |  |     FrequencyStyleValue const& as_frequency() const; | 
					
						
							| 
									
										
										
										
											2024-08-14 11:10:54 +01:00
										 |  |  |     FrequencyStyleValue& as_frequency() { return const_cast<FrequencyStyleValue&>(const_cast<CSSStyleValue const&>(*this).as_frequency()); } | 
					
						
							| 
									
										
										
										
											2024-08-14 10:54:09 +01:00
										 |  |  | 
 | 
					
						
							|  |  |  |     bool is_grid_auto_flow() const { return type() == Type::GridAutoFlow; } | 
					
						
							|  |  |  |     GridAutoFlowStyleValue const& as_grid_auto_flow() const; | 
					
						
							| 
									
										
										
										
											2024-08-14 11:10:54 +01:00
										 |  |  |     GridAutoFlowStyleValue& as_grid_auto_flow() { return const_cast<GridAutoFlowStyleValue&>(const_cast<CSSStyleValue const&>(*this).as_grid_auto_flow()); } | 
					
						
							| 
									
										
										
										
											2024-08-14 10:54:09 +01:00
										 |  |  | 
 | 
					
						
							|  |  |  |     bool is_grid_template_area() const { return type() == Type::GridTemplateArea; } | 
					
						
							|  |  |  |     GridTemplateAreaStyleValue const& as_grid_template_area() const; | 
					
						
							| 
									
										
										
										
											2024-08-14 11:10:54 +01:00
										 |  |  |     GridTemplateAreaStyleValue& as_grid_template_area() { return const_cast<GridTemplateAreaStyleValue&>(const_cast<CSSStyleValue const&>(*this).as_grid_template_area()); } | 
					
						
							| 
									
										
										
										
											2024-08-14 10:54:09 +01:00
										 |  |  | 
 | 
					
						
							|  |  |  |     bool is_grid_track_placement() const { return type() == Type::GridTrackPlacement; } | 
					
						
							|  |  |  |     GridTrackPlacementStyleValue const& as_grid_track_placement() const; | 
					
						
							| 
									
										
										
										
											2024-08-14 11:10:54 +01:00
										 |  |  |     GridTrackPlacementStyleValue& as_grid_track_placement() { return const_cast<GridTrackPlacementStyleValue&>(const_cast<CSSStyleValue const&>(*this).as_grid_track_placement()); } | 
					
						
							| 
									
										
										
										
											2024-08-14 10:54:09 +01:00
										 |  |  | 
 | 
					
						
							|  |  |  |     bool is_grid_track_size_list() const { return type() == Type::GridTrackSizeList; } | 
					
						
							|  |  |  |     GridTrackSizeListStyleValue const& as_grid_track_size_list() const; | 
					
						
							| 
									
										
										
										
											2024-08-14 11:10:54 +01:00
										 |  |  |     GridTrackSizeListStyleValue& as_grid_track_size_list() { return const_cast<GridTrackSizeListStyleValue&>(const_cast<CSSStyleValue const&>(*this).as_grid_track_size_list()); } | 
					
						
							| 
									
										
										
										
											2024-08-14 10:54:09 +01:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2025-03-12 15:29:12 +00:00
										 |  |  |     bool is_guaranteed_invalid() const { return type() == Type::GuaranteedInvalid; } | 
					
						
							|  |  |  |     GuaranteedInvalidStyleValue const& as_guaranteed_invalid() const; | 
					
						
							|  |  |  |     GuaranteedInvalidStyleValue& as_guaranteed_invalid() { return const_cast<GuaranteedInvalidStyleValue&>(const_cast<CSSStyleValue const&>(*this).as_guaranteed_invalid()); } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2024-08-14 10:54:09 +01:00
										 |  |  |     bool is_image() const { return type() == Type::Image; } | 
					
						
							|  |  |  |     ImageStyleValue const& as_image() const; | 
					
						
							| 
									
										
										
										
											2024-08-14 11:10:54 +01:00
										 |  |  |     ImageStyleValue& as_image() { return const_cast<ImageStyleValue&>(const_cast<CSSStyleValue const&>(*this).as_image()); } | 
					
						
							| 
									
										
										
										
											2024-08-14 10:54:09 +01:00
										 |  |  | 
 | 
					
						
							|  |  |  |     bool is_integer() const { return type() == Type::Integer; } | 
					
						
							|  |  |  |     IntegerStyleValue const& as_integer() const; | 
					
						
							| 
									
										
										
										
											2024-08-14 11:10:54 +01:00
										 |  |  |     IntegerStyleValue& as_integer() { return const_cast<IntegerStyleValue&>(const_cast<CSSStyleValue const&>(*this).as_integer()); } | 
					
						
							| 
									
										
										
										
											2024-08-14 10:54:09 +01:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2024-08-14 11:46:56 +01:00
										 |  |  |     bool is_keyword() const { return type() == Type::Keyword; } | 
					
						
							|  |  |  |     CSSKeywordValue const& as_keyword() const; | 
					
						
							|  |  |  |     CSSKeywordValue& as_keyword() { return const_cast<CSSKeywordValue&>(const_cast<CSSStyleValue const&>(*this).as_keyword()); } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2024-08-14 10:54:09 +01:00
										 |  |  |     bool is_length() const { return type() == Type::Length; } | 
					
						
							|  |  |  |     LengthStyleValue const& as_length() const; | 
					
						
							| 
									
										
										
										
											2024-08-14 11:10:54 +01:00
										 |  |  |     LengthStyleValue& as_length() { return const_cast<LengthStyleValue&>(const_cast<CSSStyleValue const&>(*this).as_length()); } | 
					
						
							| 
									
										
										
										
											2024-08-14 10:54:09 +01:00
										 |  |  | 
 | 
					
						
							|  |  |  |     bool is_linear_gradient() const { return type() == Type::LinearGradient; } | 
					
						
							|  |  |  |     LinearGradientStyleValue const& as_linear_gradient() const; | 
					
						
							| 
									
										
										
										
											2024-08-14 11:10:54 +01:00
										 |  |  |     LinearGradientStyleValue& as_linear_gradient() { return const_cast<LinearGradientStyleValue&>(const_cast<CSSStyleValue const&>(*this).as_linear_gradient()); } | 
					
						
							| 
									
										
										
										
											2024-08-14 10:54:09 +01:00
										 |  |  | 
 | 
					
						
							|  |  |  |     bool is_math_depth() const { return type() == Type::MathDepth; } | 
					
						
							|  |  |  |     MathDepthStyleValue const& as_math_depth() const; | 
					
						
							| 
									
										
										
										
											2024-08-14 11:10:54 +01:00
										 |  |  |     MathDepthStyleValue& as_math_depth() { return const_cast<MathDepthStyleValue&>(const_cast<CSSStyleValue const&>(*this).as_math_depth()); } | 
					
						
							| 
									
										
										
										
											2024-08-14 10:54:09 +01:00
										 |  |  | 
 | 
					
						
							|  |  |  |     bool is_number() const { return type() == Type::Number; } | 
					
						
							|  |  |  |     NumberStyleValue const& as_number() const; | 
					
						
							| 
									
										
										
										
											2024-08-14 11:10:54 +01:00
										 |  |  |     NumberStyleValue& as_number() { return const_cast<NumberStyleValue&>(const_cast<CSSStyleValue const&>(*this).as_number()); } | 
					
						
							| 
									
										
										
										
											2024-08-14 10:54:09 +01:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2024-09-30 17:05:52 +01:00
										 |  |  |     bool is_open_type_tagged() const { return type() == Type::OpenTypeTagged; } | 
					
						
							|  |  |  |     OpenTypeTaggedStyleValue const& as_open_type_tagged() const; | 
					
						
							|  |  |  |     OpenTypeTaggedStyleValue& as_open_type_tagged() { return const_cast<OpenTypeTaggedStyleValue&>(const_cast<CSSStyleValue const&>(*this).as_open_type_tagged()); } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2025-03-12 19:24:59 +00:00
										 |  |  |     bool is_pending_substitution() const { return type() == Type::PendingSubstitution; } | 
					
						
							|  |  |  |     PendingSubstitutionStyleValue const& as_pending_substitution() const; | 
					
						
							|  |  |  |     PendingSubstitutionStyleValue& as_pending_substitution() { return const_cast<PendingSubstitutionStyleValue&>(const_cast<CSSStyleValue const&>(*this).as_pending_substitution()); } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2024-08-14 10:54:09 +01:00
										 |  |  |     bool is_percentage() const { return type() == Type::Percentage; } | 
					
						
							|  |  |  |     PercentageStyleValue const& as_percentage() const; | 
					
						
							| 
									
										
										
										
											2024-08-14 11:10:54 +01:00
										 |  |  |     PercentageStyleValue& as_percentage() { return const_cast<PercentageStyleValue&>(const_cast<CSSStyleValue const&>(*this).as_percentage()); } | 
					
						
							| 
									
										
										
										
											2024-08-14 10:54:09 +01:00
										 |  |  | 
 | 
					
						
							|  |  |  |     bool is_position() const { return type() == Type::Position; } | 
					
						
							|  |  |  |     PositionStyleValue const& as_position() const; | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2024-08-14 11:10:54 +01:00
										 |  |  |     PositionStyleValue& as_position() { return const_cast<PositionStyleValue&>(const_cast<CSSStyleValue const&>(*this).as_position()); } | 
					
						
							| 
									
										
										
										
											2024-08-14 10:54:09 +01:00
										 |  |  |     bool is_radial_gradient() const { return type() == Type::RadialGradient; } | 
					
						
							|  |  |  |     RadialGradientStyleValue const& as_radial_gradient() const; | 
					
						
							| 
									
										
										
										
											2024-08-14 11:10:54 +01:00
										 |  |  |     RadialGradientStyleValue& as_radial_gradient() { return const_cast<RadialGradientStyleValue&>(const_cast<CSSStyleValue const&>(*this).as_radial_gradient()); } | 
					
						
							| 
									
										
										
										
											2024-08-14 10:54:09 +01:00
										 |  |  | 
 | 
					
						
							|  |  |  |     bool is_ratio() const { return type() == Type::Ratio; } | 
					
						
							|  |  |  |     RatioStyleValue const& as_ratio() const; | 
					
						
							| 
									
										
										
										
											2024-08-14 11:10:54 +01:00
										 |  |  |     RatioStyleValue& as_ratio() { return const_cast<RatioStyleValue&>(const_cast<CSSStyleValue const&>(*this).as_ratio()); } | 
					
						
							| 
									
										
										
										
											2024-08-14 10:54:09 +01:00
										 |  |  | 
 | 
					
						
							|  |  |  |     bool is_rect() const { return type() == Type::Rect; } | 
					
						
							|  |  |  |     RectStyleValue const& as_rect() const; | 
					
						
							| 
									
										
										
										
											2024-08-14 11:10:54 +01:00
										 |  |  |     RectStyleValue& as_rect() { return const_cast<RectStyleValue&>(const_cast<CSSStyleValue const&>(*this).as_rect()); } | 
					
						
							| 
									
										
										
										
											2024-08-14 10:54:09 +01:00
										 |  |  | 
 | 
					
						
							|  |  |  |     bool is_resolution() const { return type() == Type::Resolution; } | 
					
						
							|  |  |  |     ResolutionStyleValue const& as_resolution() const; | 
					
						
							| 
									
										
										
										
											2024-08-14 11:10:54 +01:00
										 |  |  |     ResolutionStyleValue& as_resolution() { return const_cast<ResolutionStyleValue&>(const_cast<CSSStyleValue const&>(*this).as_resolution()); } | 
					
						
							| 
									
										
										
										
											2024-08-14 10:54:09 +01:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2025-05-26 22:36:12 +01:00
										 |  |  |     bool is_scrollbar_color() const { return type() == Type::ScrollbarColor; } | 
					
						
							|  |  |  |     ScrollbarColorStyleValue const& as_scrollbar_color() const; | 
					
						
							|  |  |  |     ScrollbarColorStyleValue& as_scrollbar_color() { return const_cast<ScrollbarColorStyleValue&>(const_cast<CSSStyleValue const&>(*this).as_scrollbar_color()); } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2024-08-14 10:54:09 +01:00
										 |  |  |     bool is_scrollbar_gutter() const { return type() == Type::ScrollbarGutter; } | 
					
						
							|  |  |  |     ScrollbarGutterStyleValue const& as_scrollbar_gutter() const; | 
					
						
							| 
									
										
										
										
											2024-08-14 11:10:54 +01:00
										 |  |  |     ScrollbarGutterStyleValue& as_scrollbar_gutter() { return const_cast<ScrollbarGutterStyleValue&>(const_cast<CSSStyleValue const&>(*this).as_scrollbar_gutter()); } | 
					
						
							| 
									
										
										
										
											2024-08-14 10:54:09 +01:00
										 |  |  | 
 | 
					
						
							|  |  |  |     bool is_shadow() const { return type() == Type::Shadow; } | 
					
						
							|  |  |  |     ShadowStyleValue const& as_shadow() const; | 
					
						
							| 
									
										
										
										
											2024-08-14 11:10:54 +01:00
										 |  |  |     ShadowStyleValue& as_shadow() { return const_cast<ShadowStyleValue&>(const_cast<CSSStyleValue const&>(*this).as_shadow()); } | 
					
						
							| 
									
										
										
										
											2024-08-14 10:54:09 +01:00
										 |  |  | 
 | 
					
						
							|  |  |  |     bool is_shorthand() const { return type() == Type::Shorthand; } | 
					
						
							|  |  |  |     ShorthandStyleValue const& as_shorthand() const; | 
					
						
							| 
									
										
										
										
											2024-08-14 11:10:54 +01:00
										 |  |  |     ShorthandStyleValue& as_shorthand() { return const_cast<ShorthandStyleValue&>(const_cast<CSSStyleValue const&>(*this).as_shorthand()); } | 
					
						
							| 
									
										
										
										
											2024-08-14 10:54:09 +01:00
										 |  |  | 
 | 
					
						
							|  |  |  |     bool is_string() const { return type() == Type::String; } | 
					
						
							|  |  |  |     StringStyleValue const& as_string() const; | 
					
						
							| 
									
										
										
										
											2024-08-14 11:10:54 +01:00
										 |  |  |     StringStyleValue& as_string() { return const_cast<StringStyleValue&>(const_cast<CSSStyleValue const&>(*this).as_string()); } | 
					
						
							| 
									
										
										
										
											2024-08-14 10:54:09 +01:00
										 |  |  | 
 | 
					
						
							|  |  |  |     bool is_time() const { return type() == Type::Time; } | 
					
						
							|  |  |  |     TimeStyleValue const& as_time() const; | 
					
						
							| 
									
										
										
										
											2024-08-14 11:10:54 +01:00
										 |  |  |     TimeStyleValue& as_time() { return const_cast<TimeStyleValue&>(const_cast<CSSStyleValue const&>(*this).as_time()); } | 
					
						
							| 
									
										
										
										
											2024-08-14 10:54:09 +01:00
										 |  |  | 
 | 
					
						
							|  |  |  |     bool is_transformation() const { return type() == Type::Transformation; } | 
					
						
							|  |  |  |     TransformationStyleValue const& as_transformation() const; | 
					
						
							| 
									
										
										
										
											2024-08-14 11:10:54 +01:00
										 |  |  |     TransformationStyleValue& as_transformation() { return const_cast<TransformationStyleValue&>(const_cast<CSSStyleValue const&>(*this).as_transformation()); } | 
					
						
							| 
									
										
										
										
											2024-08-14 10:54:09 +01:00
										 |  |  | 
 | 
					
						
							|  |  |  |     bool is_transition() const { return type() == Type::Transition; } | 
					
						
							|  |  |  |     TransitionStyleValue const& as_transition() const; | 
					
						
							| 
									
										
										
										
											2024-08-14 11:10:54 +01:00
										 |  |  |     TransitionStyleValue& as_transition() { return const_cast<TransitionStyleValue&>(const_cast<CSSStyleValue const&>(*this).as_transition()); } | 
					
						
							| 
									
										
										
										
											2024-08-14 10:54:09 +01:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2025-03-27 17:35:06 +00:00
										 |  |  |     bool is_unicode_range() const { return type() == Type::UnicodeRange; } | 
					
						
							|  |  |  |     UnicodeRangeStyleValue const& as_unicode_range() const; | 
					
						
							|  |  |  |     UnicodeRangeStyleValue& as_unicode_range() { return const_cast<UnicodeRangeStyleValue&>(const_cast<CSSStyleValue const&>(*this).as_unicode_range()); } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2024-08-14 10:54:09 +01:00
										 |  |  |     bool is_unresolved() const { return type() == Type::Unresolved; } | 
					
						
							|  |  |  |     UnresolvedStyleValue const& as_unresolved() const; | 
					
						
							| 
									
										
										
										
											2024-08-14 11:10:54 +01:00
										 |  |  |     UnresolvedStyleValue& as_unresolved() { return const_cast<UnresolvedStyleValue&>(const_cast<CSSStyleValue const&>(*this).as_unresolved()); } | 
					
						
							| 
									
										
										
										
											2024-08-14 10:54:09 +01:00
										 |  |  | 
 | 
					
						
							|  |  |  |     bool is_url() const { return type() == Type::URL; } | 
					
						
							|  |  |  |     URLStyleValue const& as_url() const; | 
					
						
							| 
									
										
										
										
											2024-08-14 11:10:54 +01:00
										 |  |  |     URLStyleValue& as_url() { return const_cast<URLStyleValue&>(const_cast<CSSStyleValue const&>(*this).as_url()); } | 
					
						
							| 
									
										
										
										
											2024-08-14 10:54:09 +01:00
										 |  |  | 
 | 
					
						
							|  |  |  |     bool is_value_list() const { return type() == Type::ValueList; } | 
					
						
							|  |  |  |     StyleValueList const& as_value_list() const; | 
					
						
							| 
									
										
										
										
											2024-08-14 11:10:54 +01:00
										 |  |  |     StyleValueList& as_value_list() { return const_cast<StyleValueList&>(const_cast<CSSStyleValue const&>(*this).as_value_list()); } | 
					
						
							| 
									
										
										
										
											2024-08-14 10:54:09 +01:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2023-09-20 16:58:45 +01:00
										 |  |  |     // https://www.w3.org/TR/css-values-4/#common-keywords
 | 
					
						
							|  |  |  |     // https://drafts.csswg.org/css-cascade-4/#valdef-all-revert
 | 
					
						
							| 
									
										
										
										
											2024-09-11 20:13:44 +08:00
										 |  |  |     bool is_css_wide_keyword() const { return is_inherit() || is_initial() || is_revert() || is_unset() || is_revert_layer(); } | 
					
						
							| 
									
										
										
										
											2024-08-14 15:00:10 +01:00
										 |  |  |     bool is_inherit() const { return to_keyword() == Keyword::Inherit; } | 
					
						
							|  |  |  |     bool is_initial() const { return to_keyword() == Keyword::Initial; } | 
					
						
							|  |  |  |     bool is_revert() const { return to_keyword() == Keyword::Revert; } | 
					
						
							| 
									
										
										
										
											2024-09-11 20:13:44 +08:00
										 |  |  |     bool is_revert_layer() const { return to_keyword() == Keyword::RevertLayer; } | 
					
						
							| 
									
										
										
										
											2024-08-14 15:00:10 +01:00
										 |  |  |     bool is_unset() const { return to_keyword() == Keyword::Unset; } | 
					
						
							| 
									
										
										
										
											2021-09-23 19:54:19 +01:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2023-04-19 12:00:38 +01:00
										 |  |  |     bool has_auto() const; | 
					
						
							| 
									
										
										
										
											2021-09-23 19:54:19 +01:00
										 |  |  |     virtual bool has_color() const { return false; } | 
					
						
							| 
									
										
										
										
											2021-09-23 12:45:08 +01:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2024-08-14 11:10:54 +01:00
										 |  |  |     virtual ValueComparingNonnullRefPtr<CSSStyleValue const> absolutized(CSSPixelRect const& viewport_rect, Length::FontMetrics const& font_metrics, Length::FontMetrics const& root_font_metrics) const; | 
					
						
							| 
									
										
										
										
											2022-02-26 01:35:25 +01:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2025-07-03 12:59:24 +12:00
										 |  |  |     virtual Optional<Color> to_color(Optional<Layout::NodeWithStyle const&>, CalculationResolutionContext const&) const { return {}; } | 
					
						
							| 
									
										
										
										
											2024-08-14 14:06:03 +01:00
										 |  |  |     Keyword to_keyword() const; | 
					
						
							| 
									
										
										
										
											2024-12-07 00:59:49 +01:00
										 |  |  | 
 | 
					
						
							|  |  |  |     virtual String to_string(SerializationMode) const = 0; | 
					
						
							| 
									
										
										
										
											2025-07-10 12:17:27 +01:00
										 |  |  |     virtual Vector<Parser::ComponentValue> tokenize() const; | 
					
						
							| 
									
										
										
										
											2019-08-18 08:09:56 +02:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2023-05-24 15:28:09 +02:00
										 |  |  |     [[nodiscard]] int to_font_weight() const; | 
					
						
							|  |  |  |     [[nodiscard]] int to_font_slope() const; | 
					
						
							| 
									
										
										
										
											2024-09-27 14:04:59 +01:00
										 |  |  |     [[nodiscard]] int to_font_width() const; | 
					
						
							| 
									
										
										
										
											2023-05-24 15:28:09 +02:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2025-04-10 16:35:59 +01:00
										 |  |  |     virtual void set_style_sheet(GC::Ptr<CSSStyleSheet>) { } | 
					
						
							| 
									
										
										
										
											2025-03-26 14:40:23 +00:00
										 |  |  |     virtual void visit_edges(JS::Cell::Visitor&) const { } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2024-08-14 11:10:54 +01:00
										 |  |  |     virtual bool equals(CSSStyleValue const& other) const = 0; | 
					
						
							| 
									
										
										
										
											2023-02-20 00:41:51 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2024-08-14 11:10:54 +01:00
										 |  |  |     bool operator==(CSSStyleValue const& other) const | 
					
						
							| 
									
										
										
										
											2023-02-20 00:41:51 +00:00
										 |  |  |     { | 
					
						
							|  |  |  |         return this->equals(other); | 
					
						
							|  |  |  |     } | 
					
						
							| 
									
										
										
										
											2020-12-14 15:04:13 +01:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2019-06-20 23:25:25 +02:00
										 |  |  | protected: | 
					
						
							| 
									
										
										
										
											2024-08-14 11:10:54 +01:00
										 |  |  |     explicit CSSStyleValue(Type); | 
					
						
							| 
									
										
										
										
											2019-06-20 23:25:25 +02:00
										 |  |  | 
 | 
					
						
							|  |  |  | private: | 
					
						
							| 
									
										
										
										
											2023-05-06 12:43:29 +01:00
										 |  |  |     Type m_type; | 
					
						
							| 
									
										
										
										
											2019-06-20 23:25:25 +02:00
										 |  |  | }; | 
					
						
							| 
									
										
										
										
											2019-06-22 21:48:21 +02:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2023-02-11 19:12:00 +01:00
										 |  |  | template<typename T> | 
					
						
							| 
									
										
										
										
											2024-08-14 11:10:54 +01:00
										 |  |  | struct StyleValueWithDefaultOperators : public CSSStyleValue { | 
					
						
							|  |  |  |     using CSSStyleValue::CSSStyleValue; | 
					
						
							| 
									
										
										
										
											2025-04-10 16:35:59 +01:00
										 |  |  |     using Base = CSSStyleValue; | 
					
						
							| 
									
										
										
										
											2023-02-11 19:12:00 +01:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2024-08-14 11:10:54 +01:00
										 |  |  |     virtual bool equals(CSSStyleValue const& other) const override | 
					
						
							| 
									
										
										
										
											2023-02-11 19:12:00 +01:00
										 |  |  |     { | 
					
						
							|  |  |  |         if (type() != other.type()) | 
					
						
							|  |  |  |             return false; | 
					
						
							|  |  |  |         auto const& typed_other = static_cast<T const&>(other); | 
					
						
							| 
									
										
										
										
											2023-02-20 00:41:51 +00:00
										 |  |  |         return static_cast<T const&>(*this).properties_equal(typed_other); | 
					
						
							| 
									
										
										
										
											2023-02-11 19:12:00 +01:00
										 |  |  |     } | 
					
						
							|  |  |  | }; | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2020-03-07 10:27:02 +01:00
										 |  |  | } | 
					
						
							| 
									
										
										
										
											2022-02-02 20:53:55 +00:00
										 |  |  | 
 | 
					
						
							|  |  |  | template<> | 
					
						
							| 
									
										
										
										
											2024-08-14 11:10:54 +01:00
										 |  |  | struct AK::Formatter<Web::CSS::CSSStyleValue> : Formatter<StringView> { | 
					
						
							|  |  |  |     ErrorOr<void> format(FormatBuilder& builder, Web::CSS::CSSStyleValue const& style_value) | 
					
						
							| 
									
										
										
										
											2022-02-02 20:53:55 +00:00
										 |  |  |     { | 
					
						
							| 
									
										
										
										
											2025-05-16 19:20:24 +01:00
										 |  |  |         return Formatter<StringView>::format(builder, style_value.to_string(Web::CSS::SerializationMode::Normal)); | 
					
						
							| 
									
										
										
										
											2022-02-02 20:53:55 +00:00
										 |  |  |     } | 
					
						
							|  |  |  | }; |