| 
									
										
										
										
											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
 | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2021-07-01 14:13:48 +01:00
										 |  |  | #include <AK/RefCounted.h>
 | 
					
						
							| 
									
										
										
										
											2021-03-09 17:36:21 +01:00
										 |  |  | #include <AK/Vector.h>
 | 
					
						
							| 
									
										
										
										
											2022-03-31 11:43:07 +01:00
										 |  |  | #include <LibWeb/CSS/Parser/ComponentValue.h>
 | 
					
						
							| 
									
										
										
										
											2021-03-09 17:36:21 +01:00
										 |  |  | #include <LibWeb/CSS/Parser/Token.h>
 | 
					
						
							| 
									
										
										
										
											2022-04-12 12:00:07 +01:00
										 |  |  | #include <LibWeb/Forward.h>
 | 
					
						
							| 
									
										
										
										
											2021-03-09 17:36:21 +01:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2022-04-12 14:08:26 +01:00
										 |  |  | namespace Web::CSS::Parser { | 
					
						
							| 
									
										
										
										
											2021-03-09 17:36:21 +01:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2022-04-12 14:08:26 +01:00
										 |  |  | class Block : public RefCounted<Block> { | 
					
						
							| 
									
										
										
										
											2021-03-09 17:36:21 +01:00
										 |  |  | public: | 
					
						
							| 
									
										
										
										
											2022-04-12 16:05:44 +01:00
										 |  |  |     static NonnullRefPtr<Block> create(Token token, Vector<ComponentValue>&& values) | 
					
						
							|  |  |  |     { | 
					
						
							|  |  |  |         return adopt_ref(*new Block(move(token), move(values))); | 
					
						
							|  |  |  |     } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2022-04-12 14:08:26 +01:00
										 |  |  |     ~Block(); | 
					
						
							| 
									
										
										
										
											2021-03-09 17:36:21 +01:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2021-07-03 15:06:53 +01:00
										 |  |  |     bool is_curly() const { return m_token.is(Token::Type::OpenCurly); } | 
					
						
							|  |  |  |     bool is_paren() const { return m_token.is(Token::Type::OpenParen); } | 
					
						
							|  |  |  |     bool is_square() const { return m_token.is(Token::Type::OpenSquare); } | 
					
						
							| 
									
										
										
										
											2021-06-30 16:27:37 +01:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2021-12-03 12:12:44 +00:00
										 |  |  |     Token const& token() const { return m_token; } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2022-04-12 14:08:26 +01:00
										 |  |  |     Vector<ComponentValue> const& values() const { return m_values; } | 
					
						
							| 
									
										
										
										
											2021-06-30 16:27:37 +01:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2022-12-04 18:02:33 +00:00
										 |  |  |     DeprecatedString to_string() const; | 
					
						
							| 
									
										
										
										
											2021-03-09 17:36:21 +01:00
										 |  |  | 
 | 
					
						
							|  |  |  | private: | 
					
						
							| 
									
										
										
										
											2022-04-12 16:05:44 +01:00
										 |  |  |     Block(Token, Vector<ComponentValue>&&); | 
					
						
							| 
									
										
										
										
											2021-03-09 17:36:21 +01:00
										 |  |  |     Token m_token; | 
					
						
							| 
									
										
										
										
											2022-04-12 14:08:26 +01:00
										 |  |  |     Vector<ComponentValue> m_values; | 
					
						
							| 
									
										
										
										
											2021-03-09 17:36:21 +01:00
										 |  |  | }; | 
					
						
							|  |  |  | } |