mirror of
				https://github.com/RGBCube/serenity
				synced 2025-10-31 02:02:45 +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.
		
			
				
	
	
		
			24 lines
		
	
	
	
		
			621 B
		
	
	
	
		
			C++
		
	
	
	
	
	
			
		
		
	
	
			24 lines
		
	
	
	
		
			621 B
		
	
	
	
		
			C++
		
	
	
	
	
	
| /*
 | |
|  * Copyright (c) 2018-2020, Andreas Kling <kling@serenityos.org>
 | |
|  *
 | |
|  * SPDX-License-Identifier: BSD-2-Clause
 | |
|  */
 | |
| 
 | |
| #include <LibWeb/DOM/Comment.h>
 | |
| #include <LibWeb/HTML/Window.h>
 | |
| #include <LibWeb/Layout/TextNode.h>
 | |
| 
 | |
| namespace Web::DOM {
 | |
| 
 | |
| Comment::Comment(Document& document, String const& data)
 | |
|     : CharacterData(document, NodeType::COMMENT_NODE, data)
 | |
| {
 | |
| }
 | |
| 
 | |
| // https://dom.spec.whatwg.org/#dom-comment-comment
 | |
| JS::NonnullGCPtr<Comment> Comment::create_with_global_object(HTML::Window& window, String const& data)
 | |
| {
 | |
|     return *window.heap().allocate<Comment>(window.realm(), window.associated_document(), data);
 | |
| }
 | |
| 
 | |
| }
 |