diff options
author | DexesTTP <dexes.ttp@gmail.com> | 2022-04-30 11:11:12 +0200 |
---|---|---|
committer | Andreas Kling <kling@serenityos.org> | 2022-05-15 12:17:36 +0200 |
commit | 97a67f55012ff1a084f007b2a880a6389cc2e1b9 (patch) | |
tree | ea01b0056f6d833fe8182a29cc0b30e46cba524e /Userland/Libraries/LibWebView/DumpLayoutTree | |
parent | dcbbbf5b4a5dcb67184dc9f97c0f434aa301098c (diff) | |
download | serenity-97a67f55012ff1a084f007b2a880a6389cc2e1b9.zip |
LibWebView: Move the DumpLayoutTree utility to LibWebView
This patch has no functional changes.
Diffstat (limited to 'Userland/Libraries/LibWebView/DumpLayoutTree')
-rw-r--r-- | Userland/Libraries/LibWebView/DumpLayoutTree/CMakeLists.txt | 6 | ||||
-rw-r--r-- | Userland/Libraries/LibWebView/DumpLayoutTree/main.cpp | 27 |
2 files changed, 33 insertions, 0 deletions
diff --git a/Userland/Libraries/LibWebView/DumpLayoutTree/CMakeLists.txt b/Userland/Libraries/LibWebView/DumpLayoutTree/CMakeLists.txt new file mode 100644 index 0000000000..5891a69932 --- /dev/null +++ b/Userland/Libraries/LibWebView/DumpLayoutTree/CMakeLists.txt @@ -0,0 +1,6 @@ +set(SOURCES + main.cpp +) + +serenity_bin(DumpLayoutTree) +target_link_libraries(DumpLayoutTree LibWebView LibWeb) diff --git a/Userland/Libraries/LibWebView/DumpLayoutTree/main.cpp b/Userland/Libraries/LibWebView/DumpLayoutTree/main.cpp new file mode 100644 index 0000000000..577c8b144b --- /dev/null +++ b/Userland/Libraries/LibWebView/DumpLayoutTree/main.cpp @@ -0,0 +1,27 @@ +/* + * Copyright (c) 2020, Andreas Kling <kling@serenityos.org> + * + * SPDX-License-Identifier: BSD-2-Clause + */ + +#include <LibGUI/Application.h> +#include <LibGUI/Window.h> +#include <LibWebView/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<WebView::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(); +} |