Serenity Operating System
at master 27 lines 860 B view raw
1/* 2 * Copyright (c) 2020, Andreas Kling <kling@serenityos.org> 3 * 4 * SPDX-License-Identifier: BSD-2-Clause 5 */ 6 7#include <LibGUI/Application.h> 8#include <LibGUI/Window.h> 9#include <LibWebView/OutOfProcessWebView.h> 10#include <unistd.h> 11 12int main(int argc, char** argv) 13{ 14 auto app = GUI::Application::construct(argc, argv); 15 auto window = GUI::Window::construct(); 16 window->set_title("DumpLayoutTree"); 17 window->resize(800, 600); 18 window->show(); 19 auto web_view = window->set_main_widget<WebView::OutOfProcessWebView>().release_value_but_fixme_should_propagate_errors(); 20 web_view->load(URL::create_with_file_scheme(argv[1])); 21 web_view->on_load_finish = [&](auto&) { 22 auto dump = web_view->dump_layout_tree(); 23 write(STDOUT_FILENO, dump.characters(), dump.length() + 1); 24 _exit(0); 25 }; 26 return app->exec(); 27}