| 
									
										
										
										
											2020-01-18 09:38:21 +01:00
										 |  |  | /*
 | 
					
						
							| 
									
										
										
										
											2024-10-04 13:19:50 +02:00
										 |  |  |  * Copyright (c) 2018-2020, Andreas Kling <andreas@ladybird.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>
 | 
					
						
							| 
									
										
										
										
											2024-10-08 12:06:53 +01:00
										 |  |  | #include <LibWeb/CSS/CSSGroupingRule.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
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2024-10-08 12:06:53 +01:00
										 |  |  | class CSSStyleRule final : public CSSGroupingRule { | 
					
						
							|  |  |  |     WEB_PLATFORM_OBJECT(CSSStyleRule, CSSGroupingRule); | 
					
						
							| 
									
										
										
										
											2023-11-19 19:47:52 +01:00
										 |  |  |     JS_DECLARE_ALLOCATOR(CSSStyleRule); | 
					
						
							| 
									
										
										
										
											2020-06-10 16:41:30 +02:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2019-06-20 23:25:25 +02:00
										 |  |  | public: | 
					
						
							| 
									
										
										
										
											2024-10-17 12:01:13 +01:00
										 |  |  |     [[nodiscard]] static JS::NonnullGCPtr<CSSStyleRule> create(JS::Realm&, SelectorList&&, PropertyOwningCSSStyleDeclaration&, CSSRuleList&); | 
					
						
							| 
									
										
										
										
											2019-06-21 19:19:49 +02:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2022-03-14 13:21:51 -06:00
										 |  |  |     virtual ~CSSStyleRule() override = default; | 
					
						
							| 
									
										
										
										
											2019-06-20 23:25:25 +02:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2024-10-17 12:01:13 +01:00
										 |  |  |     SelectorList const& selectors() const { return m_selectors; } | 
					
						
							| 
									
										
										
										
											2024-10-17 12:26:37 +01:00
										 |  |  |     SelectorList const& absolutized_selectors() const; | 
					
						
							| 
									
										
										
										
											2024-03-19 12:56:52 +01:00
										 |  |  |     PropertyOwningCSSStyleDeclaration const& declaration() const { return m_declaration; } | 
					
						
							| 
									
										
										
										
											2019-06-25 06:31:47 +02:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2023-12-01 16:55:52 +00:00
										 |  |  |     String selector_text() const; | 
					
						
							| 
									
										
										
										
											2021-09-29 23:43:18 +02:00
										 |  |  |     void set_selector_text(StringView); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     CSSStyleDeclaration* style(); | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2024-09-09 17:35:13 +02:00
										 |  |  |     [[nodiscard]] FlyString const& qualified_layer_name() const { return parent_layer_internal_qualified_name(); } | 
					
						
							| 
									
										
										
										
											2024-09-04 17:43:18 +01:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2019-06-20 23:25:25 +02:00
										 |  |  | private: | 
					
						
							| 
									
										
										
										
											2024-10-17 12:01:13 +01:00
										 |  |  |     CSSStyleRule(JS::Realm&, SelectorList&&, PropertyOwningCSSStyleDeclaration&, CSSRuleList&); | 
					
						
							| 
									
										
										
										
											2022-08-28 13:42:07 +02:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2023-08-07 08:41:28 +02:00
										 |  |  |     virtual void initialize(JS::Realm&) override; | 
					
						
							| 
									
										
										
										
											2022-08-07 16:21:26 +02:00
										 |  |  |     virtual void visit_edges(Cell::Visitor&) override; | 
					
						
							| 
									
										
										
										
											2024-10-17 12:26:37 +01:00
										 |  |  |     virtual void clear_caches() override; | 
					
						
							| 
									
										
										
										
											2023-11-20 23:16:39 +13:00
										 |  |  |     virtual String serialized() const override; | 
					
						
							| 
									
										
										
										
											2021-10-01 19:57:45 +02:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2024-11-08 17:50:38 +00:00
										 |  |  |     CSSStyleRule const* parent_style_rule() const; | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2024-10-17 12:01:13 +01:00
										 |  |  |     SelectorList m_selectors; | 
					
						
							| 
									
										
										
										
											2024-10-17 12:26:37 +01:00
										 |  |  |     mutable Optional<SelectorList> m_cached_absolutized_selectors; | 
					
						
							| 
									
										
										
										
											2024-03-19 12:56:52 +01:00
										 |  |  |     JS::NonnullGCPtr<PropertyOwningCSSStyleDeclaration> 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
										 |  |  | } |