From dcbbbf5b4a5dcb67184dc9f97c0f434aa301098c Mon Sep 17 00:00:00 2001 From: DexesTTP Date: Sat, 30 Apr 2022 10:46:33 +0200 Subject: [PATCH] LibWebView: Move OutOfProcessWebView to a new LibWebView library Also moves WebContentClient and the references to the generated IPC descriptions, since they are all components of OutOfProcessWebView. This patch has no functional changes. --- Userland/Applications/Browser/BrowserWindow.cpp | 2 +- Userland/Applications/Browser/CMakeLists.txt | 2 +- Userland/Applications/Browser/ConsoleWidget.cpp | 2 +- Userland/Applications/Browser/ConsoleWidget.h | 4 ++-- Userland/Applications/Browser/InspectorWidget.cpp | 2 +- Userland/Applications/Browser/InspectorWidget.h | 5 +++-- Userland/Applications/Browser/Tab.cpp | 4 ++-- Userland/Applications/Browser/Tab.h | 6 +++--- Userland/Applications/Help/CMakeLists.txt | 2 +- Userland/Applications/Help/HelpWindow.gml | 2 +- Userland/Applications/Help/MainWidget.cpp | 2 +- Userland/Applications/Help/MainWidget.h | 4 ++-- Userland/Applications/Mail/CMakeLists.txt | 2 +- Userland/Applications/Mail/MailWidget.cpp | 2 +- Userland/Applications/Mail/MailWidget.h | 4 ++-- Userland/Applications/Mail/MailWindow.gml | 2 +- Userland/Applications/Spreadsheet/CMakeLists.txt | 2 +- Userland/Applications/Spreadsheet/HelpWindow.cpp | 4 ++-- Userland/Applications/Spreadsheet/HelpWindow.h | 4 ++-- Userland/Applications/TextEditor/CMakeLists.txt | 2 +- Userland/Applications/TextEditor/MainWidget.cpp | 6 +++--- Userland/Applications/TextEditor/MainWidget.h | 6 +++--- Userland/Applications/Welcome/CMakeLists.txt | 2 +- Userland/Applications/Welcome/WelcomeWidget.cpp | 4 ++-- Userland/Applications/Welcome/WelcomeWidget.h | 4 ++-- Userland/Applications/Welcome/WelcomeWindow.gml | 2 +- Userland/DevTools/HackStudio/CMakeLists.txt | 2 +- Userland/DevTools/HackStudio/Editor.cpp | 6 +++--- Userland/DevTools/HackStudio/Editor.h | 6 +++--- Userland/Libraries/CMakeLists.txt | 1 + Userland/Libraries/LibWeb/CMakeLists.txt | 4 ---- .../Libraries/LibWeb/DumpLayoutTree/CMakeLists.txt | 2 +- Userland/Libraries/LibWeb/DumpLayoutTree/main.cpp | 4 ++-- Userland/Libraries/LibWeb/Forward.h | 1 - Userland/Libraries/LibWebView/CMakeLists.txt | 14 ++++++++++++++ Userland/Libraries/LibWebView/Forward.h | 13 +++++++++++++ .../{LibWeb => LibWebView}/OutOfProcessWebView.cpp | 10 +++++----- .../{LibWeb => LibWebView}/OutOfProcessWebView.h | 14 +++++++------- .../{LibWeb => LibWebView}/WebContentClient.cpp | 6 +++--- .../{LibWeb => LibWebView}/WebContentClient.h | 2 +- Userland/Services/WebContent/CMakeLists.txt | 2 +- 41 files changed, 97 insertions(+), 73 deletions(-) create mode 100644 Userland/Libraries/LibWebView/CMakeLists.txt create mode 100644 Userland/Libraries/LibWebView/Forward.h rename Userland/Libraries/{LibWeb => LibWebView}/OutOfProcessWebView.cpp (98%) rename Userland/Libraries/{LibWeb => LibWebView}/OutOfProcessWebView.h (94%) rename Userland/Libraries/{LibWeb => LibWebView}/WebContentClient.cpp (98%) rename Userland/Libraries/{LibWeb => LibWebView}/WebContentClient.h (99%) diff --git a/Userland/Applications/Browser/BrowserWindow.cpp b/Userland/Applications/Browser/BrowserWindow.cpp index 47806aea86..65f8c1f74c 100644 --- a/Userland/Applications/Browser/BrowserWindow.cpp +++ b/Userland/Applications/Browser/BrowserWindow.cpp @@ -37,7 +37,7 @@ #include #include #include -#include +#include namespace Browser { diff --git a/Userland/Applications/Browser/CMakeLists.txt b/Userland/Applications/Browser/CMakeLists.txt index dbb02aa785..f703909a6e 100644 --- a/Userland/Applications/Browser/CMakeLists.txt +++ b/Userland/Applications/Browser/CMakeLists.txt @@ -33,5 +33,5 @@ set(SOURCES ) serenity_app(Browser ICON app-browser) -target_link_libraries(Browser LibWeb LibProtocol LibGUI LibDesktop LibConfig LibMain) +target_link_libraries(Browser LibWebView LibWeb LibProtocol LibGUI LibDesktop LibConfig LibMain) link_with_unicode_data(Browser) diff --git a/Userland/Applications/Browser/ConsoleWidget.cpp b/Userland/Applications/Browser/ConsoleWidget.cpp index 75f6b8e1fc..3603e856bb 100644 --- a/Userland/Applications/Browser/ConsoleWidget.cpp +++ b/Userland/Applications/Browser/ConsoleWidget.cpp @@ -24,7 +24,7 @@ ConsoleWidget::ConsoleWidget() set_layout(); set_fill_with_background_color(true); - m_output_view = add(); + m_output_view = add(); m_output_view->load("data:text/html,"); // Wait until our output WebView is loaded, and then request any messages that occurred before we existed m_output_view->on_load_finish = [this](auto&) { diff --git a/Userland/Applications/Browser/ConsoleWidget.h b/Userland/Applications/Browser/ConsoleWidget.h index aaa7a5d5c0..06930ccb50 100644 --- a/Userland/Applications/Browser/ConsoleWidget.h +++ b/Userland/Applications/Browser/ConsoleWidget.h @@ -11,7 +11,7 @@ #include "History.h" #include -#include +#include namespace Browser { @@ -38,7 +38,7 @@ private: void end_group(); RefPtr m_input; - RefPtr m_output_view; + RefPtr m_output_view; i32 m_highest_notified_message_index { -1 }; i32 m_highest_received_message_index { -1 }; diff --git a/Userland/Applications/Browser/InspectorWidget.cpp b/Userland/Applications/Browser/InspectorWidget.cpp index 7b04ca5691..90b95205c2 100644 --- a/Userland/Applications/Browser/InspectorWidget.cpp +++ b/Userland/Applications/Browser/InspectorWidget.cpp @@ -16,8 +16,8 @@ #include #include #include -#include #include +#include namespace Browser { diff --git a/Userland/Applications/Browser/InspectorWidget.h b/Userland/Applications/Browser/InspectorWidget.h index 348688714e..4ea84703b7 100644 --- a/Userland/Applications/Browser/InspectorWidget.h +++ b/Userland/Applications/Browser/InspectorWidget.h @@ -13,6 +13,7 @@ #include #include #include +#include namespace Browser { @@ -38,7 +39,7 @@ public: virtual ~InspectorWidget() = default; - void set_web_view(NonnullRefPtr web_view) { m_web_view = web_view; } + void set_web_view(NonnullRefPtr web_view) { m_web_view = web_view; } void set_dom_json(String); void clear_dom_json(); void set_dom_node_properties_json(Selection, String specified_values_json, String computed_values_json, String custom_properties_json, String node_box_sizing_json); @@ -54,7 +55,7 @@ private: void update_node_box_model(Optional node_box_sizing_json); void clear_style_json(); - RefPtr m_web_view; + RefPtr m_web_view; RefPtr m_dom_tree_view; RefPtr m_computed_style_table_view; diff --git a/Userland/Applications/Browser/Tab.cpp b/Userland/Applications/Browser/Tab.cpp index 2721bdf775..07355893f4 100644 --- a/Userland/Applications/Browser/Tab.cpp +++ b/Userland/Applications/Browser/Tab.cpp @@ -36,7 +36,7 @@ #include #include #include -#include +#include namespace Browser { @@ -112,7 +112,7 @@ Tab::Tab(BrowserWindow& window) auto& webview_container = *find_descendant_of_type_named("webview_container"); - m_web_content_view = webview_container.add(); + m_web_content_view = webview_container.add(); if (g_content_filters_enabled) m_web_content_view->set_content_filters(g_content_filters); else diff --git a/Userland/Applications/Browser/Tab.h b/Userland/Applications/Browser/Tab.h index c444f59274..3a93437b33 100644 --- a/Userland/Applications/Browser/Tab.h +++ b/Userland/Applications/Browser/Tab.h @@ -16,7 +16,7 @@ #include #include -namespace Web { +namespace WebView { class OutOfProcessWebView; } @@ -79,7 +79,7 @@ public: String const& title() const { return m_title; } Gfx::Bitmap const* icon() const { return m_icon; } - Web::OutOfProcessWebView& view() { return *m_web_content_view; } + WebView::OutOfProcessWebView& view() { return *m_web_content_view; } private: explicit Tab(BrowserWindow&); @@ -103,7 +103,7 @@ private: History m_history; - RefPtr m_web_content_view; + RefPtr m_web_content_view; RefPtr m_location_box; RefPtr m_bookmark_button; diff --git a/Userland/Applications/Help/CMakeLists.txt b/Userland/Applications/Help/CMakeLists.txt index ab89c645c8..a2aa07a9a8 100644 --- a/Userland/Applications/Help/CMakeLists.txt +++ b/Userland/Applications/Help/CMakeLists.txt @@ -17,5 +17,5 @@ set(SOURCES ) serenity_app(Help ICON app-help) -target_link_libraries(Help LibWeb LibMarkdown LibGUI LibDesktop LibMain) +target_link_libraries(Help LibWebView LibWeb LibMarkdown LibGUI LibDesktop LibMain) link_with_unicode_data(Help) diff --git a/Userland/Applications/Help/HelpWindow.gml b/Userland/Applications/Help/HelpWindow.gml index 1180b88c68..91eaf174c9 100644 --- a/Userland/Applications/Help/HelpWindow.gml +++ b/Userland/Applications/Help/HelpWindow.gml @@ -41,7 +41,7 @@ } } - @Web::OutOfProcessWebView { + @WebView::OutOfProcessWebView { name: "web_view" } } diff --git a/Userland/Applications/Help/MainWidget.cpp b/Userland/Applications/Help/MainWidget.cpp index 85581216dc..c294076456 100644 --- a/Userland/Applications/Help/MainWidget.cpp +++ b/Userland/Applications/Help/MainWidget.cpp @@ -90,7 +90,7 @@ MainWidget::MainWidget() m_manual_model->update_section_node_on_toggle(index, open); }; - m_web_view = find_descendant_of_type_named("web_view"); + m_web_view = find_descendant_of_type_named("web_view"); m_web_view->on_link_click = [this](auto& url, auto&, unsigned) { if (url.protocol() == "file") { auto path = url.path(); diff --git a/Userland/Applications/Help/MainWidget.h b/Userland/Applications/Help/MainWidget.h index eaf9122495..8dcc756bde 100644 --- a/Userland/Applications/Help/MainWidget.h +++ b/Userland/Applications/Help/MainWidget.h @@ -9,7 +9,7 @@ #include "History.h" #include "ManualModel.h" #include -#include +#include namespace Help { @@ -45,7 +45,7 @@ private: RefPtr m_search_box; RefPtr m_search_view; RefPtr m_browse_view; - RefPtr m_web_view; + RefPtr m_web_view; RefPtr m_toolbar; RefPtr m_statusbar; diff --git a/Userland/Applications/Mail/CMakeLists.txt b/Userland/Applications/Mail/CMakeLists.txt index 7e1d8f1b2a..893670e19e 100644 --- a/Userland/Applications/Mail/CMakeLists.txt +++ b/Userland/Applications/Mail/CMakeLists.txt @@ -16,4 +16,4 @@ set(SOURCES ) serenity_app(Mail ICON app-mail) -target_link_libraries(Mail LibConfig LibCore LibDesktop LibGfx LibGUI LibIMAP LibWeb LibMain) +target_link_libraries(Mail LibConfig LibCore LibDesktop LibGfx LibGUI LibIMAP LibWebView LibWeb LibMain) diff --git a/Userland/Applications/Mail/MailWidget.cpp b/Userland/Applications/Mail/MailWidget.cpp index 865a1f6497..b0664dc1ef 100644 --- a/Userland/Applications/Mail/MailWidget.cpp +++ b/Userland/Applications/Mail/MailWidget.cpp @@ -28,7 +28,7 @@ MailWidget::MailWidget() m_mailbox_list = *find_descendant_of_type_named("mailbox_list"); m_individual_mailbox_view = *find_descendant_of_type_named("individual_mailbox_view"); - m_web_view = *find_descendant_of_type_named("web_view"); + m_web_view = *find_descendant_of_type_named("web_view"); m_statusbar = *find_descendant_of_type_named("statusbar"); m_mailbox_list->on_selection_change = [this] { diff --git a/Userland/Applications/Mail/MailWidget.h b/Userland/Applications/Mail/MailWidget.h index 650e0d65a1..91ab8baf83 100644 --- a/Userland/Applications/Mail/MailWidget.h +++ b/Userland/Applications/Mail/MailWidget.h @@ -13,7 +13,7 @@ #include #include #include -#include +#include class MailWidget final : public GUI::Widget { C_OBJECT(MailWidget) @@ -43,7 +43,7 @@ private: RefPtr m_mailbox_list; RefPtr m_individual_mailbox_view; - RefPtr m_web_view; + RefPtr m_web_view; RefPtr m_statusbar; RefPtr m_link_context_menu; diff --git a/Userland/Applications/Mail/MailWindow.gml b/Userland/Applications/Mail/MailWindow.gml index f011048732..602bf7d609 100644 --- a/Userland/Applications/Mail/MailWindow.gml +++ b/Userland/Applications/Mail/MailWindow.gml @@ -15,7 +15,7 @@ name: "individual_mailbox_view" } - @Web::OutOfProcessWebView { + @WebView::OutOfProcessWebView { name: "web_view" } } diff --git a/Userland/Applications/Spreadsheet/CMakeLists.txt b/Userland/Applications/Spreadsheet/CMakeLists.txt index 2c3cb429ae..79837b0aad 100644 --- a/Userland/Applications/Spreadsheet/CMakeLists.txt +++ b/Userland/Applications/Spreadsheet/CMakeLists.txt @@ -41,7 +41,7 @@ set(GENERATED_SOURCES ) serenity_app(Spreadsheet ICON app-spreadsheet) -target_link_libraries(Spreadsheet LibFileSystemAccessClient LibGUI LibJS LibMain LibWeb) +target_link_libraries(Spreadsheet LibFileSystemAccessClient LibGUI LibJS LibMain LibWebView LibWeb) link_with_unicode_data(Spreadsheet) serenity_test(Writers/Test/TestXSVWriter.cpp Spreadsheet) diff --git a/Userland/Applications/Spreadsheet/HelpWindow.cpp b/Userland/Applications/Spreadsheet/HelpWindow.cpp index 298bd2d5bb..6a9f5eb71e 100644 --- a/Userland/Applications/Spreadsheet/HelpWindow.cpp +++ b/Userland/Applications/Spreadsheet/HelpWindow.cpp @@ -16,7 +16,7 @@ #include #include #include -#include +#include namespace Spreadsheet { @@ -80,7 +80,7 @@ HelpWindow::HelpWindow(GUI::Window* parent) m_listview->set_activates_on_selection(true); m_listview->set_model(HelpListModel::create()); - m_webview = splitter.add(); + m_webview = splitter.add(); m_webview->on_link_click = [this](auto& url, auto&, auto&&) { VERIFY(url.protocol() == "spreadsheet"); if (url.host() == "example") { diff --git a/Userland/Applications/Spreadsheet/HelpWindow.h b/Userland/Applications/Spreadsheet/HelpWindow.h index 1ee43a1afa..a63c8c06b0 100644 --- a/Userland/Applications/Spreadsheet/HelpWindow.h +++ b/Userland/Applications/Spreadsheet/HelpWindow.h @@ -10,7 +10,7 @@ #include #include #include -#include +#include namespace Spreadsheet { @@ -36,7 +36,7 @@ private: HelpWindow(GUI::Window* parent = nullptr); JsonObject m_docs; - RefPtr m_webview; + RefPtr m_webview; RefPtr m_listview; }; diff --git a/Userland/Applications/TextEditor/CMakeLists.txt b/Userland/Applications/TextEditor/CMakeLists.txt index f1c18a83bf..9250b3c820 100644 --- a/Userland/Applications/TextEditor/CMakeLists.txt +++ b/Userland/Applications/TextEditor/CMakeLists.txt @@ -15,5 +15,5 @@ set(SOURCES ) serenity_app(TextEditor ICON app-text-editor) -target_link_libraries(TextEditor LibWeb LibMarkdown LibGUI LibShell LibRegex LibDesktop LibCpp LibJS LibSQL LibFileSystemAccessClient LibConfig LibMain) +target_link_libraries(TextEditor LibWebView LibWeb LibMarkdown LibGUI LibShell LibRegex LibDesktop LibCpp LibJS LibSQL LibFileSystemAccessClient LibConfig LibMain) link_with_unicode_data(TextEditor) diff --git a/Userland/Applications/TextEditor/MainWidget.cpp b/Userland/Applications/TextEditor/MainWidget.cpp index fd924d8e88..383d0e2d47 100644 --- a/Userland/Applications/TextEditor/MainWidget.cpp +++ b/Userland/Applications/TextEditor/MainWidget.cpp @@ -41,7 +41,7 @@ #include #include #include -#include +#include #include namespace TextEditor { @@ -311,11 +311,11 @@ MainWidget::MainWidget() m_toolbar->add_action(m_editor->redo_action()); } -Web::OutOfProcessWebView& MainWidget::ensure_web_view() +WebView::OutOfProcessWebView& MainWidget::ensure_web_view() { if (!m_page_view) { auto& web_view_container = *find_descendant_of_type_named("web_view_container"); - m_page_view = web_view_container.add(); + m_page_view = web_view_container.add(); m_page_view->on_link_hover = [this](auto& url) { if (url.is_valid()) m_statusbar->set_text(url.to_string()); diff --git a/Userland/Applications/TextEditor/MainWidget.h b/Userland/Applications/TextEditor/MainWidget.h index 8644975b6a..e094d0d1a6 100644 --- a/Userland/Applications/TextEditor/MainWidget.h +++ b/Userland/Applications/TextEditor/MainWidget.h @@ -16,7 +16,7 @@ #include #include #include -#include +#include namespace TextEditor { @@ -51,7 +51,7 @@ private: void update_markdown_preview(); void update_html_preview(); - Web::OutOfProcessWebView& ensure_web_view(); + WebView::OutOfProcessWebView& ensure_web_view(); void set_web_view_visible(bool); virtual void drop_event(GUI::DropEvent&) override; @@ -134,7 +134,7 @@ private: RefPtr m_shell_highlight; RefPtr m_sql_highlight; - RefPtr m_page_view; + RefPtr m_page_view; bool m_auto_detect_preview_mode { false }; bool m_use_regex { false }; diff --git a/Userland/Applications/Welcome/CMakeLists.txt b/Userland/Applications/Welcome/CMakeLists.txt index 14172ed1d4..f9c86973b4 100644 --- a/Userland/Applications/Welcome/CMakeLists.txt +++ b/Userland/Applications/Welcome/CMakeLists.txt @@ -13,4 +13,4 @@ set(SOURCES ) serenity_app(Welcome ICON app-welcome) -target_link_libraries(Welcome LibGUI LibWeb LibMain) +target_link_libraries(Welcome LibGUI LibWebView LibWeb LibMain) diff --git a/Userland/Applications/Welcome/WelcomeWidget.cpp b/Userland/Applications/Welcome/WelcomeWidget.cpp index a670160743..e4583e417c 100644 --- a/Userland/Applications/Welcome/WelcomeWidget.cpp +++ b/Userland/Applications/Welcome/WelcomeWidget.cpp @@ -18,7 +18,7 @@ #include #include #include -#include +#include #include WelcomeWidget::WelcomeWidget() @@ -32,7 +32,7 @@ WelcomeWidget::WelcomeWidget() auto& light_bulb_label = *find_descendant_of_type_named("light_bulb_label"); light_bulb_label.set_icon(Gfx::Bitmap::try_load_from_file("/res/icons/32x32/app-welcome.png").release_value_but_fixme_should_propagate_errors()); - m_web_view = *find_descendant_of_type_named("web_view"); + m_web_view = *find_descendant_of_type_named("web_view"); m_tip_label = *find_descendant_of_type_named("tip_label"); diff --git a/Userland/Applications/Welcome/WelcomeWidget.h b/Userland/Applications/Welcome/WelcomeWidget.h index ed4d795194..427324e5e8 100644 --- a/Userland/Applications/Welcome/WelcomeWidget.h +++ b/Userland/Applications/Welcome/WelcomeWidget.h @@ -7,7 +7,7 @@ #pragma once #include -#include +#include class WelcomeWidget final : public GUI::Widget { C_OBJECT(WelcomeWidget); @@ -30,7 +30,7 @@ private: RefPtr m_new_button; RefPtr m_tip_label; RefPtr m_startup_checkbox; - RefPtr m_web_view; + RefPtr m_web_view; size_t m_initial_tip_index { 0 }; Vector m_tips; diff --git a/Userland/Applications/Welcome/WelcomeWindow.gml b/Userland/Applications/Welcome/WelcomeWindow.gml index 0de47fe28b..6c7ebae2e3 100644 --- a/Userland/Applications/Welcome/WelcomeWindow.gml +++ b/Userland/Applications/Welcome/WelcomeWindow.gml @@ -53,7 +53,7 @@ } } - @Web::OutOfProcessWebView { + @WebView::OutOfProcessWebView { name: "web_view" min_width: 340 min_height: 160 diff --git a/Userland/DevTools/HackStudio/CMakeLists.txt b/Userland/DevTools/HackStudio/CMakeLists.txt index ffdfca0a48..b88bc28e5f 100644 --- a/Userland/DevTools/HackStudio/CMakeLists.txt +++ b/Userland/DevTools/HackStudio/CMakeLists.txt @@ -55,6 +55,6 @@ set(SOURCES ) serenity_app(HackStudio ICON app-hack-studio) -target_link_libraries(HackStudio LibWeb LibMarkdown LibGUI LibCpp LibGfx LibCore LibVT LibDebug LibX86 LibDiff LibShell LibSymbolication LibRegex LibSQL LibCoredump LibMain) +target_link_libraries(HackStudio LibWebView LibWeb LibMarkdown LibGUI LibCpp LibGfx LibCore LibVT LibDebug LibX86 LibDiff LibShell LibSymbolication LibRegex LibSQL LibCoredump LibMain) link_with_unicode_data(HackStudio) add_dependencies(HackStudio CppLanguageServer) diff --git a/Userland/DevTools/HackStudio/Editor.cpp b/Userland/DevTools/HackStudio/Editor.cpp index 181cc2b2b3..1c24611539 100644 --- a/Userland/DevTools/HackStudio/Editor.cpp +++ b/Userland/DevTools/HackStudio/Editor.cpp @@ -36,7 +36,7 @@ #include #include #include -#include +#include #include #include @@ -77,7 +77,7 @@ ErrorOr Editor::initialize_documentation_tooltip() m_documentation_tooltip_window = GUI::Window::construct(); m_documentation_tooltip_window->set_rect(0, 0, 500, 400); m_documentation_tooltip_window->set_window_type(GUI::WindowType::Tooltip); - m_documentation_page_view = TRY(m_documentation_tooltip_window->try_set_main_widget()); + m_documentation_page_view = TRY(m_documentation_tooltip_window->try_set_main_widget()); return {}; } @@ -86,7 +86,7 @@ ErrorOr Editor::initialize_parameters_hint_tooltip() m_parameters_hint_tooltip_window = GUI::Window::construct(); m_parameters_hint_tooltip_window->set_rect(0, 0, 280, 35); m_parameters_hint_tooltip_window->set_window_type(GUI::WindowType::Tooltip); - m_parameter_hint_page_view = TRY(m_parameters_hint_tooltip_window->try_set_main_widget()); + m_parameter_hint_page_view = TRY(m_parameters_hint_tooltip_window->try_set_main_widget()); return {}; } diff --git a/Userland/DevTools/HackStudio/Editor.h b/Userland/DevTools/HackStudio/Editor.h index d2031b202b..ce9de85b7c 100644 --- a/Userland/DevTools/HackStudio/Editor.h +++ b/Userland/DevTools/HackStudio/Editor.h @@ -15,7 +15,7 @@ #include #include #include -#include +#include namespace HackStudio { @@ -113,8 +113,8 @@ private: RefPtr m_documentation_tooltip_window; RefPtr m_parameters_hint_tooltip_window; - RefPtr m_documentation_page_view; - RefPtr m_parameter_hint_page_view; + RefPtr m_documentation_page_view; + RefPtr m_parameter_hint_page_view; String m_last_parsed_token; GUI::TextPosition m_previous_text_position { 0, 0 }; bool m_hovering_editor { false }; diff --git a/Userland/Libraries/CMakeLists.txt b/Userland/Libraries/CMakeLists.txt index 6b3cb12b76..fdbf7ab6fa 100644 --- a/Userland/Libraries/CMakeLists.txt +++ b/Userland/Libraries/CMakeLists.txt @@ -58,5 +58,6 @@ add_subdirectory(LibVT) add_subdirectory(LibWasm) add_subdirectory(LibWeb) add_subdirectory(LibWebSocket) +add_subdirectory(LibWebView) add_subdirectory(LibX86) add_subdirectory(LibXML) diff --git a/Userland/Libraries/LibWeb/CMakeLists.txt b/Userland/Libraries/LibWeb/CMakeLists.txt index 624f6fbcd5..e74c563763 100644 --- a/Userland/Libraries/LibWeb/CMakeLists.txt +++ b/Userland/Libraries/LibWeb/CMakeLists.txt @@ -285,7 +285,6 @@ set(SOURCES MimeSniff/MimeType.cpp Namespace.cpp NavigationTiming/PerformanceTiming.cpp - OutOfProcessWebView.cpp Page/EditEventHandler.cpp Page/EventHandler.cpp Page/Page.cpp @@ -355,7 +354,6 @@ set(SOURCES WebAssembly/WebAssemblyTableConstructor.cpp WebAssembly/WebAssemblyTableObject.cpp WebAssembly/WebAssemblyTablePrototype.cpp - WebContentClient.cpp WebSockets/WebSocket.cpp XHR/EventNames.cpp XHR/XMLHttpRequest.cpp @@ -366,8 +364,6 @@ set(SOURCES set(GENERATED_SOURCES ../../Services/RequestServer/RequestClientEndpoint.h ../../Services/RequestServer/RequestServerEndpoint.h - ../../Services/WebContent/WebContentClientEndpoint.h - ../../Services/WebContent/WebContentServerEndpoint.h ) generate_css_implementation() diff --git a/Userland/Libraries/LibWeb/DumpLayoutTree/CMakeLists.txt b/Userland/Libraries/LibWeb/DumpLayoutTree/CMakeLists.txt index 11a7ce62f5..5891a69932 100644 --- a/Userland/Libraries/LibWeb/DumpLayoutTree/CMakeLists.txt +++ b/Userland/Libraries/LibWeb/DumpLayoutTree/CMakeLists.txt @@ -3,4 +3,4 @@ set(SOURCES ) serenity_bin(DumpLayoutTree) -target_link_libraries(DumpLayoutTree LibWeb) +target_link_libraries(DumpLayoutTree LibWebView LibWeb) diff --git a/Userland/Libraries/LibWeb/DumpLayoutTree/main.cpp b/Userland/Libraries/LibWeb/DumpLayoutTree/main.cpp index f4fcb5ad4c..577c8b144b 100644 --- a/Userland/Libraries/LibWeb/DumpLayoutTree/main.cpp +++ b/Userland/Libraries/LibWeb/DumpLayoutTree/main.cpp @@ -6,7 +6,7 @@ #include #include -#include +#include #include int main(int argc, char** argv) @@ -16,7 +16,7 @@ int main(int argc, char** argv) window->set_title("DumpLayoutTree"); window->resize(800, 600); window->show(); - auto& web_view = window->set_main_widget(); + auto& web_view = window->set_main_widget(); web_view.load(URL::create_with_file_protocol(argv[1])); web_view.on_load_finish = [&](auto&) { auto dump = web_view.dump_layout_tree(); diff --git a/Userland/Libraries/LibWeb/Forward.h b/Userland/Libraries/LibWeb/Forward.h index de34410f9a..71a6c8922a 100644 --- a/Userland/Libraries/LibWeb/Forward.h +++ b/Userland/Libraries/LibWeb/Forward.h @@ -370,7 +370,6 @@ class EventHandler; class FrameLoader; class LoadRequest; class Origin; -class OutOfProcessWebView; class Page; class PageClient; class PaintContext; diff --git a/Userland/Libraries/LibWebView/CMakeLists.txt b/Userland/Libraries/LibWebView/CMakeLists.txt new file mode 100644 index 0000000000..9b8847369f --- /dev/null +++ b/Userland/Libraries/LibWebView/CMakeLists.txt @@ -0,0 +1,14 @@ +set(SOURCES + OutOfProcessWebView.cpp + WebContentClient.cpp +) + +set(GENERATED_SOURCES + ../../Services/RequestServer/RequestClientEndpoint.h + ../../Services/RequestServer/RequestServerEndpoint.h + ../../Services/WebContent/WebContentClientEndpoint.h + ../../Services/WebContent/WebContentServerEndpoint.h +) + +serenity_lib(LibWebView webview) +target_link_libraries(LibWebView LibGfx LibGUI LibIPC LibWeb) diff --git a/Userland/Libraries/LibWebView/Forward.h b/Userland/Libraries/LibWebView/Forward.h new file mode 100644 index 0000000000..a52b609cd5 --- /dev/null +++ b/Userland/Libraries/LibWebView/Forward.h @@ -0,0 +1,13 @@ +/* + * Copyright (c) 2022, The SerenityOS developers + * + * SPDX-License-Identifier: BSD-2-Clause + */ + +#pragma once + +namespace WebView { + +class OutOfProcessWebView; + +} diff --git a/Userland/Libraries/LibWeb/OutOfProcessWebView.cpp b/Userland/Libraries/LibWebView/OutOfProcessWebView.cpp similarity index 98% rename from Userland/Libraries/LibWeb/OutOfProcessWebView.cpp rename to Userland/Libraries/LibWebView/OutOfProcessWebView.cpp index 08f89d3151..9a99d5feeb 100644 --- a/Userland/Libraries/LibWeb/OutOfProcessWebView.cpp +++ b/Userland/Libraries/LibWebView/OutOfProcessWebView.cpp @@ -18,9 +18,9 @@ #include #include -REGISTER_WIDGET(Web, OutOfProcessWebView) +REGISTER_WIDGET(WebView, OutOfProcessWebView) -namespace Web { +namespace WebView { OutOfProcessWebView::OutOfProcessWebView() { @@ -376,14 +376,14 @@ void OutOfProcessWebView::notify_server_did_change_favicon(Gfx::Bitmap const& fa on_favicon_change(favicon); } -String OutOfProcessWebView::notify_server_did_request_cookie(Badge, const AK::URL& url, Cookie::Source source) +String OutOfProcessWebView::notify_server_did_request_cookie(Badge, const AK::URL& url, Web::Cookie::Source source) { if (on_get_cookie) return on_get_cookie(url, source); return {}; } -void OutOfProcessWebView::notify_server_did_set_cookie(Badge, const AK::URL& url, Cookie::ParsedCookie const& cookie, Cookie::Source source) +void OutOfProcessWebView::notify_server_did_set_cookie(Badge, const AK::URL& url, Web::Cookie::ParsedCookie const& cookie, Web::Cookie::Source source) { if (on_set_cookie) on_set_cookie(url, cookie, source); @@ -437,7 +437,7 @@ void OutOfProcessWebView::inspect_dom_tree() client().async_inspect_dom_tree(); } -Optional OutOfProcessWebView::inspect_dom_node(i32 node_id, Optional pseudo_element) +Optional OutOfProcessWebView::inspect_dom_node(i32 node_id, Optional pseudo_element) { auto response = client().inspect_dom_node(node_id, pseudo_element); if (!response.has_style()) diff --git a/Userland/Libraries/LibWeb/OutOfProcessWebView.h b/Userland/Libraries/LibWebView/OutOfProcessWebView.h similarity index 94% rename from Userland/Libraries/LibWeb/OutOfProcessWebView.h rename to Userland/Libraries/LibWebView/OutOfProcessWebView.h index 55f513c47c..c4fb09f134 100644 --- a/Userland/Libraries/LibWeb/OutOfProcessWebView.h +++ b/Userland/Libraries/LibWebView/OutOfProcessWebView.h @@ -12,7 +12,7 @@ #include #include -namespace Web { +namespace WebView { class WebContentClient; @@ -38,7 +38,7 @@ public: String custom_properties_json; String node_box_sizing_json; }; - Optional inspect_dom_node(i32 node_id, Optional); + Optional inspect_dom_node(i32 node_id, Optional); void clear_inspected_dom_node(); i32 get_hovered_node_id(); @@ -69,14 +69,14 @@ public: Function on_load_finish; Function on_favicon_change; Function on_url_drop; - Function on_set_document; + Function on_set_document; Function on_get_source; Function on_get_dom_tree; Function on_get_dom_node_properties; Function on_js_console_new_message; Function const& message_types, Vector const& messages)> on_get_js_console_messages; - Function on_get_cookie; - Function on_set_cookie; + Function on_get_cookie; + Function on_set_cookie; Function on_resource_status_change; void notify_server_did_layout(Badge, Gfx::IntSize const& content_size); @@ -108,8 +108,8 @@ public: void notify_server_did_output_js_console_message(i32 message_index); void notify_server_did_get_js_console_messages(i32 start_index, Vector const& message_types, Vector const& messages); void notify_server_did_change_favicon(Gfx::Bitmap const& favicon); - String notify_server_did_request_cookie(Badge, const AK::URL& url, Cookie::Source source); - void notify_server_did_set_cookie(Badge, const AK::URL& url, Cookie::ParsedCookie const& cookie, Cookie::Source source); + String notify_server_did_request_cookie(Badge, const AK::URL& url, Web::Cookie::Source source); + void notify_server_did_set_cookie(Badge, const AK::URL& url, Web::Cookie::ParsedCookie const& cookie, Web::Cookie::Source source); void notify_server_did_update_resource_count(i32 count_waiting); private: diff --git a/Userland/Libraries/LibWeb/WebContentClient.cpp b/Userland/Libraries/LibWebView/WebContentClient.cpp similarity index 98% rename from Userland/Libraries/LibWeb/WebContentClient.cpp rename to Userland/Libraries/LibWebView/WebContentClient.cpp index ae75861d6c..f91e35bfed 100644 --- a/Userland/Libraries/LibWeb/WebContentClient.cpp +++ b/Userland/Libraries/LibWebView/WebContentClient.cpp @@ -9,7 +9,7 @@ #include #include -namespace Web { +namespace WebView { WebContentClient::WebContentClient(NonnullOwnPtr socket, OutOfProcessWebView& view) : IPC::ConnectionToServer(*this, move(socket)) @@ -187,12 +187,12 @@ void WebContentClient::did_change_favicon(Gfx::ShareableBitmap const& favicon) Messages::WebContentClient::DidRequestCookieResponse WebContentClient::did_request_cookie(AK::URL const& url, u8 source) { - return m_view.notify_server_did_request_cookie({}, url, static_cast(source)); + return m_view.notify_server_did_request_cookie({}, url, static_cast(source)); } void WebContentClient::did_set_cookie(AK::URL const& url, Web::Cookie::ParsedCookie const& cookie, u8 source) { - m_view.notify_server_did_set_cookie({}, url, cookie, static_cast(source)); + m_view.notify_server_did_set_cookie({}, url, cookie, static_cast(source)); } void WebContentClient::did_update_resource_count(i32 count_waiting) diff --git a/Userland/Libraries/LibWeb/WebContentClient.h b/Userland/Libraries/LibWebView/WebContentClient.h similarity index 99% rename from Userland/Libraries/LibWeb/WebContentClient.h rename to Userland/Libraries/LibWebView/WebContentClient.h index 5beef79b29..705c5fcea2 100644 --- a/Userland/Libraries/LibWeb/WebContentClient.h +++ b/Userland/Libraries/LibWebView/WebContentClient.h @@ -12,7 +12,7 @@ #include #include -namespace Web { +namespace WebView { class OutOfProcessWebView; diff --git a/Userland/Services/WebContent/CMakeLists.txt b/Userland/Services/WebContent/CMakeLists.txt index 0c10d7671f..c39435120a 100644 --- a/Userland/Services/WebContent/CMakeLists.txt +++ b/Userland/Services/WebContent/CMakeLists.txt @@ -17,5 +17,5 @@ set(SOURCES ) serenity_bin(WebContent) -target_link_libraries(WebContent LibCore LibIPC LibGfx LibWeb LibMain) +target_link_libraries(WebContent LibCore LibIPC LibGfx LibWebView LibWeb LibMain) link_with_unicode_data(WebContent)