mirror of
				https://github.com/LadybirdBrowser/ladybird.git
				synced 2025-10-31 13:20:59 +00:00 
			
		
		
		
	LibWeb: Add PageView::load_html() for loading HTML directly
When you're using Web::PageView as a GUI widget, you'll often just have a chunk of HTML you want to show. So let's have an API for that.
This commit is contained in:
		
							parent
							
								
									59537cf257
								
							
						
					
					
						commit
						6e27efe6c6
					
				
				
				Notes:
				
					sideshowbarker
				
				2024-07-19 05:27:59 +09:00 
				
			
			Author: https://github.com/awesomekling
Commit: 6e27efe6c6
			
					 2 changed files with 9 additions and 0 deletions
				
			
		|  | @ -48,6 +48,7 @@ | |||
| #include <LibWeb/Loader/ResourceLoader.h> | ||||
| #include <LibWeb/PageView.h> | ||||
| #include <LibWeb/Painting/PaintContext.h> | ||||
| #include <LibWeb/Parser/HTMLDocumentParser.h> | ||||
| #include <stdio.h> | ||||
| 
 | ||||
| //#define SELECTION_DEBUG
 | ||||
|  | @ -272,6 +273,13 @@ void PageView::reload() | |||
|     load(page().main_frame().document()->url()); | ||||
| } | ||||
| 
 | ||||
| void PageView::load_html(const StringView& html, const URL& url) | ||||
| { | ||||
|     HTMLDocumentParser parser(html, "utf-8"); | ||||
|     parser.run(url); | ||||
|     set_document(&parser.document()); | ||||
| } | ||||
| 
 | ||||
| bool PageView::load(const URL& url) | ||||
| { | ||||
|     if (window()) | ||||
|  |  | |||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue
	
	 Andreas Kling
						Andreas Kling