mirror of
				https://github.com/LadybirdBrowser/ladybird.git
				synced 2025-10-25 02:23:20 +00:00 
			
		
		
		
	 6f433c8656
			
		
	
	
		6f433c8656
		
	
	
	
	
		
			
			This is a monster patch that turns all EventTargets into GC-allocated PlatformObjects. Their C++ wrapper classes are removed, and the LibJS garbage collector is now responsible for their lifetimes. There's a fair amount of hacks and band-aids in this patch, and we'll have a lot of cleanup to do after this.
		
			
				
	
	
		
			39 lines
		
	
	
	
		
			1.1 KiB
		
	
	
	
		
			C++
		
	
	
	
	
	
			
		
		
	
	
			39 lines
		
	
	
	
		
			1.1 KiB
		
	
	
	
		
			C++
		
	
	
	
	
	
| /*
 | |
|  * Copyright (c) 2022, the SerenityOS developers.
 | |
|  *
 | |
|  * SPDX-License-Identifier: BSD-2-Clause
 | |
|  */
 | |
| 
 | |
| #pragma once
 | |
| 
 | |
| #include <AK/Variant.h>
 | |
| #include <LibWeb/DOM/ExceptionOr.h>
 | |
| #include <LibWeb/DOM/HTMLCollection.h>
 | |
| 
 | |
| namespace Web::HTML {
 | |
| 
 | |
| using HTMLOptionOrOptGroupElement = Variant<JS::Handle<HTMLOptionElement>, JS::Handle<HTMLOptGroupElement>>;
 | |
| using HTMLElementOrElementIndex = Variant<JS::Handle<HTMLElement>, i32>;
 | |
| 
 | |
| class HTMLOptionsCollection final : public DOM::HTMLCollection {
 | |
| public:
 | |
|     using WrapperType = Bindings::HTMLOptionsCollectionWrapper;
 | |
| 
 | |
|     static NonnullRefPtr<HTMLOptionsCollection> create(DOM::ParentNode& root, Function<bool(DOM::Element const&)> filter)
 | |
|     {
 | |
|         return adopt_ref(*new HTMLOptionsCollection(root, move(filter)));
 | |
|     }
 | |
| 
 | |
|     DOM::ExceptionOr<void> add(HTMLOptionOrOptGroupElement element, Optional<HTMLElementOrElementIndex> before = {});
 | |
| 
 | |
| protected:
 | |
|     HTMLOptionsCollection(DOM::ParentNode& root, Function<bool(DOM::Element const&)> filter);
 | |
| };
 | |
| 
 | |
| }
 | |
| 
 | |
| namespace Web::Bindings {
 | |
| 
 | |
| HTMLOptionsCollectionWrapper* wrap(JS::Realm&, HTML::HTMLOptionsCollection&);
 | |
| 
 | |
| }
 |