| 
									
										
										
										
											2024-08-15 12:20:22 -04:00
										 |  |  | /*
 | 
					
						
							|  |  |  |  * Copyright (c) 2024, Tim Flynn <trflynn89@serenityos.org> | 
					
						
							|  |  |  |  * | 
					
						
							|  |  |  |  * SPDX-License-Identifier: BSD-2-Clause | 
					
						
							|  |  |  |  */ | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | #pragma once
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | #include <LibJS/Forward.h>
 | 
					
						
							|  |  |  | #include <LibWeb/Bindings/PlatformObject.h>
 | 
					
						
							| 
									
										
										
										
											2024-08-21 09:35:25 -04:00
										 |  |  | #include <LibWeb/WebIDL/ExceptionOr.h>
 | 
					
						
							| 
									
										
										
										
											2024-08-21 09:45:04 -04:00
										 |  |  | #include <LibWeb/WebIDL/Types.h>
 | 
					
						
							| 
									
										
										
										
											2024-08-15 12:20:22 -04:00
										 |  |  | 
 | 
					
						
							|  |  |  | namespace Web::HTML { | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | // https://html.spec.whatwg.org/multipage/dnd.html#the-datatransferitemlist-interface
 | 
					
						
							|  |  |  | class DataTransferItemList : public Bindings::PlatformObject { | 
					
						
							|  |  |  |     WEB_PLATFORM_OBJECT(DataTransferItemList, Bindings::PlatformObject); | 
					
						
							| 
									
										
										
										
											2024-11-15 04:01:23 +13:00
										 |  |  |     GC_DECLARE_ALLOCATOR(DataTransferItemList); | 
					
						
							| 
									
										
										
										
											2024-08-15 12:20:22 -04:00
										 |  |  | 
 | 
					
						
							|  |  |  | public: | 
					
						
							| 
									
										
										
										
											2024-11-15 04:01:23 +13:00
										 |  |  |     static GC::Ref<DataTransferItemList> create(JS::Realm&, GC::Ref<DataTransfer>); | 
					
						
							| 
									
										
										
										
											2024-08-15 12:20:22 -04:00
										 |  |  |     virtual ~DataTransferItemList() override; | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2024-08-21 09:45:04 -04:00
										 |  |  |     WebIDL::UnsignedLong length() const; | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2024-11-15 04:01:23 +13:00
										 |  |  |     WebIDL::ExceptionOr<GC::Ptr<DataTransferItem>> add(String const& data, String const& type); | 
					
						
							|  |  |  |     GC::Ptr<DataTransferItem> add(GC::Ref<FileAPI::File>); | 
					
						
							| 
									
										
										
										
											2025-09-05 07:23:46 +01:00
										 |  |  |     WebIDL::ExceptionOr<void> remove(WebIDL::UnsignedLong index); | 
					
						
							| 
									
										
										
										
											2025-09-05 07:37:05 +01:00
										 |  |  |     void clear(); | 
					
						
							| 
									
										
										
										
											2024-08-21 09:35:25 -04:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2024-08-15 12:20:22 -04:00
										 |  |  | private: | 
					
						
							| 
									
										
										
										
											2024-11-15 04:01:23 +13:00
										 |  |  |     DataTransferItemList(JS::Realm&, GC::Ref<DataTransfer>); | 
					
						
							| 
									
										
										
										
											2024-08-15 12:20:22 -04:00
										 |  |  | 
 | 
					
						
							|  |  |  |     virtual void initialize(JS::Realm&) override; | 
					
						
							| 
									
										
										
										
											2024-08-20 18:44:22 -04:00
										 |  |  |     virtual void visit_edges(JS::Cell::Visitor&) override; | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2024-08-21 10:04:16 -04:00
										 |  |  |     virtual Optional<JS::Value> item_value(size_t index) const override; | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2024-11-15 04:01:23 +13:00
										 |  |  |     GC::Ref<DataTransfer> m_data_transfer; | 
					
						
							| 
									
										
										
										
											2024-08-15 12:20:22 -04:00
										 |  |  | }; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | } |