| 
									
										
										
										
											2021-09-12 20:05:29 +02:00
										 |  |  | /*
 | 
					
						
							| 
									
										
										
										
											2024-10-04 13:19:50 +02:00
										 |  |  |  * Copyright (c) 2021-2023, Andreas Kling <andreas@ladybird.org> | 
					
						
							| 
									
										
										
										
											2021-09-12 20:05:29 +02:00
										 |  |  |  * | 
					
						
							|  |  |  |  * SPDX-License-Identifier: BSD-2-Clause | 
					
						
							|  |  |  |  */ | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | #pragma once
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | #include <LibWeb/CSS/CSSStyleDeclaration.h>
 | 
					
						
							| 
									
										
										
										
											2024-08-06 12:48:21 +01:00
										 |  |  | #include <LibWeb/CSS/Selector.h>
 | 
					
						
							| 
									
										
										
										
											2021-09-12 20:05:29 +02:00
										 |  |  | 
 | 
					
						
							|  |  |  | namespace Web::CSS { | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2021-09-23 12:35:56 +02:00
										 |  |  | class ResolvedCSSStyleDeclaration final : public CSSStyleDeclaration { | 
					
						
							| 
									
										
										
										
											2022-08-28 13:42:07 +02:00
										 |  |  |     WEB_PLATFORM_OBJECT(ResolvedCSSStyleDeclaration, CSSStyleDeclaration); | 
					
						
							| 
									
										
										
										
											2024-11-15 04:01:23 +13:00
										 |  |  |     GC_DECLARE_ALLOCATOR(ResolvedCSSStyleDeclaration); | 
					
						
							| 
									
										
										
										
											2022-08-07 16:21:26 +02:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2021-09-12 20:05:29 +02:00
										 |  |  | public: | 
					
						
							| 
									
										
										
										
											2024-11-15 04:01:23 +13:00
										 |  |  |     [[nodiscard]] static GC::Ref<ResolvedCSSStyleDeclaration> create(DOM::Element&, Optional<Selector::PseudoElement::Type> = {}); | 
					
						
							| 
									
										
										
										
											2021-09-12 20:05:29 +02:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2022-03-14 13:21:51 -06:00
										 |  |  |     virtual ~ResolvedCSSStyleDeclaration() override = default; | 
					
						
							| 
									
										
										
										
											2021-09-12 20:05:29 +02:00
										 |  |  | 
 | 
					
						
							|  |  |  |     virtual size_t length() const override; | 
					
						
							| 
									
										
										
										
											2023-09-06 19:07:24 +12:00
										 |  |  |     virtual String item(size_t index) const override; | 
					
						
							| 
									
										
										
										
											2023-12-10 12:42:13 +01:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2021-09-12 20:05:29 +02:00
										 |  |  |     virtual Optional<StyleProperty> property(PropertyID) const override; | 
					
						
							| 
									
										
										
										
											2024-11-25 13:23:31 +01:00
										 |  |  |     virtual Optional<StyleProperty const&> custom_property(FlyString const& custom_property_name) const override; | 
					
						
							| 
									
										
										
										
											2022-09-25 17:03:42 +01:00
										 |  |  |     virtual WebIDL::ExceptionOr<void> set_property(PropertyID, StringView css_text, StringView priority) override; | 
					
						
							| 
									
										
										
										
											2024-08-04 22:12:31 +01:00
										 |  |  |     virtual WebIDL::ExceptionOr<void> set_property(StringView property_name, StringView css_text, StringView priority) override; | 
					
						
							| 
									
										
										
										
											2023-09-06 19:07:24 +12:00
										 |  |  |     virtual WebIDL::ExceptionOr<String> remove_property(PropertyID) override; | 
					
						
							| 
									
										
										
										
											2024-08-04 22:12:31 +01:00
										 |  |  |     virtual WebIDL::ExceptionOr<String> remove_property(StringView property_name) override; | 
					
						
							| 
									
										
										
										
											2021-09-12 20:05:29 +02:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2023-11-21 10:39:54 +13:00
										 |  |  |     virtual String serialized() const override; | 
					
						
							| 
									
										
										
										
											2022-11-05 04:51:05 +00:00
										 |  |  |     virtual WebIDL::ExceptionOr<void> set_css_text(StringView) override; | 
					
						
							| 
									
										
										
										
											2021-10-01 19:57:45 +02:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2021-09-12 20:05:29 +02:00
										 |  |  | private: | 
					
						
							| 
									
										
										
										
											2024-08-06 12:48:21 +01:00
										 |  |  |     explicit ResolvedCSSStyleDeclaration(DOM::Element&, Optional<CSS::Selector::PseudoElement::Type>); | 
					
						
							| 
									
										
										
										
											2022-09-24 16:34:04 -06:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2022-08-28 13:42:07 +02:00
										 |  |  |     virtual void visit_edges(Cell::Visitor&) override; | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2024-12-07 01:10:11 +01:00
										 |  |  |     virtual bool computed_flag() const override { return true; } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2024-08-14 11:10:54 +01:00
										 |  |  |     RefPtr<CSSStyleValue const> style_value_for_property(Layout::NodeWithStyle const&, PropertyID) const; | 
					
						
							| 
									
										
										
										
											2021-09-18 13:14:40 +02:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2024-11-15 04:01:23 +13:00
										 |  |  |     GC::Ref<DOM::Element> m_element; | 
					
						
							| 
									
										
										
										
											2024-08-06 12:48:21 +01:00
										 |  |  |     Optional<CSS::Selector::PseudoElement::Type> m_pseudo_element; | 
					
						
							| 
									
										
										
										
											2021-09-12 20:05:29 +02:00
										 |  |  | }; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | } |