mirror of
https://github.com/RGBCube/serenity
synced 2025-07-26 04:27:44 +00:00
Ladybird: Move classes and types into the Ladybird namespace
We were super inconsistent about this, with most "new" classes living in the Ladybird namespace, while "old" ones were in the global namespace, or even sitting in the Browser namespace.
This commit is contained in:
parent
73fa58da34
commit
506b03740c
25 changed files with 99 additions and 39 deletions
|
@ -26,7 +26,9 @@
|
||||||
#include <QTabBar>
|
#include <QTabBar>
|
||||||
|
|
||||||
extern DeprecatedString s_serenity_resource_root;
|
extern DeprecatedString s_serenity_resource_root;
|
||||||
extern Browser::Settings* s_settings;
|
|
||||||
|
namespace Ladybird {
|
||||||
|
extern Settings* s_settings;
|
||||||
|
|
||||||
static QIcon const& app_icon()
|
static QIcon const& app_icon()
|
||||||
{
|
{
|
||||||
|
@ -688,3 +690,5 @@ bool BrowserWindow::eventFilter(QObject* obj, QEvent* event)
|
||||||
|
|
||||||
return QMainWindow::eventFilter(obj, event);
|
return QMainWindow::eventFilter(obj, event);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
|
@ -17,12 +17,14 @@
|
||||||
#include <QTabWidget>
|
#include <QTabWidget>
|
||||||
#include <QToolBar>
|
#include <QToolBar>
|
||||||
|
|
||||||
class WebContentView;
|
|
||||||
|
|
||||||
namespace Browser {
|
namespace Browser {
|
||||||
class CookieJar;
|
class CookieJar;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
namespace Ladybird {
|
||||||
|
|
||||||
|
class WebContentView;
|
||||||
|
|
||||||
class BrowserWindow : public QMainWindow {
|
class BrowserWindow : public QMainWindow {
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
public:
|
public:
|
||||||
|
@ -119,3 +121,5 @@ private:
|
||||||
WebView::UseJavaScriptBytecode m_use_javascript_bytecode;
|
WebView::UseJavaScriptBytecode m_use_javascript_bytecode;
|
||||||
UseLagomNetworking m_use_lagom_networking;
|
UseLagomNetworking m_use_lagom_networking;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
}
|
||||||
|
|
|
@ -20,10 +20,10 @@
|
||||||
#include <QTextEdit>
|
#include <QTextEdit>
|
||||||
#include <QVBoxLayout>
|
#include <QVBoxLayout>
|
||||||
|
|
||||||
bool is_using_dark_system_theme(QWidget&);
|
|
||||||
|
|
||||||
namespace Ladybird {
|
namespace Ladybird {
|
||||||
|
|
||||||
|
bool is_using_dark_system_theme(QWidget&);
|
||||||
|
|
||||||
ConsoleWidget::ConsoleWidget()
|
ConsoleWidget::ConsoleWidget()
|
||||||
{
|
{
|
||||||
setLayout(new QVBoxLayout);
|
setLayout(new QVBoxLayout);
|
||||||
|
|
|
@ -16,10 +16,10 @@
|
||||||
#include <QWidget>
|
#include <QWidget>
|
||||||
|
|
||||||
class QLineEdit;
|
class QLineEdit;
|
||||||
class WebContentView;
|
|
||||||
|
|
||||||
namespace Ladybird {
|
namespace Ladybird {
|
||||||
|
|
||||||
|
class WebContentView;
|
||||||
|
|
||||||
class ConsoleWidget final : public QWidget {
|
class ConsoleWidget final : public QWidget {
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
public:
|
public:
|
||||||
|
|
|
@ -11,7 +11,7 @@ ErrorOr<NonnullRefPtr<WebView::WebContentClient>> launch_web_content_process(Web
|
||||||
WebView::EnableCallgrindProfiling enable_callgrind_profiling,
|
WebView::EnableCallgrindProfiling enable_callgrind_profiling,
|
||||||
WebView::IsLayoutTestMode is_layout_test_mode,
|
WebView::IsLayoutTestMode is_layout_test_mode,
|
||||||
WebView::UseJavaScriptBytecode use_javascript_bytecode,
|
WebView::UseJavaScriptBytecode use_javascript_bytecode,
|
||||||
UseLagomNetworking use_lagom_networking)
|
Ladybird::UseLagomNetworking use_lagom_networking)
|
||||||
{
|
{
|
||||||
int socket_fds[2] {};
|
int socket_fds[2] {};
|
||||||
TRY(Core::System::socketpair(AF_LOCAL, SOCK_STREAM, 0, socket_fds));
|
TRY(Core::System::socketpair(AF_LOCAL, SOCK_STREAM, 0, socket_fds));
|
||||||
|
@ -55,7 +55,7 @@ ErrorOr<NonnullRefPtr<WebView::WebContentClient>> launch_web_content_process(Web
|
||||||
arguments.append("--layout-test-mode"sv);
|
arguments.append("--layout-test-mode"sv);
|
||||||
if (use_javascript_bytecode == WebView::UseJavaScriptBytecode::Yes)
|
if (use_javascript_bytecode == WebView::UseJavaScriptBytecode::Yes)
|
||||||
arguments.append("--use-bytecode"sv);
|
arguments.append("--use-bytecode"sv);
|
||||||
if (use_lagom_networking == UseLagomNetworking::Yes)
|
if (use_lagom_networking == Ladybird::UseLagomNetworking::Yes)
|
||||||
arguments.append("--use-lagom-networking"sv);
|
arguments.append("--use-lagom-networking"sv);
|
||||||
|
|
||||||
result = Core::System::exec(arguments[0], arguments.span(), Core::System::SearchInPath::Yes);
|
result = Core::System::exec(arguments[0], arguments.span(), Core::System::SearchInPath::Yes);
|
||||||
|
|
|
@ -19,6 +19,6 @@ ErrorOr<NonnullRefPtr<WebView::WebContentClient>> launch_web_content_process(Web
|
||||||
WebView::EnableCallgrindProfiling,
|
WebView::EnableCallgrindProfiling,
|
||||||
WebView::IsLayoutTestMode,
|
WebView::IsLayoutTestMode,
|
||||||
WebView::UseJavaScriptBytecode,
|
WebView::UseJavaScriptBytecode,
|
||||||
UseLagomNetworking);
|
Ladybird::UseLagomNetworking);
|
||||||
|
|
||||||
ErrorOr<NonnullRefPtr<Protocol::RequestClient>> launch_request_server_process(ReadonlySpan<String> candidate_request_server_paths);
|
ErrorOr<NonnullRefPtr<Protocol::RequestClient>> launch_request_server_process(ReadonlySpan<String> candidate_request_server_paths);
|
||||||
|
|
|
@ -12,6 +12,8 @@
|
||||||
#include <QTextLayout>
|
#include <QTextLayout>
|
||||||
#include <QTimer>
|
#include <QTimer>
|
||||||
|
|
||||||
|
namespace Ladybird {
|
||||||
|
|
||||||
LocationEdit::LocationEdit(QWidget* parent)
|
LocationEdit::LocationEdit(QWidget* parent)
|
||||||
: QLineEdit(parent)
|
: QLineEdit(parent)
|
||||||
{
|
{
|
||||||
|
@ -86,3 +88,5 @@ void LocationEdit::highlight_location()
|
||||||
QInputMethodEvent event(QString(), attributes);
|
QInputMethodEvent event(QString(), attributes);
|
||||||
QCoreApplication::sendEvent(this, &event);
|
QCoreApplication::sendEvent(this, &event);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
|
@ -8,6 +8,8 @@
|
||||||
|
|
||||||
#include <QLineEdit>
|
#include <QLineEdit>
|
||||||
|
|
||||||
|
namespace Ladybird {
|
||||||
|
|
||||||
class LocationEdit final : public QLineEdit {
|
class LocationEdit final : public QLineEdit {
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
public:
|
public:
|
||||||
|
@ -19,3 +21,5 @@ private:
|
||||||
|
|
||||||
void highlight_location();
|
void highlight_location();
|
||||||
};
|
};
|
||||||
|
|
||||||
|
}
|
||||||
|
|
|
@ -8,6 +8,8 @@
|
||||||
#include <AK/JsonObject.h>
|
#include <AK/JsonObject.h>
|
||||||
#include <QNetworkCookie>
|
#include <QNetworkCookie>
|
||||||
|
|
||||||
|
namespace Ladybird {
|
||||||
|
|
||||||
RequestManagerQt::RequestManagerQt()
|
RequestManagerQt::RequestManagerQt()
|
||||||
{
|
{
|
||||||
m_qnam = new QNetworkAccessManager(this);
|
m_qnam = new QNetworkAccessManager(this);
|
||||||
|
@ -107,3 +109,5 @@ void RequestManagerQt::Request::did_finish()
|
||||||
bool success = http_status_code != 0;
|
bool success = http_status_code != 0;
|
||||||
on_buffered_request_finish(success, buffer.length(), response_headers, http_status_code, ReadonlyBytes { buffer.data(), (size_t)buffer.size() });
|
on_buffered_request_finish(success, buffer.length(), response_headers, http_status_code, ReadonlyBytes { buffer.data(), (size_t)buffer.size() });
|
||||||
}
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
|
@ -10,6 +10,8 @@
|
||||||
#include <QtNetwork/QNetworkAccessManager>
|
#include <QtNetwork/QNetworkAccessManager>
|
||||||
#include <QtNetwork/QNetworkReply>
|
#include <QtNetwork/QNetworkReply>
|
||||||
|
|
||||||
|
namespace Ladybird {
|
||||||
|
|
||||||
class RequestManagerQt
|
class RequestManagerQt
|
||||||
: public QObject
|
: public QObject
|
||||||
, public Web::ResourceLoaderConnector {
|
, public Web::ResourceLoaderConnector {
|
||||||
|
@ -57,3 +59,5 @@ private:
|
||||||
HashMap<QNetworkReply*, NonnullRefPtr<Request>> m_pending;
|
HashMap<QNetworkReply*, NonnullRefPtr<Request>> m_pending;
|
||||||
QNetworkAccessManager* m_qnam { nullptr };
|
QNetworkAccessManager* m_qnam { nullptr };
|
||||||
};
|
};
|
||||||
|
|
||||||
|
}
|
||||||
|
|
|
@ -9,7 +9,7 @@
|
||||||
#include <AK/URL.h>
|
#include <AK/URL.h>
|
||||||
#include <BrowserSettings/Defaults.h>
|
#include <BrowserSettings/Defaults.h>
|
||||||
|
|
||||||
namespace Browser {
|
namespace Ladybird {
|
||||||
|
|
||||||
static QString rebase_default_url_on_serenity_resource_root(StringView default_url)
|
static QString rebase_default_url_on_serenity_resource_root(StringView default_url)
|
||||||
{
|
{
|
||||||
|
|
|
@ -9,7 +9,7 @@
|
||||||
#include <AK/DeprecatedString.h>
|
#include <AK/DeprecatedString.h>
|
||||||
#include <QSettings>
|
#include <QSettings>
|
||||||
|
|
||||||
namespace Browser {
|
namespace Ladybird {
|
||||||
|
|
||||||
class Settings : public QObject {
|
class Settings : public QObject {
|
||||||
public:
|
public:
|
||||||
|
|
|
@ -9,7 +9,9 @@
|
||||||
#include <QCloseEvent>
|
#include <QCloseEvent>
|
||||||
#include <QLabel>
|
#include <QLabel>
|
||||||
|
|
||||||
extern Browser::Settings* s_settings;
|
namespace Ladybird {
|
||||||
|
|
||||||
|
extern Settings* s_settings;
|
||||||
|
|
||||||
SettingsDialog::SettingsDialog(QMainWindow* window)
|
SettingsDialog::SettingsDialog(QMainWindow* window)
|
||||||
: m_window(window)
|
: m_window(window)
|
||||||
|
@ -44,3 +46,5 @@ void SettingsDialog::save()
|
||||||
// FIXME: Validate data.
|
// FIXME: Validate data.
|
||||||
s_settings->set_new_tab_page(m_new_tab_page->text());
|
s_settings->set_new_tab_page(m_new_tab_page->text());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
|
@ -12,6 +12,8 @@
|
||||||
|
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
|
namespace Ladybird {
|
||||||
|
|
||||||
class SettingsDialog : public QDialog {
|
class SettingsDialog : public QDialog {
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
public:
|
public:
|
||||||
|
@ -27,3 +29,5 @@ private:
|
||||||
QLineEdit* m_new_tab_page { nullptr };
|
QLineEdit* m_new_tab_page { nullptr };
|
||||||
QMainWindow* m_window { nullptr };
|
QMainWindow* m_window { nullptr };
|
||||||
};
|
};
|
||||||
|
|
||||||
|
}
|
||||||
|
|
|
@ -4,6 +4,8 @@
|
||||||
* SPDX-License-Identifier: BSD-2-Clause
|
* SPDX-License-Identifier: BSD-2-Clause
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
#include "TVGIconEngine.h"
|
||||||
|
#include "Utilities.h"
|
||||||
#include <AK/MemoryStream.h>
|
#include <AK/MemoryStream.h>
|
||||||
#include <AK/String.h>
|
#include <AK/String.h>
|
||||||
#include <LibGfx/Painter.h>
|
#include <LibGfx/Painter.h>
|
||||||
|
@ -12,8 +14,7 @@
|
||||||
#include <QPainter>
|
#include <QPainter>
|
||||||
#include <QPixmapCache>
|
#include <QPixmapCache>
|
||||||
|
|
||||||
#include "TVGIconEngine.h"
|
namespace Ladybird {
|
||||||
#include "Utilities.h"
|
|
||||||
|
|
||||||
void TVGIconEngine::paint(QPainter* qpainter, QRect const& rect, QIcon::Mode mode, QIcon::State state)
|
void TVGIconEngine::paint(QPainter* qpainter, QRect const& rect, QIcon::Mode mode, QIcon::State state)
|
||||||
{
|
{
|
||||||
|
@ -70,3 +71,5 @@ TVGIconEngine* TVGIconEngine::from_file(QString const& path)
|
||||||
return new TVGIconEngine(tvg.release_value());
|
return new TVGIconEngine(tvg.release_value());
|
||||||
return nullptr;
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
|
@ -12,6 +12,8 @@
|
||||||
#include <LibGfx/ImageFormats/TinyVGLoader.h>
|
#include <LibGfx/ImageFormats/TinyVGLoader.h>
|
||||||
#include <QIconEngine>
|
#include <QIconEngine>
|
||||||
|
|
||||||
|
namespace Ladybird {
|
||||||
|
|
||||||
class TVGIconEngine : public QIconEngine {
|
class TVGIconEngine : public QIconEngine {
|
||||||
public:
|
public:
|
||||||
TVGIconEngine(Gfx::TinyVGDecodedImageData const& image_data)
|
TVGIconEngine(Gfx::TinyVGDecodedImageData const& image_data)
|
||||||
|
@ -62,3 +64,5 @@ private:
|
||||||
NonnullRefPtr<Gfx::TinyVGDecodedImageData> m_image_data;
|
NonnullRefPtr<Gfx::TinyVGDecodedImageData> m_image_data;
|
||||||
unsigned m_cache_id { next_cache_id() };
|
unsigned m_cache_id { next_cache_id() };
|
||||||
};
|
};
|
||||||
|
|
||||||
|
}
|
||||||
|
|
|
@ -30,7 +30,10 @@
|
||||||
#include <QResizeEvent>
|
#include <QResizeEvent>
|
||||||
|
|
||||||
extern DeprecatedString s_serenity_resource_root;
|
extern DeprecatedString s_serenity_resource_root;
|
||||||
extern Browser::Settings* s_settings;
|
|
||||||
|
namespace Ladybird {
|
||||||
|
|
||||||
|
extern Settings* s_settings;
|
||||||
|
|
||||||
static QIcon create_tvg_icon_with_theme_colors(QString name, QPalette const& palette)
|
static QIcon create_tvg_icon_with_theme_colors(QString name, QPalette const& palette)
|
||||||
{
|
{
|
||||||
|
@ -691,3 +694,5 @@ void Tab::close_sub_widgets()
|
||||||
close_widget_window(m_console_widget);
|
close_widget_window(m_console_widget);
|
||||||
close_widget_window(m_inspector_widget);
|
close_widget_window(m_inspector_widget);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
|
@ -18,12 +18,11 @@
|
||||||
#include <QToolButton>
|
#include <QToolButton>
|
||||||
#include <QWidget>
|
#include <QWidget>
|
||||||
|
|
||||||
class BrowserWindow;
|
|
||||||
|
|
||||||
namespace Ladybird {
|
namespace Ladybird {
|
||||||
|
|
||||||
|
class BrowserWindow;
|
||||||
class ConsoleWidget;
|
class ConsoleWidget;
|
||||||
class InspectorWidget;
|
class InspectorWidget;
|
||||||
}
|
|
||||||
|
|
||||||
class Tab final : public QWidget {
|
class Tab final : public QWidget {
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
@ -117,3 +116,5 @@ private:
|
||||||
OwnPtr<QMenu> m_console_context_menu;
|
OwnPtr<QMenu> m_console_context_menu;
|
||||||
Ladybird::InspectorWidget* m_inspector_widget { nullptr };
|
Ladybird::InspectorWidget* m_inspector_widget { nullptr };
|
||||||
};
|
};
|
||||||
|
|
||||||
|
}
|
||||||
|
|
|
@ -6,7 +6,11 @@
|
||||||
|
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
|
namespace Ladybird {
|
||||||
|
|
||||||
enum UseLagomNetworking {
|
enum UseLagomNetworking {
|
||||||
No,
|
No,
|
||||||
Yes
|
Yes
|
||||||
};
|
};
|
||||||
|
|
||||||
|
}
|
||||||
|
|
|
@ -77,7 +77,7 @@ ErrorOr<int> serenity_main(Main::Arguments arguments)
|
||||||
auto protocol_client = TRY(launch_request_server_process(candidate_request_server_paths));
|
auto protocol_client = TRY(launch_request_server_process(candidate_request_server_paths));
|
||||||
Web::ResourceLoader::initialize(TRY(WebView::RequestServerAdapter::try_create(move(protocol_client))));
|
Web::ResourceLoader::initialize(TRY(WebView::RequestServerAdapter::try_create(move(protocol_client))));
|
||||||
} else {
|
} else {
|
||||||
Web::ResourceLoader::initialize(RequestManagerQt::create());
|
Web::ResourceLoader::initialize(Ladybird::RequestManagerQt::create());
|
||||||
}
|
}
|
||||||
|
|
||||||
JS::Bytecode::Interpreter::set_enabled(use_javascript_bytecode);
|
JS::Bytecode::Interpreter::set_enabled(use_javascript_bytecode);
|
||||||
|
|
|
@ -49,6 +49,8 @@
|
||||||
#include <QTimer>
|
#include <QTimer>
|
||||||
#include <QToolTip>
|
#include <QToolTip>
|
||||||
|
|
||||||
|
namespace Ladybird {
|
||||||
|
|
||||||
bool is_using_dark_system_theme(QWidget&);
|
bool is_using_dark_system_theme(QWidget&);
|
||||||
|
|
||||||
WebContentView::WebContentView(StringView webdriver_content_ipc_path, WebView::EnableCallgrindProfiling enable_callgrind_profiling, WebView::UseJavaScriptBytecode use_javascript_bytecode, UseLagomNetworking use_lagom_networking)
|
WebContentView::WebContentView(StringView webdriver_content_ipc_path, WebView::EnableCallgrindProfiling enable_callgrind_profiling, WebView::UseJavaScriptBytecode use_javascript_bytecode, UseLagomNetworking use_lagom_networking)
|
||||||
|
@ -820,3 +822,5 @@ ErrorOr<String> WebContentView::dump_layout_tree()
|
||||||
{
|
{
|
||||||
return String::from_deprecated_string(client().dump_layout_tree());
|
return String::from_deprecated_string(client().dump_layout_tree());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
|
@ -34,6 +34,8 @@ class WebContentClient;
|
||||||
|
|
||||||
using WebView::WebContentClient;
|
using WebView::WebContentClient;
|
||||||
|
|
||||||
|
namespace Ladybird {
|
||||||
|
|
||||||
class Tab;
|
class Tab;
|
||||||
|
|
||||||
class WebContentView final
|
class WebContentView final
|
||||||
|
@ -117,3 +119,5 @@ private:
|
||||||
|
|
||||||
StringView m_webdriver_content_ipc_path;
|
StringView m_webdriver_content_ipc_path;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
}
|
||||||
|
|
|
@ -4,7 +4,6 @@
|
||||||
* SPDX-License-Identifier: BSD-2-Clause
|
* SPDX-License-Identifier: BSD-2-Clause
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include "../HelperProcess.h"
|
|
||||||
#include "../Utilities.h"
|
#include "../Utilities.h"
|
||||||
#include <AK/Platform.h>
|
#include <AK/Platform.h>
|
||||||
#include <LibCore/ArgsParser.h>
|
#include <LibCore/ArgsParser.h>
|
||||||
|
@ -58,7 +57,7 @@ static ErrorOr<pid_t> launch_headless_browser(DeprecatedString const& socket_pat
|
||||||
|
|
||||||
ErrorOr<int> serenity_main(Main::Arguments arguments)
|
ErrorOr<int> serenity_main(Main::Arguments arguments)
|
||||||
{
|
{
|
||||||
// Note: only creating this to get access to its static methods in HelperProcess
|
// Note: only creating this to get access to its static methods in Utilities
|
||||||
QCoreApplication application(arguments.argc, arguments.argv);
|
QCoreApplication application(arguments.argc, arguments.argv);
|
||||||
|
|
||||||
auto listen_address = "0.0.0.0"sv;
|
auto listen_address = "0.0.0.0"sv;
|
||||||
|
|
|
@ -22,7 +22,24 @@
|
||||||
#include <LibSQL/SQLClient.h>
|
#include <LibSQL/SQLClient.h>
|
||||||
#include <QApplication>
|
#include <QApplication>
|
||||||
|
|
||||||
AK::OwnPtr<Browser::Settings> s_settings;
|
namespace Ladybird {
|
||||||
|
|
||||||
|
OwnPtr<Ladybird::Settings> s_settings;
|
||||||
|
|
||||||
|
bool is_using_dark_system_theme(QWidget& widget)
|
||||||
|
{
|
||||||
|
// FIXME: Qt does not provide any method to query if the system is using a dark theme. We will have to implement
|
||||||
|
// platform-specific methods if we wish to have better detection. For now, this inspects if Qt is using a
|
||||||
|
// dark color for widget backgrounds using Rec. 709 luma coefficients.
|
||||||
|
// https://en.wikipedia.org/wiki/Rec._709#Luma_coefficients
|
||||||
|
|
||||||
|
auto color = widget.palette().color(widget.backgroundRole());
|
||||||
|
auto luma = 0.2126f * color.redF() + 0.7152f * color.greenF() + 0.0722f * color.blueF();
|
||||||
|
|
||||||
|
return luma <= 0.5f;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
static ErrorOr<void> handle_attached_debugger()
|
static ErrorOr<void> handle_attached_debugger()
|
||||||
{
|
{
|
||||||
|
@ -102,8 +119,8 @@ ErrorOr<int> serenity_main(Main::Arguments arguments)
|
||||||
|
|
||||||
auto cookie_jar = database ? TRY(Browser::CookieJar::create(*database)) : Browser::CookieJar::create();
|
auto cookie_jar = database ? TRY(Browser::CookieJar::create(*database)) : Browser::CookieJar::create();
|
||||||
|
|
||||||
s_settings = adopt_own_if_nonnull(new Browser::Settings());
|
Ladybird::s_settings = adopt_own_if_nonnull(new Ladybird::Settings());
|
||||||
BrowserWindow window(cookie_jar, webdriver_content_ipc_path, enable_callgrind_profiling ? WebView::EnableCallgrindProfiling::Yes : WebView::EnableCallgrindProfiling::No, use_ast_interpreter ? WebView::UseJavaScriptBytecode::No : WebView::UseJavaScriptBytecode::Yes, use_lagom_networking ? UseLagomNetworking::Yes : UseLagomNetworking::No);
|
Ladybird::BrowserWindow window(cookie_jar, webdriver_content_ipc_path, enable_callgrind_profiling ? WebView::EnableCallgrindProfiling::Yes : WebView::EnableCallgrindProfiling::No, use_ast_interpreter ? WebView::UseJavaScriptBytecode::No : WebView::UseJavaScriptBytecode::Yes, use_lagom_networking ? Ladybird::UseLagomNetworking::Yes : Ladybird::UseLagomNetworking::No);
|
||||||
window.setWindowTitle("Ladybird");
|
window.setWindowTitle("Ladybird");
|
||||||
window.resize(800, 600);
|
window.resize(800, 600);
|
||||||
window.show();
|
window.show();
|
||||||
|
@ -116,16 +133,3 @@ ErrorOr<int> serenity_main(Main::Arguments arguments)
|
||||||
|
|
||||||
return event_loop.exec();
|
return event_loop.exec();
|
||||||
}
|
}
|
||||||
|
|
||||||
bool is_using_dark_system_theme(QWidget& widget)
|
|
||||||
{
|
|
||||||
// FIXME: Qt does not provide any method to query if the system is using a dark theme. We will have to implement
|
|
||||||
// platform-specific methods if we wish to have better detection. For now, this inspects if Qt is using a
|
|
||||||
// dark color for widget backgrounds using Rec. 709 luma coefficients.
|
|
||||||
// https://en.wikipedia.org/wiki/Rec._709#Luma_coefficients
|
|
||||||
|
|
||||||
auto color = widget.palette().color(widget.backgroundRole());
|
|
||||||
auto luma = 0.2126f * color.redF() + 0.7152f * color.greenF() + 0.0722f * color.blueF();
|
|
||||||
|
|
||||||
return luma <= 0.5f;
|
|
||||||
}
|
|
||||||
|
|
|
@ -58,7 +58,7 @@ public:
|
||||||
(void)use_javascript_bytecode;
|
(void)use_javascript_bytecode;
|
||||||
#else
|
#else
|
||||||
auto candidate_web_content_paths = TRY(get_paths_for_helper_process("WebContent"sv));
|
auto candidate_web_content_paths = TRY(get_paths_for_helper_process("WebContent"sv));
|
||||||
view->m_client_state.client = TRY(launch_web_content_process(*view, candidate_web_content_paths, WebView::EnableCallgrindProfiling::No, is_layout_test_mode, use_javascript_bytecode, UseLagomNetworking::No));
|
view->m_client_state.client = TRY(launch_web_content_process(*view, candidate_web_content_paths, WebView::EnableCallgrindProfiling::No, is_layout_test_mode, use_javascript_bytecode, Ladybird::UseLagomNetworking::No));
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
view->client().async_update_system_theme(move(theme));
|
view->client().async_update_system_theme(move(theme));
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue