mirror of
				https://github.com/RGBCube/serenity
				synced 2025-10-31 21:12:43 +00:00 
			
		
		
		
	 9d03ea6f74
			
		
	
	
		9d03ea6f74
		
	
	
	
	
		
			
			This required adding a simple OOPWV::dump_layout_tree() API that synchronously requests a dump of the layout tree from the WebContent process.
		
			
				
	
	
		
			28 lines
		
	
	
	
		
			834 B
		
	
	
	
		
			C++
		
	
	
	
	
	
			
		
		
	
	
			28 lines
		
	
	
	
		
			834 B
		
	
	
	
		
			C++
		
	
	
	
	
	
| /*
 | |
|  * Copyright (c) 2020, Andreas Kling <kling@serenityos.org>
 | |
|  *
 | |
|  * SPDX-License-Identifier: BSD-2-Clause
 | |
|  */
 | |
| 
 | |
| #include <LibCore/ArgsParser.h>
 | |
| #include <LibGUI/Application.h>
 | |
| #include <LibGUI/Window.h>
 | |
| #include <LibWeb/OutOfProcessWebView.h>
 | |
| #include <unistd.h>
 | |
| 
 | |
| int main(int argc, char** argv)
 | |
| {
 | |
|     auto app = GUI::Application::construct(argc, argv);
 | |
|     auto window = GUI::Window::construct();
 | |
|     window->set_title("DumpLayoutTree");
 | |
|     window->resize(800, 600);
 | |
|     window->show();
 | |
|     auto& web_view = window->set_main_widget<Web::OutOfProcessWebView>();
 | |
|     web_view.load(URL::create_with_file_protocol(argv[1]));
 | |
|     web_view.on_load_finish = [&](auto&) {
 | |
|         auto dump = web_view.dump_layout_tree();
 | |
|         write(STDOUT_FILENO, dump.characters(), dump.length() + 1);
 | |
|         _exit(0);
 | |
|     };
 | |
|     return app->exec();
 | |
| }
 |