1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-25 13:27:35 +00:00

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
41 changed files with 97 additions and 73 deletions

View file

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

View file

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

View file

@ -24,7 +24,7 @@ ConsoleWidget::ConsoleWidget()
set_layout<GUI::VerticalBoxLayout>();
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>");
// 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&) {

View file

@ -11,7 +11,7 @@
#include "History.h"
#include <LibGUI/Widget.h>
#include <LibWeb/OutOfProcessWebView.h>
#include <LibWebView/OutOfProcessWebView.h>
namespace Browser {
@ -38,7 +38,7 @@ private:
void end_group();
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_received_message_index { -1 };

View file

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

View file

@ -13,6 +13,7 @@
#include <LibWeb/CSS/Selector.h>
#include <LibWeb/Forward.h>
#include <LibWeb/Layout/BoxModelMetrics.h>
#include <LibWebView/Forward.h>
namespace Browser {
@ -38,7 +39,7 @@ public:
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 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<String> node_box_sizing_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::TableView> m_computed_style_table_view;

View file

@ -36,7 +36,7 @@
#include <LibWeb/Layout/BlockContainer.h>
#include <LibWeb/Layout/InitialContainingBlock.h>
#include <LibWeb/Loader/ResourceLoader.h>
#include <LibWeb/OutOfProcessWebView.h>
#include <LibWebView/OutOfProcessWebView.h>
namespace Browser {
@ -112,7 +112,7 @@ Tab::Tab(BrowserWindow& window)
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)
m_web_content_view->set_content_filters(g_content_filters);
else

View file

@ -16,7 +16,7 @@
#include <LibHTTP/Job.h>
#include <LibWeb/Forward.h>
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<Web::OutOfProcessWebView> m_web_content_view;
RefPtr<WebView::OutOfProcessWebView> m_web_content_view;
RefPtr<GUI::UrlBox> m_location_box;
RefPtr<GUI::Button> m_bookmark_button;

View file

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

View file

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

View file

@ -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::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) {
if (url.protocol() == "file") {
auto path = url.path();

View file

@ -9,7 +9,7 @@
#include "History.h"
#include "ManualModel.h"
#include <LibGUI/FilteringProxyModel.h>
#include <LibWeb/OutOfProcessWebView.h>
#include <LibWebView/OutOfProcessWebView.h>
namespace Help {
@ -45,7 +45,7 @@ private:
RefPtr<GUI::TextBox> m_search_box;
RefPtr<GUI::ListView> m_search_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::Statusbar> m_statusbar;

View file

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

View file

@ -28,7 +28,7 @@ MailWidget::MailWidget()
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_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_mailbox_list->on_selection_change = [this] {

View file

@ -13,7 +13,7 @@
#include <LibGUI/Widget.h>
#include <LibGfx/ShareableBitmap.h>
#include <LibIMAP/Client.h>
#include <LibWeb/OutOfProcessWebView.h>
#include <LibWebView/OutOfProcessWebView.h>
class MailWidget final : public GUI::Widget {
C_OBJECT(MailWidget)
@ -43,7 +43,7 @@ private:
RefPtr<GUI::TreeView> m_mailbox_list;
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::Menu> m_link_context_menu;

View file

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

View file

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

View file

@ -16,7 +16,7 @@
#include <LibGUI/Splitter.h>
#include <LibMarkdown/Document.h>
#include <LibWeb/Layout/Node.h>
#include <LibWeb/OutOfProcessWebView.h>
#include <LibWebView/OutOfProcessWebView.h>
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<Web::OutOfProcessWebView>();
m_webview = splitter.add<WebView::OutOfProcessWebView>();
m_webview->on_link_click = [this](auto& url, auto&, auto&&) {
VERIFY(url.protocol() == "spreadsheet");
if (url.host() == "example") {

View file

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

View file

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

View file

@ -41,7 +41,7 @@
#include <LibSQL/AST/SyntaxHighlighter.h>
#include <LibWeb/CSS/SyntaxHighlighter/SyntaxHighlighter.h>
#include <LibWeb/HTML/SyntaxHighlighter/SyntaxHighlighter.h>
#include <LibWeb/OutOfProcessWebView.h>
#include <LibWebView/OutOfProcessWebView.h>
#include <Shell/SyntaxHighlighter.h>
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<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) {
if (url.is_valid())
m_statusbar->set_text(url.to_string());

View file

@ -16,7 +16,7 @@
#include <LibGUI/TextEditor.h>
#include <LibGUI/Widget.h>
#include <LibGUI/Window.h>
#include <LibWeb/Forward.h>
#include <LibWebView/Forward.h>
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<GUI::Action> m_shell_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_use_regex { false };

View file

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

View file

@ -18,7 +18,7 @@
#include <LibGfx/Font/BitmapFont.h>
#include <LibGfx/Palette.h>
#include <LibMarkdown/Document.h>
#include <LibWeb/OutOfProcessWebView.h>
#include <LibWebView/OutOfProcessWebView.h>
#include <serenity.h>
WelcomeWidget::WelcomeWidget()
@ -32,7 +32,7 @@ WelcomeWidget::WelcomeWidget()
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());
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");

View file

@ -7,7 +7,7 @@
#pragma once
#include <LibGUI/Widget.h>
#include <LibWeb/OutOfProcessWebView.h>
#include <LibWebView/OutOfProcessWebView.h>
class WelcomeWidget final : public GUI::Widget {
C_OBJECT(WelcomeWidget);
@ -30,7 +30,7 @@ private:
RefPtr<GUI::Button> m_new_button;
RefPtr<GUI::Label> m_tip_label;
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 };
Vector<String> m_tips;

View file

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