| 
									
										
										
										
											2023-03-24 17:48:42 +00:00
										 |  |  | /*
 | 
					
						
							| 
									
										
										
										
											2024-07-17 12:42:12 +01:00
										 |  |  |  * Copyright (c) 2022-2024, Sam Atkins <atkinssj@serenityos.org> | 
					
						
							| 
									
										
										
										
											2023-03-24 17:48:42 +00:00
										 |  |  |  * | 
					
						
							|  |  |  |  * SPDX-License-Identifier: BSD-2-Clause | 
					
						
							|  |  |  |  */ | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | #pragma once
 | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2024-07-17 12:42:12 +01:00
										 |  |  | #include <AK/FlyString.h>
 | 
					
						
							| 
									
										
										
										
											2024-08-14 11:10:54 +01:00
										 |  |  | #include <LibWeb/CSS/CSSStyleValue.h>
 | 
					
						
							| 
									
										
										
										
											2023-03-24 17:48:42 +00:00
										 |  |  | 
 | 
					
						
							|  |  |  | namespace Web::CSS { | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | class StringStyleValue : public StyleValueWithDefaultOperators<StringStyleValue> { | 
					
						
							|  |  |  | public: | 
					
						
							| 
									
										
										
										
											2024-07-17 12:42:12 +01:00
										 |  |  |     static ValueComparingNonnullRefPtr<StringStyleValue> create(FlyString const& string) | 
					
						
							| 
									
										
										
										
											2023-03-24 17:48:42 +00:00
										 |  |  |     { | 
					
						
							| 
									
										
										
										
											2023-08-19 14:00:10 +01:00
										 |  |  |         return adopt_ref(*new (nothrow) StringStyleValue(string)); | 
					
						
							| 
									
										
										
										
											2023-03-24 17:48:42 +00:00
										 |  |  |     } | 
					
						
							|  |  |  |     virtual ~StringStyleValue() override = default; | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2024-07-17 12:42:12 +01:00
										 |  |  |     FlyString string_value() const { return m_string; } | 
					
						
							| 
									
										
										
										
											2023-09-12 11:33:11 +01:00
										 |  |  |     String to_string() const override { return serialize_a_string(m_string); } | 
					
						
							| 
									
										
										
										
											2023-03-24 17:48:42 +00:00
										 |  |  | 
 | 
					
						
							|  |  |  |     bool properties_equal(StringStyleValue const& other) const { return m_string == other.m_string; } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | private: | 
					
						
							| 
									
										
										
										
											2024-07-17 12:42:12 +01:00
										 |  |  |     explicit StringStyleValue(FlyString const& string) | 
					
						
							| 
									
										
										
										
											2023-03-24 17:48:42 +00:00
										 |  |  |         : StyleValueWithDefaultOperators(Type::String) | 
					
						
							|  |  |  |         , m_string(string) | 
					
						
							|  |  |  |     { | 
					
						
							|  |  |  |     } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2024-07-17 12:42:12 +01:00
										 |  |  |     FlyString m_string; | 
					
						
							| 
									
										
										
										
											2023-03-24 17:48:42 +00:00
										 |  |  | }; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | } |