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.
This commit is contained in:
DexesTTP 2022-04-30 10:46:33 +02:00 committed by Andreas Kling
parent 31c0022429
commit dcbbbf5b4a
Notes: sideshowbarker 2024-07-17 10:54:09 +09:00
41 changed files with 97 additions and 73 deletions

View file

@ -37,7 +37,7 @@
#include <LibWeb/Dump.h> #include <LibWeb/Dump.h>
#include <LibWeb/Layout/InitialContainingBlock.h> #include <LibWeb/Layout/InitialContainingBlock.h>
#include <LibWeb/Loader/ResourceLoader.h> #include <LibWeb/Loader/ResourceLoader.h>
#include <LibWeb/OutOfProcessWebView.h> #include <LibWebView/OutOfProcessWebView.h>
namespace Browser { namespace Browser {

View file

@ -33,5 +33,5 @@ set(SOURCES
) )
serenity_app(Browser ICON app-browser) 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) link_with_unicode_data(Browser)

View file

@ -24,7 +24,7 @@ ConsoleWidget::ConsoleWidget()
set_layout<GUI::VerticalBoxLayout>(); set_layout<GUI::VerticalBoxLayout>();
set_fill_with_background_color(true); set_fill_with_background_color(true);
m_output_view = add<Web::OutOfProcessWebView>(); m_output_view = add<WebView::OutOfProcessWebView>();
m_output_view->load("data:text/html,<html></html>"); m_output_view->load("data:text/html,<html></html>");
// Wait until our output WebView is loaded, and then request any messages that occurred before we existed // 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&) { m_output_view->on_load_finish = [this](auto&) {

View file

@ -11,7 +11,7 @@
#include "History.h" #include "History.h"
#include <LibGUI/Widget.h> #include <LibGUI/Widget.h>
#include <LibWeb/OutOfProcessWebView.h> #include <LibWebView/OutOfProcessWebView.h>
namespace Browser { namespace Browser {
@ -38,7 +38,7 @@ private:
void end_group(); void end_group();
RefPtr<GUI::TextBox> m_input; RefPtr<GUI::TextBox> m_input;
RefPtr<Web::OutOfProcessWebView> m_output_view; RefPtr<WebView::OutOfProcessWebView> m_output_view;
i32 m_highest_notified_message_index { -1 }; i32 m_highest_notified_message_index { -1 };
i32 m_highest_received_message_index { -1 }; i32 m_highest_received_message_index { -1 };

View file

@ -16,8 +16,8 @@
#include <LibWeb/DOM/Document.h> #include <LibWeb/DOM/Document.h>
#include <LibWeb/DOM/Element.h> #include <LibWeb/DOM/Element.h>
#include <LibWeb/DOMTreeModel.h> #include <LibWeb/DOMTreeModel.h>
#include <LibWeb/OutOfProcessWebView.h>
#include <LibWeb/StylePropertiesModel.h> #include <LibWeb/StylePropertiesModel.h>
#include <LibWebView/OutOfProcessWebView.h>
namespace Browser { namespace Browser {

View file

@ -13,6 +13,7 @@
#include <LibWeb/CSS/Selector.h> #include <LibWeb/CSS/Selector.h>
#include <LibWeb/Forward.h> #include <LibWeb/Forward.h>
#include <LibWeb/Layout/BoxModelMetrics.h> #include <LibWeb/Layout/BoxModelMetrics.h>
#include <LibWebView/Forward.h>
namespace Browser { namespace Browser {
@ -38,7 +39,7 @@ public:
virtual ~InspectorWidget() = default; virtual ~InspectorWidget() = default;
void set_web_view(NonnullRefPtr<Web::OutOfProcessWebView> web_view) { m_web_view = web_view; } void set_web_view(NonnullRefPtr<WebView::OutOfProcessWebView> web_view) { m_web_view = web_view; }
void set_dom_json(String); void set_dom_json(String);
void clear_dom_json(); 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); 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<String> node_box_sizing_json); void update_node_box_model(Optional<String> node_box_sizing_json);
void clear_style_json(); void clear_style_json();
RefPtr<Web::OutOfProcessWebView> m_web_view; RefPtr<WebView::OutOfProcessWebView> m_web_view;
RefPtr<GUI::TreeView> m_dom_tree_view; RefPtr<GUI::TreeView> m_dom_tree_view;
RefPtr<GUI::TableView> m_computed_style_table_view; RefPtr<GUI::TableView> m_computed_style_table_view;

View file

@ -36,7 +36,7 @@
#include <LibWeb/Layout/BlockContainer.h> #include <LibWeb/Layout/BlockContainer.h>
#include <LibWeb/Layout/InitialContainingBlock.h> #include <LibWeb/Layout/InitialContainingBlock.h>
#include <LibWeb/Loader/ResourceLoader.h> #include <LibWeb/Loader/ResourceLoader.h>
#include <LibWeb/OutOfProcessWebView.h> #include <LibWebView/OutOfProcessWebView.h>
namespace Browser { namespace Browser {
@ -112,7 +112,7 @@ Tab::Tab(BrowserWindow& window)
auto& webview_container = *find_descendant_of_type_named<GUI::Widget>("webview_container"); auto& webview_container = *find_descendant_of_type_named<GUI::Widget>("webview_container");
m_web_content_view = webview_container.add<Web::OutOfProcessWebView>(); m_web_content_view = webview_container.add<WebView::OutOfProcessWebView>();
if (g_content_filters_enabled) if (g_content_filters_enabled)
m_web_content_view->set_content_filters(g_content_filters); m_web_content_view->set_content_filters(g_content_filters);
else else

View file

@ -16,7 +16,7 @@
#include <LibHTTP/Job.h> #include <LibHTTP/Job.h>
#include <LibWeb/Forward.h> #include <LibWeb/Forward.h>
namespace Web { namespace WebView {
class OutOfProcessWebView; class OutOfProcessWebView;
} }
@ -79,7 +79,7 @@ public:
String const& title() const { return m_title; } String const& title() const { return m_title; }
Gfx::Bitmap const* icon() const { return m_icon; } 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: private:
explicit Tab(BrowserWindow&); explicit Tab(BrowserWindow&);
@ -103,7 +103,7 @@ private:
History m_history; History m_history;
RefPtr<Web::OutOfProcessWebView> m_web_content_view; RefPtr<WebView::OutOfProcessWebView> m_web_content_view;
RefPtr<GUI::UrlBox> m_location_box; RefPtr<GUI::UrlBox> m_location_box;
RefPtr<GUI::Button> m_bookmark_button; RefPtr<GUI::Button> m_bookmark_button;

View file

@ -17,5 +17,5 @@ set(SOURCES
) )
serenity_app(Help ICON app-help) 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) link_with_unicode_data(Help)

View file

@ -41,7 +41,7 @@
} }
} }
@Web::OutOfProcessWebView { @WebView::OutOfProcessWebView {
name: "web_view" name: "web_view"
} }
} }

View file

@ -90,7 +90,7 @@ MainWidget::MainWidget()
m_manual_model->update_section_node_on_toggle(index, open); m_manual_model->update_section_node_on_toggle(index, open);
}; };
m_web_view = find_descendant_of_type_named<Web::OutOfProcessWebView>("web_view"); m_web_view = find_descendant_of_type_named<WebView::OutOfProcessWebView>("web_view");
m_web_view->on_link_click = [this](auto& url, auto&, unsigned) { m_web_view->on_link_click = [this](auto& url, auto&, unsigned) {
if (url.protocol() == "file") { if (url.protocol() == "file") {
auto path = url.path(); auto path = url.path();

View file

@ -9,7 +9,7 @@
#include "History.h" #include "History.h"
#include "ManualModel.h" #include "ManualModel.h"
#include <LibGUI/FilteringProxyModel.h> #include <LibGUI/FilteringProxyModel.h>
#include <LibWeb/OutOfProcessWebView.h> #include <LibWebView/OutOfProcessWebView.h>
namespace Help { namespace Help {
@ -45,7 +45,7 @@ private:
RefPtr<GUI::TextBox> m_search_box; RefPtr<GUI::TextBox> m_search_box;
RefPtr<GUI::ListView> m_search_view; RefPtr<GUI::ListView> m_search_view;
RefPtr<GUI::TreeView> m_browse_view; RefPtr<GUI::TreeView> m_browse_view;
RefPtr<Web::OutOfProcessWebView> m_web_view; RefPtr<WebView::OutOfProcessWebView> m_web_view;
RefPtr<GUI::Toolbar> m_toolbar; RefPtr<GUI::Toolbar> m_toolbar;
RefPtr<GUI::Statusbar> m_statusbar; RefPtr<GUI::Statusbar> m_statusbar;

View file

@ -16,4 +16,4 @@ set(SOURCES
) )
serenity_app(Mail ICON app-mail) 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)

View file

@ -28,7 +28,7 @@ MailWidget::MailWidget()
m_mailbox_list = *find_descendant_of_type_named<GUI::TreeView>("mailbox_list"); m_mailbox_list = *find_descendant_of_type_named<GUI::TreeView>("mailbox_list");
m_individual_mailbox_view = *find_descendant_of_type_named<GUI::TableView>("individual_mailbox_view"); m_individual_mailbox_view = *find_descendant_of_type_named<GUI::TableView>("individual_mailbox_view");
m_web_view = *find_descendant_of_type_named<Web::OutOfProcessWebView>("web_view"); m_web_view = *find_descendant_of_type_named<WebView::OutOfProcessWebView>("web_view");
m_statusbar = *find_descendant_of_type_named<GUI::Statusbar>("statusbar"); m_statusbar = *find_descendant_of_type_named<GUI::Statusbar>("statusbar");
m_mailbox_list->on_selection_change = [this] { m_mailbox_list->on_selection_change = [this] {

View file

@ -13,7 +13,7 @@
#include <LibGUI/Widget.h> #include <LibGUI/Widget.h>
#include <LibGfx/ShareableBitmap.h> #include <LibGfx/ShareableBitmap.h>
#include <LibIMAP/Client.h> #include <LibIMAP/Client.h>
#include <LibWeb/OutOfProcessWebView.h> #include <LibWebView/OutOfProcessWebView.h>
class MailWidget final : public GUI::Widget { class MailWidget final : public GUI::Widget {
C_OBJECT(MailWidget) C_OBJECT(MailWidget)
@ -43,7 +43,7 @@ private:
RefPtr<GUI::TreeView> m_mailbox_list; RefPtr<GUI::TreeView> m_mailbox_list;
RefPtr<GUI::TableView> m_individual_mailbox_view; RefPtr<GUI::TableView> m_individual_mailbox_view;
RefPtr<Web::OutOfProcessWebView> m_web_view; RefPtr<WebView::OutOfProcessWebView> m_web_view;
RefPtr<GUI::Statusbar> m_statusbar; RefPtr<GUI::Statusbar> m_statusbar;
RefPtr<GUI::Menu> m_link_context_menu; RefPtr<GUI::Menu> m_link_context_menu;

View file

@ -15,7 +15,7 @@
name: "individual_mailbox_view" name: "individual_mailbox_view"
} }
@Web::OutOfProcessWebView { @WebView::OutOfProcessWebView {
name: "web_view" name: "web_view"
} }
} }

View file

@ -41,7 +41,7 @@ set(GENERATED_SOURCES
) )
serenity_app(Spreadsheet ICON app-spreadsheet) 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) link_with_unicode_data(Spreadsheet)
serenity_test(Writers/Test/TestXSVWriter.cpp Spreadsheet) serenity_test(Writers/Test/TestXSVWriter.cpp Spreadsheet)

View file

@ -16,7 +16,7 @@
#include <LibGUI/Splitter.h> #include <LibGUI/Splitter.h>
#include <LibMarkdown/Document.h> #include <LibMarkdown/Document.h>
#include <LibWeb/Layout/Node.h> #include <LibWeb/Layout/Node.h>
#include <LibWeb/OutOfProcessWebView.h> #include <LibWebView/OutOfProcessWebView.h>
namespace Spreadsheet { namespace Spreadsheet {
@ -80,7 +80,7 @@ HelpWindow::HelpWindow(GUI::Window* parent)
m_listview->set_activates_on_selection(true); m_listview->set_activates_on_selection(true);
m_listview->set_model(HelpListModel::create()); m_listview->set_model(HelpListModel::create());
m_webview = splitter.add<Web::OutOfProcessWebView>(); m_webview = splitter.add<WebView::OutOfProcessWebView>();
m_webview->on_link_click = [this](auto& url, auto&, auto&&) { m_webview->on_link_click = [this](auto& url, auto&, auto&&) {
VERIFY(url.protocol() == "spreadsheet"); VERIFY(url.protocol() == "spreadsheet");
if (url.host() == "example") { if (url.host() == "example") {

View file

@ -10,7 +10,7 @@
#include <LibGUI/Dialog.h> #include <LibGUI/Dialog.h>
#include <LibGUI/Widget.h> #include <LibGUI/Widget.h>
#include <LibGUI/Window.h> #include <LibGUI/Window.h>
#include <LibWeb/OutOfProcessWebView.h> #include <LibWebView/OutOfProcessWebView.h>
namespace Spreadsheet { namespace Spreadsheet {
@ -36,7 +36,7 @@ private:
HelpWindow(GUI::Window* parent = nullptr); HelpWindow(GUI::Window* parent = nullptr);
JsonObject m_docs; JsonObject m_docs;
RefPtr<Web::OutOfProcessWebView> m_webview; RefPtr<WebView::OutOfProcessWebView> m_webview;
RefPtr<GUI::ListView> m_listview; RefPtr<GUI::ListView> m_listview;
}; };

View file

@ -15,5 +15,5 @@ set(SOURCES
) )
serenity_app(TextEditor ICON app-text-editor) 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) link_with_unicode_data(TextEditor)

View file

@ -41,7 +41,7 @@
#include <LibSQL/AST/SyntaxHighlighter.h> #include <LibSQL/AST/SyntaxHighlighter.h>
#include <LibWeb/CSS/SyntaxHighlighter/SyntaxHighlighter.h> #include <LibWeb/CSS/SyntaxHighlighter/SyntaxHighlighter.h>
#include <LibWeb/HTML/SyntaxHighlighter/SyntaxHighlighter.h> #include <LibWeb/HTML/SyntaxHighlighter/SyntaxHighlighter.h>
#include <LibWeb/OutOfProcessWebView.h> #include <LibWebView/OutOfProcessWebView.h>
#include <Shell/SyntaxHighlighter.h> #include <Shell/SyntaxHighlighter.h>
namespace TextEditor { namespace TextEditor {
@ -311,11 +311,11 @@ MainWidget::MainWidget()
m_toolbar->add_action(m_editor->redo_action()); m_toolbar->add_action(m_editor->redo_action());
} }
Web::OutOfProcessWebView& MainWidget::ensure_web_view() WebView::OutOfProcessWebView& MainWidget::ensure_web_view()
{ {
if (!m_page_view) { if (!m_page_view) {
auto& web_view_container = *find_descendant_of_type_named<GUI::Widget>("web_view_container"); auto& web_view_container = *find_descendant_of_type_named<GUI::Widget>("web_view_container");
m_page_view = web_view_container.add<Web::OutOfProcessWebView>(); m_page_view = web_view_container.add<WebView::OutOfProcessWebView>();
m_page_view->on_link_hover = [this](auto& url) { m_page_view->on_link_hover = [this](auto& url) {
if (url.is_valid()) if (url.is_valid())
m_statusbar->set_text(url.to_string()); m_statusbar->set_text(url.to_string());

View file

@ -16,7 +16,7 @@
#include <LibGUI/TextEditor.h> #include <LibGUI/TextEditor.h>
#include <LibGUI/Widget.h> #include <LibGUI/Widget.h>
#include <LibGUI/Window.h> #include <LibGUI/Window.h>
#include <LibWeb/Forward.h> #include <LibWebView/Forward.h>
namespace TextEditor { namespace TextEditor {
@ -51,7 +51,7 @@ private:
void update_markdown_preview(); void update_markdown_preview();
void update_html_preview(); void update_html_preview();
Web::OutOfProcessWebView& ensure_web_view(); WebView::OutOfProcessWebView& ensure_web_view();
void set_web_view_visible(bool); void set_web_view_visible(bool);
virtual void drop_event(GUI::DropEvent&) override; virtual void drop_event(GUI::DropEvent&) override;
@ -134,7 +134,7 @@ private:
RefPtr<GUI::Action> m_shell_highlight; RefPtr<GUI::Action> m_shell_highlight;
RefPtr<GUI::Action> m_sql_highlight; RefPtr<GUI::Action> m_sql_highlight;
RefPtr<Web::OutOfProcessWebView> m_page_view; RefPtr<WebView::OutOfProcessWebView> m_page_view;
bool m_auto_detect_preview_mode { false }; bool m_auto_detect_preview_mode { false };
bool m_use_regex { false }; bool m_use_regex { false };

View file

@ -13,4 +13,4 @@ set(SOURCES
) )
serenity_app(Welcome ICON app-welcome) serenity_app(Welcome ICON app-welcome)
target_link_libraries(Welcome LibGUI LibWeb LibMain) target_link_libraries(Welcome LibGUI LibWebView LibWeb LibMain)

View file

@ -18,7 +18,7 @@
#include <LibGfx/Font/BitmapFont.h> #include <LibGfx/Font/BitmapFont.h>
#include <LibGfx/Palette.h> #include <LibGfx/Palette.h>
#include <LibMarkdown/Document.h> #include <LibMarkdown/Document.h>
#include <LibWeb/OutOfProcessWebView.h> #include <LibWebView/OutOfProcessWebView.h>
#include <serenity.h> #include <serenity.h>
WelcomeWidget::WelcomeWidget() WelcomeWidget::WelcomeWidget()
@ -32,7 +32,7 @@ WelcomeWidget::WelcomeWidget()
auto& light_bulb_label = *find_descendant_of_type_named<GUI::Label>("light_bulb_label"); auto& light_bulb_label = *find_descendant_of_type_named<GUI::Label>("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()); 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::OutOfProcessWebView>("web_view"); m_web_view = *find_descendant_of_type_named<WebView::OutOfProcessWebView>("web_view");
m_tip_label = *find_descendant_of_type_named<GUI::Label>("tip_label"); m_tip_label = *find_descendant_of_type_named<GUI::Label>("tip_label");

View file

@ -7,7 +7,7 @@
#pragma once #pragma once
#include <LibGUI/Widget.h> #include <LibGUI/Widget.h>
#include <LibWeb/OutOfProcessWebView.h> #include <LibWebView/OutOfProcessWebView.h>
class WelcomeWidget final : public GUI::Widget { class WelcomeWidget final : public GUI::Widget {
C_OBJECT(WelcomeWidget); C_OBJECT(WelcomeWidget);
@ -30,7 +30,7 @@ private:
RefPtr<GUI::Button> m_new_button; RefPtr<GUI::Button> m_new_button;
RefPtr<GUI::Label> m_tip_label; RefPtr<GUI::Label> m_tip_label;
RefPtr<GUI::CheckBox> m_startup_checkbox; RefPtr<GUI::CheckBox> m_startup_checkbox;
RefPtr<Web::OutOfProcessWebView> m_web_view; RefPtr<WebView::OutOfProcessWebView> m_web_view;
size_t m_initial_tip_index { 0 }; size_t m_initial_tip_index { 0 };
Vector<String> m_tips; Vector<String> m_tips;

View file

@ -53,7 +53,7 @@
} }
} }
@Web::OutOfProcessWebView { @WebView::OutOfProcessWebView {
name: "web_view" name: "web_view"
min_width: 340 min_width: 340
min_height: 160 min_height: 160

View file

@ -55,6 +55,6 @@ set(SOURCES
) )
serenity_app(HackStudio ICON app-hack-studio) 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) link_with_unicode_data(HackStudio)
add_dependencies(HackStudio CppLanguageServer) add_dependencies(HackStudio CppLanguageServer)

View file

@ -36,7 +36,7 @@
#include <LibWeb/DOM/Text.h> #include <LibWeb/DOM/Text.h>
#include <LibWeb/HTML/HTMLHeadElement.h> #include <LibWeb/HTML/HTMLHeadElement.h>
#include <LibWeb/HTML/SyntaxHighlighter/SyntaxHighlighter.h> #include <LibWeb/HTML/SyntaxHighlighter/SyntaxHighlighter.h>
#include <LibWeb/OutOfProcessWebView.h> #include <LibWebView/OutOfProcessWebView.h>
#include <Shell/SyntaxHighlighter.h> #include <Shell/SyntaxHighlighter.h>
#include <fcntl.h> #include <fcntl.h>
@ -77,7 +77,7 @@ ErrorOr<void> Editor::initialize_documentation_tooltip()
m_documentation_tooltip_window = GUI::Window::construct(); m_documentation_tooltip_window = GUI::Window::construct();
m_documentation_tooltip_window->set_rect(0, 0, 500, 400); m_documentation_tooltip_window->set_rect(0, 0, 500, 400);
m_documentation_tooltip_window->set_window_type(GUI::WindowType::Tooltip); m_documentation_tooltip_window->set_window_type(GUI::WindowType::Tooltip);
m_documentation_page_view = TRY(m_documentation_tooltip_window->try_set_main_widget<Web::OutOfProcessWebView>()); m_documentation_page_view = TRY(m_documentation_tooltip_window->try_set_main_widget<WebView::OutOfProcessWebView>());
return {}; return {};
} }
@ -86,7 +86,7 @@ ErrorOr<void> Editor::initialize_parameters_hint_tooltip()
m_parameters_hint_tooltip_window = GUI::Window::construct(); 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_rect(0, 0, 280, 35);
m_parameters_hint_tooltip_window->set_window_type(GUI::WindowType::Tooltip); 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<Web::OutOfProcessWebView>()); m_parameter_hint_page_view = TRY(m_parameters_hint_tooltip_window->try_set_main_widget<WebView::OutOfProcessWebView>());
return {}; return {};
} }

View file

@ -15,7 +15,7 @@
#include <AK/Optional.h> #include <AK/Optional.h>
#include <AK/OwnPtr.h> #include <AK/OwnPtr.h>
#include <LibGUI/TextEditor.h> #include <LibGUI/TextEditor.h>
#include <LibWeb/Forward.h> #include <LibWebView/Forward.h>
namespace HackStudio { namespace HackStudio {
@ -113,8 +113,8 @@ private:
RefPtr<GUI::Window> m_documentation_tooltip_window; RefPtr<GUI::Window> m_documentation_tooltip_window;
RefPtr<GUI::Window> m_parameters_hint_tooltip_window; RefPtr<GUI::Window> m_parameters_hint_tooltip_window;
RefPtr<Web::OutOfProcessWebView> m_documentation_page_view; RefPtr<WebView::OutOfProcessWebView> m_documentation_page_view;
RefPtr<Web::OutOfProcessWebView> m_parameter_hint_page_view; RefPtr<WebView::OutOfProcessWebView> m_parameter_hint_page_view;
String m_last_parsed_token; String m_last_parsed_token;
GUI::TextPosition m_previous_text_position { 0, 0 }; GUI::TextPosition m_previous_text_position { 0, 0 };
bool m_hovering_editor { false }; bool m_hovering_editor { false };

View file

@ -58,5 +58,6 @@ add_subdirectory(LibVT)
add_subdirectory(LibWasm) add_subdirectory(LibWasm)
add_subdirectory(LibWeb) add_subdirectory(LibWeb)
add_subdirectory(LibWebSocket) add_subdirectory(LibWebSocket)
add_subdirectory(LibWebView)
add_subdirectory(LibX86) add_subdirectory(LibX86)
add_subdirectory(LibXML) add_subdirectory(LibXML)

View file

@ -285,7 +285,6 @@ set(SOURCES
MimeSniff/MimeType.cpp MimeSniff/MimeType.cpp
Namespace.cpp Namespace.cpp
NavigationTiming/PerformanceTiming.cpp NavigationTiming/PerformanceTiming.cpp
OutOfProcessWebView.cpp
Page/EditEventHandler.cpp Page/EditEventHandler.cpp
Page/EventHandler.cpp Page/EventHandler.cpp
Page/Page.cpp Page/Page.cpp
@ -355,7 +354,6 @@ set(SOURCES
WebAssembly/WebAssemblyTableConstructor.cpp WebAssembly/WebAssemblyTableConstructor.cpp
WebAssembly/WebAssemblyTableObject.cpp WebAssembly/WebAssemblyTableObject.cpp
WebAssembly/WebAssemblyTablePrototype.cpp WebAssembly/WebAssemblyTablePrototype.cpp
WebContentClient.cpp
WebSockets/WebSocket.cpp WebSockets/WebSocket.cpp
XHR/EventNames.cpp XHR/EventNames.cpp
XHR/XMLHttpRequest.cpp XHR/XMLHttpRequest.cpp
@ -366,8 +364,6 @@ set(SOURCES
set(GENERATED_SOURCES set(GENERATED_SOURCES
../../Services/RequestServer/RequestClientEndpoint.h ../../Services/RequestServer/RequestClientEndpoint.h
../../Services/RequestServer/RequestServerEndpoint.h ../../Services/RequestServer/RequestServerEndpoint.h
../../Services/WebContent/WebContentClientEndpoint.h
../../Services/WebContent/WebContentServerEndpoint.h
) )
generate_css_implementation() generate_css_implementation()

View file

@ -3,4 +3,4 @@ set(SOURCES
) )
serenity_bin(DumpLayoutTree) serenity_bin(DumpLayoutTree)
target_link_libraries(DumpLayoutTree LibWeb) target_link_libraries(DumpLayoutTree LibWebView LibWeb)

View file

@ -6,7 +6,7 @@
#include <LibGUI/Application.h> #include <LibGUI/Application.h>
#include <LibGUI/Window.h> #include <LibGUI/Window.h>
#include <LibWeb/OutOfProcessWebView.h> #include <LibWebView/OutOfProcessWebView.h>
#include <unistd.h> #include <unistd.h>
int main(int argc, char** argv) int main(int argc, char** argv)
@ -16,7 +16,7 @@ int main(int argc, char** argv)
window->set_title("DumpLayoutTree"); window->set_title("DumpLayoutTree");
window->resize(800, 600); window->resize(800, 600);
window->show(); window->show();
auto& web_view = window->set_main_widget<Web::OutOfProcessWebView>(); auto& web_view = window->set_main_widget<WebView::OutOfProcessWebView>();
web_view.load(URL::create_with_file_protocol(argv[1])); web_view.load(URL::create_with_file_protocol(argv[1]));
web_view.on_load_finish = [&](auto&) { web_view.on_load_finish = [&](auto&) {
auto dump = web_view.dump_layout_tree(); auto dump = web_view.dump_layout_tree();

View file

@ -370,7 +370,6 @@ class EventHandler;
class FrameLoader; class FrameLoader;
class LoadRequest; class LoadRequest;
class Origin; class Origin;
class OutOfProcessWebView;
class Page; class Page;
class PageClient; class PageClient;
class PaintContext; class PaintContext;

View file

@ -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)

View file

@ -0,0 +1,13 @@
/*
* Copyright (c) 2022, The SerenityOS developers
*
* SPDX-License-Identifier: BSD-2-Clause
*/
#pragma once
namespace WebView {
class OutOfProcessWebView;
}

View file

@ -18,9 +18,9 @@
#include <LibGfx/Palette.h> #include <LibGfx/Palette.h>
#include <LibGfx/SystemTheme.h> #include <LibGfx/SystemTheme.h>
REGISTER_WIDGET(Web, OutOfProcessWebView) REGISTER_WIDGET(WebView, OutOfProcessWebView)
namespace Web { namespace WebView {
OutOfProcessWebView::OutOfProcessWebView() OutOfProcessWebView::OutOfProcessWebView()
{ {
@ -376,14 +376,14 @@ void OutOfProcessWebView::notify_server_did_change_favicon(Gfx::Bitmap const& fa
on_favicon_change(favicon); on_favicon_change(favicon);
} }
String OutOfProcessWebView::notify_server_did_request_cookie(Badge<WebContentClient>, const AK::URL& url, Cookie::Source source) String OutOfProcessWebView::notify_server_did_request_cookie(Badge<WebContentClient>, const AK::URL& url, Web::Cookie::Source source)
{ {
if (on_get_cookie) if (on_get_cookie)
return on_get_cookie(url, source); return on_get_cookie(url, source);
return {}; return {};
} }
void OutOfProcessWebView::notify_server_did_set_cookie(Badge<WebContentClient>, const AK::URL& url, Cookie::ParsedCookie const& cookie, Cookie::Source source) void OutOfProcessWebView::notify_server_did_set_cookie(Badge<WebContentClient>, const AK::URL& url, Web::Cookie::ParsedCookie const& cookie, Web::Cookie::Source source)
{ {
if (on_set_cookie) if (on_set_cookie)
on_set_cookie(url, cookie, source); on_set_cookie(url, cookie, source);
@ -437,7 +437,7 @@ void OutOfProcessWebView::inspect_dom_tree()
client().async_inspect_dom_tree(); client().async_inspect_dom_tree();
} }
Optional<OutOfProcessWebView::DOMNodeProperties> OutOfProcessWebView::inspect_dom_node(i32 node_id, Optional<CSS::Selector::PseudoElement> pseudo_element) Optional<OutOfProcessWebView::DOMNodeProperties> OutOfProcessWebView::inspect_dom_node(i32 node_id, Optional<Web::CSS::Selector::PseudoElement> pseudo_element)
{ {
auto response = client().inspect_dom_node(node_id, pseudo_element); auto response = client().inspect_dom_node(node_id, pseudo_element);
if (!response.has_style()) if (!response.has_style())

View file

@ -12,7 +12,7 @@
#include <LibWeb/CSS/Selector.h> #include <LibWeb/CSS/Selector.h>
#include <LibWeb/Page/Page.h> #include <LibWeb/Page/Page.h>
namespace Web { namespace WebView {
class WebContentClient; class WebContentClient;
@ -38,7 +38,7 @@ public:
String custom_properties_json; String custom_properties_json;
String node_box_sizing_json; String node_box_sizing_json;
}; };
Optional<DOMNodeProperties> inspect_dom_node(i32 node_id, Optional<CSS::Selector::PseudoElement>); Optional<DOMNodeProperties> inspect_dom_node(i32 node_id, Optional<Web::CSS::Selector::PseudoElement>);
void clear_inspected_dom_node(); void clear_inspected_dom_node();
i32 get_hovered_node_id(); i32 get_hovered_node_id();
@ -69,14 +69,14 @@ public:
Function<void(const AK::URL&)> on_load_finish; Function<void(const AK::URL&)> on_load_finish;
Function<void(Gfx::Bitmap const&)> on_favicon_change; Function<void(Gfx::Bitmap const&)> on_favicon_change;
Function<void(const AK::URL&)> on_url_drop; Function<void(const AK::URL&)> on_url_drop;
Function<void(DOM::Document*)> on_set_document; Function<void(Web::DOM::Document*)> on_set_document;
Function<void(const AK::URL&, String const&)> on_get_source; Function<void(const AK::URL&, String const&)> on_get_source;
Function<void(String const&)> on_get_dom_tree; Function<void(String const&)> on_get_dom_tree;
Function<void(i32 node_id, String const& specified_style, String const& computed_style, String const& custom_properties, String const& node_box_sizing)> on_get_dom_node_properties; Function<void(i32 node_id, String const& specified_style, String const& computed_style, String const& custom_properties, String const& node_box_sizing)> on_get_dom_node_properties;
Function<void(i32 message_id)> on_js_console_new_message; Function<void(i32 message_id)> on_js_console_new_message;
Function<void(i32 start_index, Vector<String> const& message_types, Vector<String> const& messages)> on_get_js_console_messages; Function<void(i32 start_index, Vector<String> const& message_types, Vector<String> const& messages)> on_get_js_console_messages;
Function<String(const AK::URL& url, Cookie::Source source)> on_get_cookie; Function<String(const AK::URL& url, Web::Cookie::Source source)> on_get_cookie;
Function<void(const AK::URL& url, Cookie::ParsedCookie const& cookie, Cookie::Source source)> on_set_cookie; Function<void(const AK::URL& url, Web::Cookie::ParsedCookie const& cookie, Web::Cookie::Source source)> on_set_cookie;
Function<void(i32 count_waiting)> on_resource_status_change; Function<void(i32 count_waiting)> on_resource_status_change;
void notify_server_did_layout(Badge<WebContentClient>, Gfx::IntSize const& content_size); void notify_server_did_layout(Badge<WebContentClient>, 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_output_js_console_message(i32 message_index);
void notify_server_did_get_js_console_messages(i32 start_index, Vector<String> const& message_types, Vector<String> const& messages); void notify_server_did_get_js_console_messages(i32 start_index, Vector<String> const& message_types, Vector<String> const& messages);
void notify_server_did_change_favicon(Gfx::Bitmap const& favicon); void notify_server_did_change_favicon(Gfx::Bitmap const& favicon);
String notify_server_did_request_cookie(Badge<WebContentClient>, const AK::URL& url, Cookie::Source source); String notify_server_did_request_cookie(Badge<WebContentClient>, const AK::URL& url, Web::Cookie::Source source);
void notify_server_did_set_cookie(Badge<WebContentClient>, const AK::URL& url, Cookie::ParsedCookie const& cookie, Cookie::Source source); void notify_server_did_set_cookie(Badge<WebContentClient>, const AK::URL& url, Web::Cookie::ParsedCookie const& cookie, Web::Cookie::Source source);
void notify_server_did_update_resource_count(i32 count_waiting); void notify_server_did_update_resource_count(i32 count_waiting);
private: private:

View file

@ -9,7 +9,7 @@
#include <AK/Debug.h> #include <AK/Debug.h>
#include <LibWeb/Cookie/ParsedCookie.h> #include <LibWeb/Cookie/ParsedCookie.h>
namespace Web { namespace WebView {
WebContentClient::WebContentClient(NonnullOwnPtr<Core::Stream::LocalSocket> socket, OutOfProcessWebView& view) WebContentClient::WebContentClient(NonnullOwnPtr<Core::Stream::LocalSocket> socket, OutOfProcessWebView& view)
: IPC::ConnectionToServer<WebContentClientEndpoint, WebContentServerEndpoint>(*this, move(socket)) : IPC::ConnectionToServer<WebContentClientEndpoint, WebContentServerEndpoint>(*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) Messages::WebContentClient::DidRequestCookieResponse WebContentClient::did_request_cookie(AK::URL const& url, u8 source)
{ {
return m_view.notify_server_did_request_cookie({}, url, static_cast<Cookie::Source>(source)); return m_view.notify_server_did_request_cookie({}, url, static_cast<Web::Cookie::Source>(source));
} }
void WebContentClient::did_set_cookie(AK::URL const& url, Web::Cookie::ParsedCookie const& cookie, u8 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<Cookie::Source>(source)); m_view.notify_server_did_set_cookie({}, url, cookie, static_cast<Web::Cookie::Source>(source));
} }
void WebContentClient::did_update_resource_count(i32 count_waiting) void WebContentClient::did_update_resource_count(i32 count_waiting)

View file

@ -12,7 +12,7 @@
#include <WebContent/WebContentClientEndpoint.h> #include <WebContent/WebContentClientEndpoint.h>
#include <WebContent/WebContentServerEndpoint.h> #include <WebContent/WebContentServerEndpoint.h>
namespace Web { namespace WebView {
class OutOfProcessWebView; class OutOfProcessWebView;

View file

@ -17,5 +17,5 @@ set(SOURCES
) )
serenity_bin(WebContent) 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) link_with_unicode_data(WebContent)