| 
									
										
										
										
											2021-03-09 17:36:21 +01:00
										 |  |  | /*
 | 
					
						
							| 
									
										
										
										
											2021-04-28 22:46:44 +02:00
										 |  |  |  * Copyright (c) 2020-2021, the SerenityOS developers. | 
					
						
							| 
									
										
										
										
											2021-09-03 11:14:37 +01:00
										 |  |  |  * Copyright (c) 2021, Sam Atkins <atkinssj@serenityos.org> | 
					
						
							| 
									
										
										
										
											2021-03-09 17:36:21 +01:00
										 |  |  |  * | 
					
						
							| 
									
										
										
										
											2021-04-22 01:24:48 -07:00
										 |  |  |  * SPDX-License-Identifier: BSD-2-Clause | 
					
						
							| 
									
										
										
										
											2021-03-09 17:36:21 +01:00
										 |  |  |  */ | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | #pragma once
 | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2022-04-12 16:53:22 +01:00
										 |  |  | #include <AK/FlyString.h>
 | 
					
						
							| 
									
										
										
										
											2021-07-01 16:49:33 +01:00
										 |  |  | #include <AK/RefCounted.h>
 | 
					
						
							| 
									
										
										
										
											2021-03-09 17:36:21 +01:00
										 |  |  | #include <AK/Vector.h>
 | 
					
						
							| 
									
										
										
										
											2022-04-12 14:08:26 +01:00
										 |  |  | #include <LibWeb/CSS/Parser/Block.h>
 | 
					
						
							| 
									
										
										
										
											2022-03-31 11:43:07 +01:00
										 |  |  | #include <LibWeb/CSS/Parser/ComponentValue.h>
 | 
					
						
							| 
									
										
										
										
											2021-03-09 17:36:21 +01:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2022-04-12 14:55:53 +01:00
										 |  |  | namespace Web::CSS::Parser { | 
					
						
							| 
									
										
										
										
											2021-03-09 17:36:21 +01:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2021-07-03 13:36:33 +01:00
										 |  |  | class StyleRule : public RefCounted<StyleRule> { | 
					
						
							| 
									
										
										
										
											2022-04-12 14:55:53 +01:00
										 |  |  |     friend class Parser; | 
					
						
							| 
									
										
										
										
											2021-03-09 17:36:21 +01:00
										 |  |  | 
 | 
					
						
							|  |  |  | public: | 
					
						
							| 
									
										
										
										
											2021-07-03 13:36:33 +01:00
										 |  |  |     enum class Type { | 
					
						
							|  |  |  |         At, | 
					
						
							|  |  |  |         Qualified, | 
					
						
							|  |  |  |     }; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     StyleRule(Type); | 
					
						
							|  |  |  |     ~StyleRule(); | 
					
						
							| 
									
										
										
										
											2021-07-01 14:13:48 +01:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2022-03-30 16:42:43 +01:00
										 |  |  |     bool is_qualified_rule() const { return m_type == Type::Qualified; } | 
					
						
							|  |  |  |     bool is_at_rule() const { return m_type == Type::At; } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2022-04-12 14:55:53 +01:00
										 |  |  |     Vector<ComponentValue> const& prelude() const { return m_prelude; } | 
					
						
							|  |  |  |     RefPtr<Block const> block() const { return m_block; } | 
					
						
							| 
									
										
										
										
											2022-04-12 16:53:22 +01:00
										 |  |  |     StringView at_rule_name() const { return m_at_rule_name; } | 
					
						
							| 
									
										
										
										
											2021-07-01 14:13:48 +01:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2021-03-09 17:36:21 +01:00
										 |  |  |     String to_string() const; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | private: | 
					
						
							| 
									
										
										
										
											2021-07-03 13:36:33 +01:00
										 |  |  |     Type const m_type; | 
					
						
							| 
									
										
										
										
											2022-04-12 16:53:22 +01:00
										 |  |  |     FlyString m_at_rule_name; | 
					
						
							| 
									
										
										
										
											2022-04-12 14:55:53 +01:00
										 |  |  |     Vector<ComponentValue> m_prelude; | 
					
						
							|  |  |  |     RefPtr<Block> m_block; | 
					
						
							| 
									
										
										
										
											2021-03-09 17:36:21 +01:00
										 |  |  | }; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | } |