| 
									
										
										
										
											2025-05-02 13:55:58 +01:00
										 |  |  | /*
 | 
					
						
							|  |  |  |  * Copyright (c) 2025, Tim Ledbetter <tim.ledbetter@ladybird.org> | 
					
						
							|  |  |  |  * | 
					
						
							|  |  |  |  * SPDX-License-Identifier: BSD-2-Clause | 
					
						
							|  |  |  |  */ | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | #pragma once
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | #include <LibWeb/CSS/Enums.h>
 | 
					
						
							| 
									
										
										
										
											2025-08-08 10:11:51 +01:00
										 |  |  | #include <LibWeb/CSS/StyleValues/StyleValue.h>
 | 
					
						
							| 
									
										
										
										
											2025-05-02 13:55:58 +01:00
										 |  |  | 
 | 
					
						
							|  |  |  | namespace Web::CSS { | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | class FontStyleStyleValue final : public StyleValueWithDefaultOperators<FontStyleStyleValue> { | 
					
						
							|  |  |  | public: | 
					
						
							| 
									
										
										
										
											2025-08-08 10:11:51 +01:00
										 |  |  |     static ValueComparingNonnullRefPtr<FontStyleStyleValue const> create(FontStyle font_style, ValueComparingRefPtr<StyleValue const> angle_value = {}) | 
					
						
							| 
									
										
										
										
											2025-05-02 13:55:58 +01:00
										 |  |  |     { | 
					
						
							|  |  |  |         return adopt_ref(*new (nothrow) FontStyleStyleValue(font_style, angle_value)); | 
					
						
							|  |  |  |     } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     virtual ~FontStyleStyleValue() override; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     FontStyle font_style() const { return m_font_style; } | 
					
						
							| 
									
										
										
										
											2025-08-08 10:11:51 +01:00
										 |  |  |     ValueComparingRefPtr<StyleValue const> angle() const { return m_angle_value; } | 
					
						
							| 
									
										
										
										
											2025-05-02 13:55:58 +01:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2025-09-02 22:41:48 +12:00
										 |  |  |     int to_font_slope() const; | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2025-05-02 13:55:58 +01:00
										 |  |  |     virtual String to_string(SerializationMode) const override; | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2025-08-08 10:11:51 +01:00
										 |  |  |     bool equals(StyleValue const& other) const override | 
					
						
							| 
									
										
										
										
											2025-05-02 13:55:58 +01:00
										 |  |  |     { | 
					
						
							|  |  |  |         if (type() != other.type()) | 
					
						
							|  |  |  |             return false; | 
					
						
							|  |  |  |         auto const& other_font_style = other.as_font_style(); | 
					
						
							|  |  |  |         return m_font_style == other_font_style.m_font_style && m_angle_value == other_font_style.m_angle_value; | 
					
						
							|  |  |  |     } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     bool properties_equal(FontStyleStyleValue const& other) const { return m_font_style == other.m_font_style && m_angle_value == other.m_angle_value; } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | private: | 
					
						
							| 
									
										
										
										
											2025-08-08 10:11:51 +01:00
										 |  |  |     FontStyleStyleValue(FontStyle, ValueComparingRefPtr<StyleValue const> angle_value); | 
					
						
							| 
									
										
										
										
											2025-05-02 13:55:58 +01:00
										 |  |  | 
 | 
					
						
							|  |  |  |     FontStyle m_font_style; | 
					
						
							| 
									
										
										
										
											2025-08-08 10:11:51 +01:00
										 |  |  |     ValueComparingRefPtr<StyleValue const> m_angle_value; | 
					
						
							| 
									
										
										
										
											2025-05-02 13:55:58 +01:00
										 |  |  | }; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | } |