1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-25 03:17: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

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

View file

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

View file

@ -3,4 +3,4 @@ set(SOURCES
)
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/Window.h>
#include <LibWeb/OutOfProcessWebView.h>
#include <LibWebView/OutOfProcessWebView.h>
#include <unistd.h>
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<Web::OutOfProcessWebView>();
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();

View file

@ -370,7 +370,6 @@ class EventHandler;
class FrameLoader;
class LoadRequest;
class Origin;
class OutOfProcessWebView;
class Page;
class PageClient;
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/SystemTheme.h>
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<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)
return on_get_cookie(url, source);
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)
on_set_cookie(url, cookie, source);
@ -437,7 +437,7 @@ void OutOfProcessWebView::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);
if (!response.has_style())

View file

@ -12,7 +12,7 @@
#include <LibWeb/CSS/Selector.h>
#include <LibWeb/Page/Page.h>
namespace Web {
namespace WebView {
class WebContentClient;
@ -38,7 +38,7 @@ public:
String custom_properties_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();
i32 get_hovered_node_id();
@ -69,14 +69,14 @@ public:
Function<void(const AK::URL&)> on_load_finish;
Function<void(Gfx::Bitmap const&)> on_favicon_change;
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(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 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<String(const AK::URL& url, Cookie::Source source)> on_get_cookie;
Function<void(const AK::URL& url, Cookie::ParsedCookie const& cookie, Cookie::Source source)> on_set_cookie;
Function<String(const AK::URL& url, Web::Cookie::Source source)> on_get_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;
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_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);
String notify_server_did_request_cookie(Badge<WebContentClient>, const AK::URL& url, Cookie::Source source);
void notify_server_did_set_cookie(Badge<WebContentClient>, const AK::URL& url, Cookie::ParsedCookie const& cookie, 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, Web::Cookie::ParsedCookie const& cookie, Web::Cookie::Source source);
void notify_server_did_update_resource_count(i32 count_waiting);
private:

View file

@ -9,7 +9,7 @@
#include <AK/Debug.h>
#include <LibWeb/Cookie/ParsedCookie.h>
namespace Web {
namespace WebView {
WebContentClient::WebContentClient(NonnullOwnPtr<Core::Stream::LocalSocket> socket, OutOfProcessWebView& view)
: 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)
{
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)
{
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)

View file

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