summaryrefslogtreecommitdiff
path: root/Userland
diff options
context:
space:
mode:
authorSam Atkins <atkinssj@serenityos.org>2022-09-21 19:33:57 +0100
committerLinus Groh <mail@linusgroh.de>2022-09-21 20:42:36 +0100
commit6b2a916069a0df08856c6d9fa66c6bf5d0244df0 (patch)
tree0785afae53930cffeb33fd76b361eede441d5653 /Userland
parent69dd158f91480551a4b7e1205c3fab77c507fc1a (diff)
downloadserenity-6b2a916069a0df08856c6d9fa66c6bf5d0244df0.zip
LibWeb+WebContent: Move Serenity EventLoop and Font plugins into LibWeb
These are exactly what's wanted by headless-browser too, so this saves us some duplication. LibWeb already links LibCore so it should not cause any issues for Ladybird.
Diffstat (limited to 'Userland')
-rw-r--r--Userland/Libraries/LibWeb/CMakeLists.txt3
-rw-r--r--Userland/Libraries/LibWeb/Platform/EventLoopPluginSerenity.cpp (renamed from Userland/Services/WebContent/EventLoopPluginSerenity.cpp)6
-rw-r--r--Userland/Libraries/LibWeb/Platform/EventLoopPluginSerenity.h (renamed from Userland/Services/WebContent/EventLoopPluginSerenity.h)4
-rw-r--r--Userland/Libraries/LibWeb/Platform/FontPluginSerenity.cpp (renamed from Userland/Services/WebContent/FontPluginSerenity.cpp)24
-rw-r--r--Userland/Libraries/LibWeb/Platform/FontPluginSerenity.h (renamed from Userland/Services/WebContent/FontPluginSerenity.h)6
-rw-r--r--Userland/Libraries/LibWeb/Platform/TimerSerenity.cpp (renamed from Userland/Services/WebContent/TimerSerenity.cpp)2
-rw-r--r--Userland/Libraries/LibWeb/Platform/TimerSerenity.h (renamed from Userland/Services/WebContent/TimerSerenity.h)4
-rw-r--r--Userland/Services/WebContent/CMakeLists.txt3
-rw-r--r--Userland/Services/WebContent/main.cpp8
9 files changed, 30 insertions, 30 deletions
diff --git a/Userland/Libraries/LibWeb/CMakeLists.txt b/Userland/Libraries/LibWeb/CMakeLists.txt
index a3de5c4cb4..7312fe898f 100644
--- a/Userland/Libraries/LibWeb/CMakeLists.txt
+++ b/Userland/Libraries/LibWeb/CMakeLists.txt
@@ -356,9 +356,12 @@ set(SOURCES
Painting/StackingContext.cpp
Painting/TextPaintable.cpp
Platform/EventLoopPlugin.cpp
+ Platform/EventLoopPluginSerenity.cpp
Platform/FontPlugin.cpp
+ Platform/FontPluginSerenity.cpp
Platform/ImageCodecPlugin.cpp
Platform/Timer.cpp
+ Platform/TimerSerenity.cpp
RequestIdleCallback/IdleDeadline.cpp
ResizeObserver/ResizeObserver.cpp
SVG/AttributeNames.cpp
diff --git a/Userland/Services/WebContent/EventLoopPluginSerenity.cpp b/Userland/Libraries/LibWeb/Platform/EventLoopPluginSerenity.cpp
index 15a6c17dd1..db035a1778 100644
--- a/Userland/Services/WebContent/EventLoopPluginSerenity.cpp
+++ b/Userland/Libraries/LibWeb/Platform/EventLoopPluginSerenity.cpp
@@ -5,12 +5,12 @@
*/
#include "EventLoopPluginSerenity.h"
-#include "TimerSerenity.h"
#include <AK/Function.h>
#include <AK/NonnullRefPtr.h>
#include <LibCore/EventLoop.h>
+#include <LibWeb/Platform/TimerSerenity.h>
-namespace WebContent {
+namespace Web::Platform {
EventLoopPluginSerenity::EventLoopPluginSerenity() = default;
EventLoopPluginSerenity::~EventLoopPluginSerenity() = default;
@@ -26,7 +26,7 @@ void EventLoopPluginSerenity::deferred_invoke(Function<void()> function)
Core::deferred_invoke(move(function));
}
-NonnullRefPtr<Web::Platform::Timer> EventLoopPluginSerenity::create_timer()
+NonnullRefPtr<Timer> EventLoopPluginSerenity::create_timer()
{
return TimerSerenity::create();
}
diff --git a/Userland/Services/WebContent/EventLoopPluginSerenity.h b/Userland/Libraries/LibWeb/Platform/EventLoopPluginSerenity.h
index 0493ac7ab1..9e04e64112 100644
--- a/Userland/Services/WebContent/EventLoopPluginSerenity.h
+++ b/Userland/Libraries/LibWeb/Platform/EventLoopPluginSerenity.h
@@ -8,7 +8,7 @@
#include <LibWeb/Platform/EventLoopPlugin.h>
-namespace WebContent {
+namespace Web::Platform {
class EventLoopPluginSerenity final : public Web::Platform::EventLoopPlugin {
public:
@@ -17,7 +17,7 @@ public:
virtual void spin_until(Function<bool()> goal_condition) override;
virtual void deferred_invoke(Function<void()>) override;
- virtual NonnullRefPtr<Web::Platform::Timer> create_timer() override;
+ virtual NonnullRefPtr<Timer> create_timer() override;
};
}
diff --git a/Userland/Services/WebContent/FontPluginSerenity.cpp b/Userland/Libraries/LibWeb/Platform/FontPluginSerenity.cpp
index b9377b8843..4d588f47d3 100644
--- a/Userland/Services/WebContent/FontPluginSerenity.cpp
+++ b/Userland/Libraries/LibWeb/Platform/FontPluginSerenity.cpp
@@ -8,7 +8,7 @@
#include <AK/String.h>
#include <LibGfx/Font/FontDatabase.h>
-namespace WebContent {
+namespace Web::Platform {
FontPluginSerenity::FontPluginSerenity()
{
@@ -26,26 +26,26 @@ Gfx::Font& FontPluginSerenity::default_fixed_width_font()
return Gfx::FontDatabase::default_fixed_width_font();
}
-String FontPluginSerenity::generic_font_name(Web::Platform::GenericFont generic_font)
+String FontPluginSerenity::generic_font_name(GenericFont generic_font)
{
// FIXME: Replace hard-coded font names with a relevant call to FontDatabase.
// Currently, we cannot request the default font's name, or request it at a specific size and weight.
// So, hard-coded font names it is.
switch (generic_font) {
- case Web::Platform::GenericFont::SansSerif:
- case Web::Platform::GenericFont::UiSansSerif:
- case Web::Platform::GenericFont::Cursive:
- case Web::Platform::GenericFont::UiRounded:
+ case GenericFont::SansSerif:
+ case GenericFont::UiSansSerif:
+ case GenericFont::Cursive:
+ case GenericFont::UiRounded:
return "Katica";
- case Web::Platform::GenericFont::Monospace:
- case Web::Platform::GenericFont::UiMonospace:
+ case GenericFont::Monospace:
+ case GenericFont::UiMonospace:
return "Csilla";
- case Web::Platform::GenericFont::Serif:
- case Web::Platform::GenericFont::UiSerif:
+ case GenericFont::Serif:
+ case GenericFont::UiSerif:
return "Roman";
- case Web::Platform::GenericFont::Fantasy:
+ case GenericFont::Fantasy:
return "Comic Book";
- case Web::Platform::GenericFont::__Count:
+ case GenericFont::__Count:
VERIFY_NOT_REACHED();
}
VERIFY_NOT_REACHED();
diff --git a/Userland/Services/WebContent/FontPluginSerenity.h b/Userland/Libraries/LibWeb/Platform/FontPluginSerenity.h
index 371b0833a6..9ea8c0a1be 100644
--- a/Userland/Services/WebContent/FontPluginSerenity.h
+++ b/Userland/Libraries/LibWeb/Platform/FontPluginSerenity.h
@@ -9,16 +9,16 @@
#include <AK/Vector.h>
#include <LibWeb/Platform/FontPlugin.h>
-namespace WebContent {
+namespace Web::Platform {
-class FontPluginSerenity final : public Web::Platform::FontPlugin {
+class FontPluginSerenity final : public FontPlugin {
public:
FontPluginSerenity();
virtual ~FontPluginSerenity();
virtual Gfx::Font& default_font() override;
virtual Gfx::Font& default_fixed_width_font() override;
- virtual String generic_font_name(Web::Platform::GenericFont) override;
+ virtual String generic_font_name(GenericFont) override;
};
}
diff --git a/Userland/Services/WebContent/TimerSerenity.cpp b/Userland/Libraries/LibWeb/Platform/TimerSerenity.cpp
index a702ba2eca..cef22b8768 100644
--- a/Userland/Services/WebContent/TimerSerenity.cpp
+++ b/Userland/Libraries/LibWeb/Platform/TimerSerenity.cpp
@@ -8,7 +8,7 @@
#include <AK/NonnullRefPtr.h>
#include <LibCore/Timer.h>
-namespace WebContent {
+namespace Web::Platform {
NonnullRefPtr<TimerSerenity> TimerSerenity::create()
{
diff --git a/Userland/Services/WebContent/TimerSerenity.h b/Userland/Libraries/LibWeb/Platform/TimerSerenity.h
index d0f9200839..4f368c8a5d 100644
--- a/Userland/Services/WebContent/TimerSerenity.h
+++ b/Userland/Libraries/LibWeb/Platform/TimerSerenity.h
@@ -10,9 +10,9 @@
#include <LibCore/Forward.h>
#include <LibWeb/Platform/Timer.h>
-namespace WebContent {
+namespace Web::Platform {
-class TimerSerenity final : public Web::Platform::Timer {
+class TimerSerenity final : public Timer {
public:
static NonnullRefPtr<TimerSerenity> create();
diff --git a/Userland/Services/WebContent/CMakeLists.txt b/Userland/Services/WebContent/CMakeLists.txt
index ca7b7395a8..e4643e70c4 100644
--- a/Userland/Services/WebContent/CMakeLists.txt
+++ b/Userland/Services/WebContent/CMakeLists.txt
@@ -10,11 +10,8 @@ compile_ipc(WebContentClient.ipc WebContentClientEndpoint.h)
set(SOURCES
ConnectionFromClient.cpp
ConsoleGlobalObject.cpp
- EventLoopPluginSerenity.cpp
- FontPluginSerenity.cpp
ImageCodecPluginSerenity.cpp
PageHost.cpp
- TimerSerenity.cpp
WebContentClientEndpoint.h
WebContentConsoleClient.cpp
WebContentServerEndpoint.h
diff --git a/Userland/Services/WebContent/main.cpp b/Userland/Services/WebContent/main.cpp
index ce7c2c5266..ea5c757617 100644
--- a/Userland/Services/WebContent/main.cpp
+++ b/Userland/Services/WebContent/main.cpp
@@ -4,8 +4,6 @@
* SPDX-License-Identifier: BSD-2-Clause
*/
-#include "EventLoopPluginSerenity.h"
-#include "FontPluginSerenity.h"
#include "ImageCodecPluginSerenity.h"
#include <LibCore/EventLoop.h>
#include <LibCore/LocalServer.h>
@@ -14,6 +12,8 @@
#include <LibMain/Main.h>
#include <LibWeb/Loader/ResourceLoader.h>
#include <LibWeb/Platform/EventLoopPlugin.h>
+#include <LibWeb/Platform/EventLoopPluginSerenity.h>
+#include <LibWeb/Platform/FontPluginSerenity.h>
#include <LibWeb/WebSockets/WebSocket.h>
#include <LibWebView/RequestServerAdapter.h>
#include <LibWebView/WebSocketClientAdapter.h>
@@ -30,9 +30,9 @@ ErrorOr<int> serenity_main(Main::Arguments)
TRY(Core::System::unveil("/tmp/user/%uid/portal/websocket", "rw"));
TRY(Core::System::unveil(nullptr, nullptr));
- Web::Platform::EventLoopPlugin::install(*new WebContent::EventLoopPluginSerenity);
+ Web::Platform::EventLoopPlugin::install(*new Web::Platform::EventLoopPluginSerenity);
Web::Platform::ImageCodecPlugin::install(*new WebContent::ImageCodecPluginSerenity);
- Web::Platform::FontPlugin::install(*new WebContent::FontPluginSerenity);
+ Web::Platform::FontPlugin::install(*new Web::Platform::FontPluginSerenity);
Web::WebSockets::WebSocketClientManager::initialize(TRY(WebView::WebSocketClientManagerAdapter::try_create()));
Web::ResourceLoader::initialize(TRY(WebView::RequestServerAdapter::try_create()));