| 
									
										
										
										
											2020-05-27 23:22:42 +02:00
										 |  |  | /*
 | 
					
						
							|  |  |  |  * Copyright (c) 2020, Andreas Kling <kling@serenityos.org> | 
					
						
							|  |  |  |  * | 
					
						
							| 
									
										
										
										
											2021-04-22 01:24:48 -07:00
										 |  |  |  * SPDX-License-Identifier: BSD-2-Clause | 
					
						
							| 
									
										
										
										
											2020-05-27 23:22:42 +02:00
										 |  |  |  */ | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | #pragma once
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | #include <AK/NonnullRefPtrVector.h>
 | 
					
						
							|  |  |  | #include <LibWeb/DOM/Element.h>
 | 
					
						
							|  |  |  | #include <LibWeb/Forward.h>
 | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2020-07-28 18:20:36 +02:00
										 |  |  | namespace Web::HTML { | 
					
						
							| 
									
										
										
										
											2020-05-27 23:22:42 +02:00
										 |  |  | 
 | 
					
						
							|  |  |  | class ListOfActiveFormattingElements { | 
					
						
							|  |  |  | public: | 
					
						
							|  |  |  |     ListOfActiveFormattingElements() { } | 
					
						
							|  |  |  |     ~ListOfActiveFormattingElements(); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     struct Entry { | 
					
						
							|  |  |  |         bool is_marker() const { return !element; } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2020-07-26 19:37:56 +02:00
										 |  |  |         RefPtr<DOM::Element> element; | 
					
						
							| 
									
										
										
										
											2020-05-27 23:22:42 +02:00
										 |  |  |     }; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     bool is_empty() const { return m_entries.is_empty(); } | 
					
						
							| 
									
										
										
										
											2020-07-26 19:37:56 +02:00
										 |  |  |     bool contains(const DOM::Element&) const; | 
					
						
							| 
									
										
										
										
											2020-05-27 23:22:42 +02:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2020-07-26 19:37:56 +02:00
										 |  |  |     void add(DOM::Element& element); | 
					
						
							| 
									
										
										
										
											2020-05-27 23:22:42 +02:00
										 |  |  |     void add_marker(); | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2020-07-26 19:37:56 +02:00
										 |  |  |     void remove(DOM::Element&); | 
					
						
							| 
									
										
										
										
											2020-05-27 23:22:42 +02:00
										 |  |  | 
 | 
					
						
							|  |  |  |     const Vector<Entry>& entries() const { return m_entries; } | 
					
						
							|  |  |  |     Vector<Entry>& entries() { return m_entries; } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2020-07-26 19:37:56 +02:00
										 |  |  |     DOM::Element* last_element_with_tag_name_before_marker(const FlyString& tag_name); | 
					
						
							| 
									
										
										
										
											2020-05-27 23:22:42 +02:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2020-05-28 00:27:46 +02:00
										 |  |  |     void clear_up_to_the_last_marker(); | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2020-05-27 23:22:42 +02:00
										 |  |  | private: | 
					
						
							|  |  |  |     Vector<Entry> m_entries; | 
					
						
							|  |  |  | }; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | } |