| 
									
										
										
										
											2020-08-01 03:04:26 +01:00
										 |  |  | /*
 | 
					
						
							| 
									
										
										
										
											2021-04-28 22:46:44 +02:00
										 |  |  |  * Copyright (c) 2020, the SerenityOS developers. | 
					
						
							| 
									
										
										
										
											2025-01-15 14:39:05 -05:00
										 |  |  |  * Copyright (c) 2023-2025, Tim Flynn <trflynn89@ladybird.org> | 
					
						
							| 
									
										
										
										
											2020-08-01 03:04:26 +01:00
										 |  |  |  * | 
					
						
							| 
									
										
										
										
											2021-04-22 01:24:48 -07:00
										 |  |  |  * SPDX-License-Identifier: BSD-2-Clause | 
					
						
							| 
									
										
										
										
											2020-08-01 03:04:26 +01:00
										 |  |  |  */ | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | #pragma once
 | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2023-08-31 13:53:17 -04:00
										 |  |  | #include <AK/Optional.h>
 | 
					
						
							| 
									
										
										
										
											2023-01-28 22:23:16 +00:00
										 |  |  | #include <LibWeb/ARIA/Roles.h>
 | 
					
						
							| 
									
										
										
										
											2020-08-01 03:04:26 +01:00
										 |  |  | #include <LibWeb/HTML/HTMLElement.h>
 | 
					
						
							| 
									
										
										
										
											2023-08-31 13:53:17 -04:00
										 |  |  | #include <LibWeb/HTML/ToggleTaskTracker.h>
 | 
					
						
							| 
									
										
										
										
											2023-09-05 15:24:20 -04:00
										 |  |  | #include <LibWeb/WebIDL/ExceptionOr.h>
 | 
					
						
							| 
									
										
										
										
											2020-08-01 03:04:26 +01:00
										 |  |  | 
 | 
					
						
							|  |  |  | namespace Web::HTML { | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | class HTMLDetailsElement final : public HTMLElement { | 
					
						
							| 
									
										
										
										
											2022-08-28 13:42:07 +02:00
										 |  |  |     WEB_PLATFORM_OBJECT(HTMLDetailsElement, HTMLElement); | 
					
						
							| 
									
										
										
										
											2024-11-15 04:01:23 +13:00
										 |  |  |     GC_DECLARE_ALLOCATOR(HTMLDetailsElement); | 
					
						
							| 
									
										
										
										
											2022-08-28 13:42:07 +02:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2020-08-01 03:04:26 +01:00
										 |  |  | public: | 
					
						
							| 
									
										
										
										
											2022-08-28 13:42:07 +02:00
										 |  |  |     virtual ~HTMLDetailsElement() override; | 
					
						
							| 
									
										
										
										
											2020-08-01 03:04:26 +01:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2022-11-28 17:58:13 -06:00
										 |  |  |     // https://www.w3.org/TR/html-aria/#el-details
 | 
					
						
							| 
									
										
										
										
											2023-07-07 22:48:11 -04:00
										 |  |  |     virtual Optional<ARIA::Role> default_role() const override { return ARIA::Role::group; } | 
					
						
							| 
									
										
										
										
											2022-11-28 17:58:13 -06:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2022-08-28 13:42:07 +02:00
										 |  |  | private: | 
					
						
							| 
									
										
										
										
											2022-02-18 21:00:52 +01:00
										 |  |  |     HTMLDetailsElement(DOM::Document&, DOM::QualifiedName); | 
					
						
							| 
									
										
										
										
											2023-01-10 06:28:20 -05:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2023-08-07 08:41:28 +02:00
										 |  |  |     virtual void initialize(JS::Realm&) override; | 
					
						
							| 
									
										
										
										
											2023-09-05 15:24:20 -04:00
										 |  |  |     virtual void visit_edges(Cell::Visitor&) override; | 
					
						
							| 
									
										
										
										
											2023-08-31 13:53:17 -04:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2023-11-29 18:22:16 -05:00
										 |  |  |     virtual void inserted() override; | 
					
						
							| 
									
										
										
										
											2025-01-23 17:37:18 +01:00
										 |  |  |     virtual void removed_from(DOM::Node* old_parent, DOM::Node& old_root) override; | 
					
						
							| 
									
										
										
										
											2025-01-27 01:16:33 +13:00
										 |  |  |     virtual void children_changed(ChildrenChangedMetadata const*) override; | 
					
						
							| 
									
										
										
										
											2025-01-15 11:19:12 -05:00
										 |  |  |     virtual void attribute_changed(FlyString const& local_name, Optional<String> const& old_value, Optional<String> const& value, Optional<FlyString> const& namespace_) override; | 
					
						
							| 
									
										
										
										
											2023-08-31 13:53:17 -04:00
										 |  |  | 
 | 
					
						
							|  |  |  |     void queue_a_details_toggle_event_task(String old_state, String new_state); | 
					
						
							| 
									
										
										
										
											2025-01-15 14:39:05 -05:00
										 |  |  |     void ensure_details_exclusivity_by_closing_other_elements_if_needed(); | 
					
						
							|  |  |  |     void ensure_details_exclusivity_by_closing_the_given_element_if_needed(); | 
					
						
							| 
									
										
										
										
											2023-08-31 13:53:17 -04:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2023-11-29 18:22:16 -05:00
										 |  |  |     WebIDL::ExceptionOr<void> create_shadow_tree_if_needed(); | 
					
						
							| 
									
										
										
										
											2023-09-05 15:24:20 -04:00
										 |  |  |     void update_shadow_tree_slots(); | 
					
						
							|  |  |  |     void update_shadow_tree_style(); | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2023-08-31 13:53:17 -04:00
										 |  |  |     // https://html.spec.whatwg.org/multipage/interactive-elements.html#details-toggle-task-tracker
 | 
					
						
							|  |  |  |     Optional<ToggleTaskTracker> m_details_toggle_task_tracker; | 
					
						
							| 
									
										
										
										
											2023-09-05 15:24:20 -04:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2024-11-15 04:01:23 +13:00
										 |  |  |     GC::Ptr<HTML::HTMLSlotElement> m_summary_slot; | 
					
						
							|  |  |  |     GC::Ptr<HTML::HTMLSlotElement> m_descendants_slot; | 
					
						
							| 
									
										
										
										
											2020-08-01 03:04:26 +01:00
										 |  |  | }; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | } |