mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-09-02 15:46:33 +00:00
LibWeb+LibWebView+WebContent: Convert about:settings to a WebUI
Some checks are pending
CI / Lagom (x86_64, Fuzzers_CI, false, ubuntu-24.04, Linux, Clang) (push) Waiting to run
CI / Lagom (x86_64, Sanitizer_CI, false, ubuntu-24.04, Linux, GNU) (push) Waiting to run
CI / Lagom (x86_64, Sanitizer_CI, true, ubuntu-24.04, Linux, Clang) (push) Waiting to run
CI / Lagom (arm64, Sanitizer_CI, false, macos-15, macOS, Clang) (push) Waiting to run
Package the js repl as a binary artifact / build-and-package (macos-14, macOS, macOS-universal2) (push) Waiting to run
Package the js repl as a binary artifact / build-and-package (ubuntu-24.04, Linux, Linux-x86_64) (push) Waiting to run
Run test262 and test-wasm / run_and_update_results (push) Waiting to run
Lint Code / lint (push) Waiting to run
Label PRs with merge conflicts / auto-labeler (push) Waiting to run
Push notes / build (push) Waiting to run
Some checks are pending
CI / Lagom (x86_64, Fuzzers_CI, false, ubuntu-24.04, Linux, Clang) (push) Waiting to run
CI / Lagom (x86_64, Sanitizer_CI, false, ubuntu-24.04, Linux, GNU) (push) Waiting to run
CI / Lagom (x86_64, Sanitizer_CI, true, ubuntu-24.04, Linux, Clang) (push) Waiting to run
CI / Lagom (arm64, Sanitizer_CI, false, macos-15, macOS, Clang) (push) Waiting to run
Package the js repl as a binary artifact / build-and-package (macos-14, macOS, macOS-universal2) (push) Waiting to run
Package the js repl as a binary artifact / build-and-package (ubuntu-24.04, Linux, Linux-x86_64) (push) Waiting to run
Run test262 and test-wasm / run_and_update_results (push) Waiting to run
Lint Code / lint (push) Waiting to run
Label PRs with merge conflicts / auto-labeler (push) Waiting to run
Push notes / build (push) Waiting to run
This commit is contained in:
parent
c75e40180c
commit
f05b0bfd5f
Notes:
github-actions[bot]
2025-03-28 11:32:05 +00:00
Author: https://github.com/trflynn89
Commit: f05b0bfd5f
Pull-request: https://github.com/LadybirdBrowser/ladybird/pull/4068
23 changed files with 151 additions and 264 deletions
|
@ -566,7 +566,6 @@ set(SOURCES
|
|||
Internals/InternalAnimationTimeline.cpp
|
||||
Internals/Internals.cpp
|
||||
Internals/InternalsBase.cpp
|
||||
Internals/Settings.cpp
|
||||
Internals/WebUI.cpp
|
||||
IntersectionObserver/IntersectionObserver.cpp
|
||||
IntersectionObserver/IntersectionObserverEntry.cpp
|
||||
|
|
|
@ -79,7 +79,7 @@ void WindowEnvironmentSettingsObject::setup(Page& page, URL::URL const& creation
|
|||
|
||||
// Non-Standard: We cannot fully initialize window object until *after* the we set up
|
||||
// the realm's [[HostDefined]] internal slot as the internal slot contains the web platform intrinsics
|
||||
MUST(window.initialize_web_interfaces({}, creation_url));
|
||||
MUST(window.initialize_web_interfaces({}));
|
||||
}
|
||||
|
||||
// https://html.spec.whatwg.org/multipage/window-object.html#script-settings-for-window-objects:responsible-document
|
||||
|
|
|
@ -60,7 +60,6 @@
|
|||
#include <LibWeb/HighResolutionTime/TimeOrigin.h>
|
||||
#include <LibWeb/Infra/CharacterTypes.h>
|
||||
#include <LibWeb/Internals/Internals.h>
|
||||
#include <LibWeb/Internals/Settings.h>
|
||||
#include <LibWeb/Layout/Viewport.h>
|
||||
#include <LibWeb/Page/Page.h>
|
||||
#include <LibWeb/Painting/PaintableBox.h>
|
||||
|
@ -722,7 +721,7 @@ void Window::set_internals_object_exposed(bool exposed)
|
|||
s_internals_object_exposed = exposed;
|
||||
}
|
||||
|
||||
WebIDL::ExceptionOr<void> Window::initialize_web_interfaces(Badge<WindowEnvironmentSettingsObject>, URL::URL const& url)
|
||||
WebIDL::ExceptionOr<void> Window::initialize_web_interfaces(Badge<WindowEnvironmentSettingsObject>)
|
||||
{
|
||||
auto& realm = this->realm();
|
||||
add_window_exposed_interfaces(*this);
|
||||
|
@ -736,13 +735,6 @@ WebIDL::ExceptionOr<void> Window::initialize_web_interfaces(Badge<WindowEnvironm
|
|||
if (s_internals_object_exposed)
|
||||
define_direct_property("internals"_fly_string, realm.create<Internals::Internals>(realm), JS::default_attributes);
|
||||
|
||||
if (url.scheme() == "about"sv && url.paths().size() == 1) {
|
||||
auto const& path = url.paths().first();
|
||||
|
||||
if (path == "settings"sv)
|
||||
define_direct_property("settings"_fly_string, realm.create<Internals::Settings>(realm), JS::default_attributes);
|
||||
}
|
||||
|
||||
return {};
|
||||
}
|
||||
|
||||
|
|
|
@ -148,7 +148,7 @@ public:
|
|||
// https://html.spec.whatwg.org/multipage/interaction.html#history-action-activation
|
||||
bool has_history_action_activation() const;
|
||||
|
||||
WebIDL::ExceptionOr<void> initialize_web_interfaces(Badge<WindowEnvironmentSettingsObject>, URL::URL const&);
|
||||
WebIDL::ExceptionOr<void> initialize_web_interfaces(Badge<WindowEnvironmentSettingsObject>);
|
||||
|
||||
Vector<GC::Ref<Plugin>> pdf_viewer_plugin_objects();
|
||||
Vector<GC::Ref<MimeType>> pdf_viewer_mime_type_objects();
|
||||
|
|
|
@ -1,57 +0,0 @@
|
|||
/*
|
||||
* Copyright (c) 2025, Tim Flynn <trflynn89@ladybird.org>
|
||||
*
|
||||
* SPDX-License-Identifier: BSD-2-Clause
|
||||
*/
|
||||
|
||||
#include <LibURL/Parser.h>
|
||||
#include <LibURL/URL.h>
|
||||
#include <LibWeb/Bindings/Intrinsics.h>
|
||||
#include <LibWeb/Bindings/SettingsPrototype.h>
|
||||
#include <LibWeb/Internals/Settings.h>
|
||||
#include <LibWeb/Page/Page.h>
|
||||
|
||||
namespace Web::Internals {
|
||||
|
||||
GC_DEFINE_ALLOCATOR(Settings);
|
||||
|
||||
Settings::Settings(JS::Realm& realm)
|
||||
: InternalsBase(realm)
|
||||
{
|
||||
}
|
||||
|
||||
Settings::~Settings() = default;
|
||||
|
||||
void Settings::initialize(JS::Realm& realm)
|
||||
{
|
||||
Base::initialize(realm);
|
||||
WEB_SET_PROTOTYPE_FOR_INTERFACE(Settings);
|
||||
}
|
||||
|
||||
void Settings::load_current_settings()
|
||||
{
|
||||
page().client().request_current_settings();
|
||||
}
|
||||
|
||||
void Settings::restore_default_settings()
|
||||
{
|
||||
page().client().restore_default_settings();
|
||||
}
|
||||
|
||||
void Settings::set_new_tab_page_url(String const& new_tab_page_url)
|
||||
{
|
||||
if (auto parsed_new_tab_page_url = URL::Parser::basic_parse(new_tab_page_url); parsed_new_tab_page_url.has_value())
|
||||
page().client().set_new_tab_page_url(*parsed_new_tab_page_url);
|
||||
}
|
||||
|
||||
void Settings::load_available_search_engines()
|
||||
{
|
||||
page().client().request_available_search_engines();
|
||||
}
|
||||
|
||||
void Settings::set_search_engine(Optional<String> const& search_engine)
|
||||
{
|
||||
page().client().set_search_engine(search_engine);
|
||||
}
|
||||
|
||||
}
|
|
@ -1,34 +0,0 @@
|
|||
/*
|
||||
* Copyright (c) 2025, Tim Flynn <trflynn89@ladybird.org>
|
||||
*
|
||||
* SPDX-License-Identifier: BSD-2-Clause
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <LibWeb/Internals/InternalsBase.h>
|
||||
|
||||
namespace Web::Internals {
|
||||
|
||||
class Settings final : public InternalsBase {
|
||||
WEB_PLATFORM_OBJECT(Settings, InternalsBase);
|
||||
GC_DECLARE_ALLOCATOR(Settings);
|
||||
|
||||
public:
|
||||
virtual ~Settings() override;
|
||||
|
||||
void load_current_settings();
|
||||
void restore_default_settings();
|
||||
|
||||
void set_new_tab_page_url(String const& new_tab_page_url);
|
||||
|
||||
void load_available_search_engines();
|
||||
void set_search_engine(Optional<String> const& search_engine);
|
||||
|
||||
private:
|
||||
explicit Settings(JS::Realm&);
|
||||
|
||||
virtual void initialize(JS::Realm&) override;
|
||||
};
|
||||
|
||||
}
|
|
@ -1,10 +0,0 @@
|
|||
[Exposed=Nobody]
|
||||
interface Settings {
|
||||
undefined loadCurrentSettings();
|
||||
undefined restoreDefaultSettings();
|
||||
|
||||
undefined setNewTabPageURL(USVString newTabPageURL);
|
||||
|
||||
undefined loadAvailableSearchEngines();
|
||||
undefined setSearchEngine(DOMString? search_engine);
|
||||
};
|
|
@ -402,12 +402,6 @@ public:
|
|||
|
||||
virtual void received_message_from_web_ui([[maybe_unused]] String const& name, [[maybe_unused]] JS::Value data) { }
|
||||
|
||||
virtual void request_current_settings() { }
|
||||
virtual void restore_default_settings() { }
|
||||
virtual void set_new_tab_page_url(URL::URL const&) { }
|
||||
virtual void request_available_search_engines() { }
|
||||
virtual void set_search_engine(Optional<String> const&) { }
|
||||
|
||||
virtual bool is_ready_to_paint() const = 0;
|
||||
|
||||
virtual DisplayListPlayerType display_list_player_type() const = 0;
|
||||
|
|
|
@ -266,7 +266,6 @@ libweb_js_bindings(IndexedDB/IDBTransaction)
|
|||
libweb_js_bindings(IndexedDB/IDBVersionChangeEvent)
|
||||
libweb_js_bindings(Internals/InternalAnimationTimeline)
|
||||
libweb_js_bindings(Internals/Internals)
|
||||
libweb_js_bindings(Internals/Settings)
|
||||
libweb_js_bindings(Internals/WebUI)
|
||||
libweb_js_bindings(IntersectionObserver/IntersectionObserver)
|
||||
libweb_js_bindings(IntersectionObserver/IntersectionObserverEntry)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue