| 
									
										
										
										
											2020-01-18 09:38:21 +01:00
										 |  |  | /*
 | 
					
						
							|  |  |  |  * Copyright (c) 2018-2020, Andreas Kling <kling@serenityos.org> | 
					
						
							| 
									
										
										
										
											2021-02-21 13:45:26 +02:00
										 |  |  |  * Copyright (c) 2021, the SerenityOS developers. | 
					
						
							| 
									
										
										
										
											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
 | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2021-07-12 17:30:40 +01:00
										 |  |  | #include <AK/NonnullRefPtr.h>
 | 
					
						
							| 
									
										
										
										
											2019-06-27 12:16:20 +02:00
										 |  |  | #include <AK/NonnullRefPtrVector.h>
 | 
					
						
							| 
									
										
										
										
											2021-02-21 13:45:26 +02:00
										 |  |  | #include <LibWeb/CSS/CSSRule.h>
 | 
					
						
							| 
									
										
										
										
											2021-03-13 20:11:33 +01:00
										 |  |  | #include <LibWeb/CSS/CSSStyleDeclaration.h>
 | 
					
						
							| 
									
										
										
										
											2020-03-07 10:32:51 +01:00
										 |  |  | #include <LibWeb/CSS/Selector.h>
 | 
					
						
							| 
									
										
										
										
											2019-06-20 23:25:25 +02:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2020-07-26 20:01:35 +02:00
										 |  |  | namespace Web::CSS { | 
					
						
							| 
									
										
										
										
											2020-03-07 10:27:02 +01:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2021-03-07 15:00:02 +01:00
										 |  |  | class CSSStyleRule : public CSSRule { | 
					
						
							|  |  |  |     AK_MAKE_NONCOPYABLE(CSSStyleRule); | 
					
						
							|  |  |  |     AK_MAKE_NONMOVABLE(CSSStyleRule); | 
					
						
							| 
									
										
										
										
											2020-06-10 16:41:30 +02:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2019-06-20 23:25:25 +02:00
										 |  |  | public: | 
					
						
							| 
									
										
										
										
											2021-07-12 17:30:40 +01:00
										 |  |  |     static NonnullRefPtr<CSSStyleRule> create(NonnullRefPtrVector<Selector>&& selectors, NonnullRefPtr<CSSStyleDeclaration>&& declaration) | 
					
						
							| 
									
										
										
										
											2019-06-21 19:19:49 +02:00
										 |  |  |     { | 
					
						
							| 
									
										
										
										
											2021-04-23 16:46:57 +02:00
										 |  |  |         return adopt_ref(*new CSSStyleRule(move(selectors), move(declaration))); | 
					
						
							| 
									
										
										
										
											2019-06-21 19:19:49 +02:00
										 |  |  |     } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2021-03-07 15:00:02 +01:00
										 |  |  |     ~CSSStyleRule(); | 
					
						
							| 
									
										
										
										
											2019-06-20 23:25:25 +02:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2021-07-12 17:30:40 +01:00
										 |  |  |     const NonnullRefPtrVector<Selector>& selectors() const { return m_selectors; } | 
					
						
							| 
									
										
										
										
											2021-03-13 20:11:33 +01:00
										 |  |  |     const CSSStyleDeclaration& declaration() const { return m_declaration; } | 
					
						
							| 
									
										
										
										
											2019-06-25 06:31:47 +02:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2021-03-07 15:00:02 +01:00
										 |  |  |     virtual StringView class_name() const { return "CSSStyleRule"; }; | 
					
						
							| 
									
										
										
										
											2021-02-21 13:45:26 +02:00
										 |  |  |     virtual Type type() const { return Type::Style; }; | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2019-06-20 23:25:25 +02:00
										 |  |  | private: | 
					
						
							| 
									
										
										
										
											2021-07-12 17:30:40 +01:00
										 |  |  |     CSSStyleRule(NonnullRefPtrVector<Selector>&&, NonnullRefPtr<CSSStyleDeclaration>&&); | 
					
						
							| 
									
										
										
										
											2019-06-21 19:19:49 +02:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2021-07-12 17:30:40 +01:00
										 |  |  |     NonnullRefPtrVector<Selector> m_selectors; | 
					
						
							| 
									
										
										
										
											2021-03-13 20:11:33 +01:00
										 |  |  |     NonnullRefPtr<CSSStyleDeclaration> m_declaration; | 
					
						
							| 
									
										
										
										
											2019-06-20 23:25:25 +02:00
										 |  |  | }; | 
					
						
							| 
									
										
										
										
											2020-03-07 10:27:02 +01:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2021-03-18 21:50:52 +01:00
										 |  |  | template<> | 
					
						
							|  |  |  | inline bool CSSRule::fast_is<CSSStyleRule>() const { return type() == CSSRule::Type::Style; } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2020-03-07 10:27:02 +01:00
										 |  |  | } |