LibWebView+Services+UI: Move the Web plugins to LibWebView

This commit is contained in:
Timothy Flynn 2024-11-10 09:53:15 -05:00 committed by Tim Flynn
parent 9e1f001ffe
commit a14937c45e
Notes: github-actions[bot] 2024-11-11 12:36:47 +00:00
9 changed files with 22 additions and 34 deletions

View file

@ -1,4 +1,5 @@
include(${SerenityOS_SOURCE_DIR}/Meta/CMake/public_suffix.cmake)
include(fontconfig)
include(public_suffix)
set(SOURCES
Application.cpp
@ -7,8 +8,10 @@ set(SOURCES
CookieJar.cpp
Database.cpp
InspectorClient.cpp
ProcessHandle.cpp
Plugins/FontPlugin.cpp
Plugins/ImageCodecPlugin.cpp
Process.cpp
ProcessHandle.cpp
ProcessManager.cpp
SearchEngine.cpp
SourceHighlighter.cpp
@ -73,6 +76,10 @@ elseif (APPLE)
target_link_libraries(LibWebView PRIVATE "-framework Cocoa")
endif()
if (HAS_FONTCONFIG)
target_link_libraries(LibWebView PRIVATE Fontconfig::Fontconfig)
endif()
if (ENABLE_INSTALL_HEADERS)
foreach(header ${GENERATED_SOURCES})
get_filename_component(extension ${header} EXT)

View file

@ -12,13 +12,13 @@
#include <LibCore/StandardPaths.h>
#include <LibGfx/Font/FontDatabase.h>
#include <LibGfx/Font/PathFontProvider.h>
#include <UI/FontPlugin.h>
#include <LibWebView/Plugins/FontPlugin.h>
#ifdef USE_FONTCONFIG
# include <fontconfig/fontconfig.h>
#endif
namespace Ladybird {
namespace WebView {
FontPlugin::FontPlugin(bool is_layout_test_mode, Gfx::SystemFontProvider* font_provider)
: m_is_layout_test_mode(is_layout_test_mode)

View file

@ -11,7 +11,7 @@
#include <LibGfx/Font/FontDatabase.h>
#include <LibWeb/Platform/FontPlugin.h>
namespace Ladybird {
namespace WebView {
class FontPlugin final : public Web::Platform::FontPlugin {
public:

View file

@ -8,10 +8,10 @@
#include <LibGfx/Bitmap.h>
#include <LibGfx/ImageFormats/ImageDecoder.h>
#include <LibImageDecoderClient/Client.h>
#include <UI/ImageCodecPlugin.h>
#include <LibWebView/Plugins/ImageCodecPlugin.h>
#include <UI/Utilities.h>
namespace Ladybird {
namespace WebView {
ImageCodecPlugin::ImageCodecPlugin(NonnullRefPtr<ImageDecoderClient::Client> client)
: m_client(move(client))

View file

@ -10,7 +10,7 @@
#include <LibImageDecoderClient/Client.h>
#include <LibWeb/Platform/ImageCodecPlugin.h>
namespace Ladybird {
namespace WebView {
class ImageCodecPlugin final : public Web::Platform::ImageCodecPlugin {
public:

View file

@ -1,10 +1,7 @@
include(fontconfig)
include(pulseaudio)
set(SOURCES
${LADYBIRD_SOURCE_DIR}/UI/FontPlugin.cpp
${LADYBIRD_SOURCE_DIR}/UI/HelperProcess.cpp
${LADYBIRD_SOURCE_DIR}/UI/ImageCodecPlugin.cpp
${LADYBIRD_SOURCE_DIR}/UI/Utilities.cpp
ConnectionFromClient.cpp
ConsoleGlobalEnvironmentExtensions.cpp
@ -35,10 +32,6 @@ target_include_directories(webcontentservice PUBLIC $<BUILD_INTERFACE:${LADYBIRD
target_link_libraries(webcontentservice PUBLIC LibCore LibFileSystem LibGfx LibIPC LibJS LibMain LibMedia LibWeb LibWebSocket LibRequests LibWebView LibImageDecoderClient)
if (HAS_FONTCONFIG)
target_link_libraries(webcontentservice PRIVATE Fontconfig::Fontconfig)
endif()
if (ENABLE_QT)
qt_add_executable(WebContent main.cpp)
target_link_libraries(WebContent PRIVATE Qt::Core)
@ -61,11 +54,6 @@ endif()
target_link_libraries(WebContent PRIVATE webcontentservice LibURL)
target_sources(webcontentservice PUBLIC FILE_SET ladybird TYPE HEADERS
BASE_DIRS ${LADYBIRD_SOURCE_DIR}
FILES ${LADYBIRD_SOURCE_DIR}/UI/FontPlugin.h
${LADYBIRD_SOURCE_DIR}/UI/ImageCodecPlugin.h
)
target_sources(webcontentservice PUBLIC FILE_SET server TYPE HEADERS
BASE_DIRS ${LADYBIRD_SOURCE_DIR}/Services
FILES ConnectionFromClient.h

View file

@ -26,8 +26,8 @@
#include <LibWeb/PermissionsPolicy/AutoplayAllowlist.h>
#include <LibWeb/Platform/AudioCodecPluginAgnostic.h>
#include <LibWeb/Platform/EventLoopPluginSerenity.h>
#include <UI/FontPlugin.h>
#include <UI/ImageCodecPlugin.h>
#include <LibWebView/Plugins/FontPlugin.h>
#include <LibWebView/Plugins/ImageCodecPlugin.h>
#include <UI/Utilities.h>
#include <WebContent/ConnectionFromClient.h>
#include <WebContent/PageClient.h>
@ -169,7 +169,7 @@ ErrorOr<int> serenity_main(Main::Arguments arguments)
Web::HTML::Window::set_internals_object_exposed(expose_internals_object);
Web::Platform::FontPlugin::install(*new Ladybird::FontPlugin(is_layout_test_mode, &font_provider));
Web::Platform::FontPlugin::install(*new WebView::FontPlugin(is_layout_test_mode, &font_provider));
TRY(Web::Bindings::initialize_main_thread_vm(Web::HTML::EventLoop::Type::Window));
@ -277,7 +277,7 @@ ErrorOr<void> initialize_image_decoder(int image_decoder_socket)
auto new_client = TRY(try_make_ref_counted<ImageDecoderClient::Client>(IPC::Transport(move(socket))));
Web::Platform::ImageCodecPlugin::install(*new Ladybird::ImageCodecPlugin(move(new_client)));
Web::Platform::ImageCodecPlugin::install(*new WebView::ImageCodecPlugin(move(new_client)));
return {};
}
@ -291,7 +291,7 @@ ErrorOr<void> reinitialize_image_decoder(IPC::File const& image_decoder_socket)
auto new_client = TRY(try_make_ref_counted<ImageDecoderClient::Client>(IPC::Transport(move(socket))));
static_cast<Ladybird::ImageCodecPlugin&>(Web::Platform::ImageCodecPlugin::the()).set_client(move(new_client));
static_cast<WebView::ImageCodecPlugin&>(Web::Platform::ImageCodecPlugin::the()).set_client(move(new_client));
return {};
}

View file

@ -1,7 +1,4 @@
include(fontconfig)
set(WEBWORKER_SOURCES
${LADYBIRD_SOURCE_DIR}/UI/FontPlugin.cpp
${LADYBIRD_SOURCE_DIR}/UI/HelperProcess.cpp
${LADYBIRD_SOURCE_DIR}/UI/Utilities.cpp
ConnectionFromClient.cpp
@ -20,10 +17,6 @@ target_include_directories(webworkerservice PRIVATE ${LADYBIRD_SOURCE_DIR}/Servi
target_link_libraries(webworkerservice PUBLIC LibCore LibFileSystem LibGfx LibIPC LibJS LibRequests LibWeb LibWebView LibUnicode LibImageDecoderClient LibMain LibURL)
if (HAS_FONTCONFIG)
target_link_libraries(webworkerservice PRIVATE Fontconfig::Fontconfig)
endif()
if (ENABLE_QT)
qt_add_executable(WebWorker main.cpp)
target_link_libraries(WebWorker PRIVATE webworkerservice LibWebSocket)

View file

@ -19,7 +19,7 @@
#include <LibWeb/Platform/EventLoopPlugin.h>
#include <LibWeb/Platform/EventLoopPluginSerenity.h>
#include <LibWeb/WebSockets/WebSocket.h>
#include <UI/FontPlugin.h>
#include <LibWebView/Plugins/FontPlugin.h>
#include <UI/HelperProcess.h>
#include <UI/Utilities.h>
#include <WebWorker/ConnectionFromClient.h>
@ -60,7 +60,7 @@ ErrorOr<int> serenity_main(Main::Arguments arguments)
Web::Platform::EventLoopPlugin::install(*new Web::Platform::EventLoopPluginSerenity);
Web::Platform::FontPlugin::install(*new Ladybird::FontPlugin(false));
Web::Platform::FontPlugin::install(*new WebView::FontPlugin(false));
TRY(Web::Bindings::initialize_main_thread_vm(Web::HTML::EventLoop::Type::Worker));