mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-09-22 17:29:01 +00:00
LibWebView+UI: Generate the application debug menu
By migrating the debug menu to LibWebView, the AppKit and Qt UIs are now in sync - the AppKit UI was previously missing some actions. Further, this inadvertently fixes bugs around applying debug settings to new web views, especially across site-isolated processes. We were previously not applying settings appropriately; this now "just works" in the LibWebView infra.
This commit is contained in:
parent
5d8d9b337a
commit
9c99c48f47
Notes:
github-actions[bot]
2025-09-11 18:25:07 +00:00
Author: https://github.com/trflynn89
Commit: 9c99c48f47
Pull-request: https://github.com/LadybirdBrowser/ladybird/pull/6062
15 changed files with 212 additions and 632 deletions
|
@ -14,6 +14,7 @@
|
||||||
#include <LibFileSystem/FileSystem.h>
|
#include <LibFileSystem/FileSystem.h>
|
||||||
#include <LibImageDecoderClient/Client.h>
|
#include <LibImageDecoderClient/Client.h>
|
||||||
#include <LibWeb/CSS/PropertyID.h>
|
#include <LibWeb/CSS/PropertyID.h>
|
||||||
|
#include <LibWeb/Loader/UserAgent.h>
|
||||||
#include <LibWebView/Application.h>
|
#include <LibWebView/Application.h>
|
||||||
#include <LibWebView/CookieJar.h>
|
#include <LibWebView/CookieJar.h>
|
||||||
#include <LibWebView/Database.h>
|
#include <LibWebView/Database.h>
|
||||||
|
@ -613,6 +614,37 @@ void Application::display_error_dialog(StringView error_message) const
|
||||||
|
|
||||||
void Application::initialize_actions()
|
void Application::initialize_actions()
|
||||||
{
|
{
|
||||||
|
auto debug_request = [this](auto request) {
|
||||||
|
return [this, request]() {
|
||||||
|
if (auto view = active_web_view(); view.has_value())
|
||||||
|
view->debug_request(request);
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
auto check = [](auto& action, auto request) {
|
||||||
|
return [&action, request]() {
|
||||||
|
ViewImplementation::for_each_view([checked = action->checked(), request](ViewImplementation& view) {
|
||||||
|
view.debug_request(request, checked ? "on"sv : "off"sv);
|
||||||
|
return IterationDecision::Continue;
|
||||||
|
});
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
auto add_spoofed_value = [](auto& menu, auto name, auto value, auto& cached_value, auto request) {
|
||||||
|
auto action = Action::create_checkable(name, ActionID::SpoofUserAgent, [value, &cached_value, request]() {
|
||||||
|
cached_value = value;
|
||||||
|
|
||||||
|
ViewImplementation::for_each_view([&](ViewImplementation& view) {
|
||||||
|
view.debug_request(request, cached_value);
|
||||||
|
view.debug_request("clear-cache"sv); // Clear the cache to ensure requests are re-done with the new value.
|
||||||
|
return IterationDecision::Continue;
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
action->set_checked(value == cached_value);
|
||||||
|
menu->add_action(move(action));
|
||||||
|
};
|
||||||
|
|
||||||
m_reload_action = Action::create("Reload"sv, ActionID::Reload, [this]() {
|
m_reload_action = Action::create("Reload"sv, ActionID::Reload, [this]() {
|
||||||
if (auto view = active_web_view(); view.has_value())
|
if (auto view = active_web_view(); view.has_value())
|
||||||
view->reload();
|
view->reload();
|
||||||
|
@ -635,6 +667,78 @@ void Application::initialize_actions()
|
||||||
if (auto view = active_web_view(); view.has_value())
|
if (auto view = active_web_view(); view.has_value())
|
||||||
view->get_source();
|
view->get_source();
|
||||||
});
|
});
|
||||||
|
|
||||||
|
m_debug_menu = Menu::create("Debug"sv);
|
||||||
|
|
||||||
|
m_debug_menu->add_action(Action::create("Dump Session History Tree"sv, ActionID::DumpSessionHistoryTree, debug_request("dump-session-history"sv)));
|
||||||
|
m_debug_menu->add_action(Action::create("Dump DOM Tree"sv, ActionID::DumpDOMTree, debug_request("dump-dom-tree"sv)));
|
||||||
|
m_debug_menu->add_action(Action::create("Dump Layout Tree"sv, ActionID::DumpLayoutTree, debug_request("dump-layout-tree"sv)));
|
||||||
|
m_debug_menu->add_action(Action::create("Dump Paint Tree"sv, ActionID::DumpPaintTree, debug_request("dump-paint-tree"sv)));
|
||||||
|
m_debug_menu->add_action(Action::create("Dump Stacking Context Tree"sv, ActionID::DumpStackingContextTree, debug_request("dump-stacking-context-tree"sv)));
|
||||||
|
m_debug_menu->add_action(Action::create("Dump Display List"sv, ActionID::DumpDisplayList, debug_request("dump-display-list"sv)));
|
||||||
|
m_debug_menu->add_action(Action::create("Dump Style Sheets"sv, ActionID::DumpStyleSheets, debug_request("dump-style-sheets"sv)));
|
||||||
|
m_debug_menu->add_action(Action::create("Dump All Resolved Styles"sv, ActionID::DumpStyles, debug_request("dump-all-resolved-styles"sv)));
|
||||||
|
m_debug_menu->add_action(Action::create("Dump CSS Errors"sv, ActionID::DumpCSSErrors, debug_request("dump-all-css-errors"sv)));
|
||||||
|
m_debug_menu->add_action(Action::create("Dump Cookies"sv, ActionID::DumpCookies, [this]() { m_cookie_jar->dump_cookies(); }));
|
||||||
|
m_debug_menu->add_action(Action::create("Dump Local Storage"sv, ActionID::DumpLocalStorage, debug_request("dump-local-storage"sv)));
|
||||||
|
m_debug_menu->add_action(Action::create("Dump GC graph"sv, ActionID::DumpGCGraph, [this]() {
|
||||||
|
if (auto view = active_web_view(); view.has_value()) {
|
||||||
|
auto gc_graph_path = view->dump_gc_graph();
|
||||||
|
warnln("\033[33;1mDumped GC-graph into {}\033[0m", gc_graph_path);
|
||||||
|
}
|
||||||
|
}));
|
||||||
|
m_debug_menu->add_separator();
|
||||||
|
|
||||||
|
m_show_line_box_borders_action = Action::create_checkable("Show Line Box Borders"sv, ActionID::ShowLineBoxBorders, check(m_show_line_box_borders_action, "set-line-box-borders"sv));
|
||||||
|
m_debug_menu->add_action(*m_show_line_box_borders_action);
|
||||||
|
m_debug_menu->add_separator();
|
||||||
|
|
||||||
|
m_debug_menu->add_action(Action::create("Collect Garbage"sv, ActionID::CollectGarbage, debug_request("collect-garbage"sv)));
|
||||||
|
m_debug_menu->add_action(Action::create("Clear Cache"sv, ActionID::ClearCache, debug_request("clear-cache"sv)));
|
||||||
|
m_debug_menu->add_action(Action::create("Clear All Cookies"sv, ActionID::ClearCookies, [this]() { m_cookie_jar->clear_all_cookies(); }));
|
||||||
|
m_debug_menu->add_separator();
|
||||||
|
|
||||||
|
auto spoof_user_agent_menu = Menu::create_group("Spoof User Agent"sv);
|
||||||
|
m_user_agent_string = m_web_content_options.user_agent_preset.has_value()
|
||||||
|
? *WebView::user_agents.get(*m_web_content_options.user_agent_preset)
|
||||||
|
: Web::default_user_agent;
|
||||||
|
|
||||||
|
add_spoofed_value(spoof_user_agent_menu, "Disabled"sv, Web::default_user_agent, m_user_agent_string, "spoof-user-agent"sv);
|
||||||
|
for (auto const& user_agent : WebView::user_agents)
|
||||||
|
add_spoofed_value(spoof_user_agent_menu, user_agent.key, user_agent.value, m_user_agent_string, "spoof-user-agent"sv);
|
||||||
|
|
||||||
|
auto navigator_compatibility_mode_menu = Menu::create_group("Navigator Compatibility Mode"sv);
|
||||||
|
m_navigator_compatibility_mode = "chrome"sv;
|
||||||
|
|
||||||
|
add_spoofed_value(navigator_compatibility_mode_menu, "Chrome"sv, "chrome"sv, m_navigator_compatibility_mode, "navigator-compatibility-mode"sv);
|
||||||
|
add_spoofed_value(navigator_compatibility_mode_menu, "Gecko"sv, "gecko"sv, m_navigator_compatibility_mode, "navigator-compatibility-mode"sv);
|
||||||
|
add_spoofed_value(navigator_compatibility_mode_menu, "WebKit"sv, "webkit"sv, m_navigator_compatibility_mode, "navigator-compatibility-mode"sv);
|
||||||
|
|
||||||
|
m_debug_menu->add_submenu(move(spoof_user_agent_menu));
|
||||||
|
m_debug_menu->add_submenu(move(navigator_compatibility_mode_menu));
|
||||||
|
m_debug_menu->add_separator();
|
||||||
|
|
||||||
|
m_enable_scripting_action = Action::create_checkable("Enable Scripting"sv, ActionID::EnableScripting, check(m_enable_scripting_action, "scripting"sv));
|
||||||
|
m_enable_scripting_action->set_checked(m_browser_options.disable_scripting == WebView::DisableScripting::No);
|
||||||
|
m_debug_menu->add_action(*m_enable_scripting_action);
|
||||||
|
|
||||||
|
m_enable_content_filtering_action = Action::create_checkable("Enable Content Filtering"sv, ActionID::EnableContentFiltering, check(m_enable_content_filtering_action, "content-filtering"sv));
|
||||||
|
m_enable_content_filtering_action->set_checked(true);
|
||||||
|
m_debug_menu->add_action(*m_enable_content_filtering_action);
|
||||||
|
|
||||||
|
m_block_pop_ups_action = Action::create_checkable("Block Pop-ups"sv, ActionID::BlockPopUps, check(m_block_pop_ups_action, "block-pop-ups"sv));
|
||||||
|
m_block_pop_ups_action->set_checked(m_browser_options.allow_popups == AllowPopups::No);
|
||||||
|
m_debug_menu->add_action(*m_block_pop_ups_action);
|
||||||
|
}
|
||||||
|
|
||||||
|
void Application::apply_view_options(Badge<ViewImplementation>, ViewImplementation& view)
|
||||||
|
{
|
||||||
|
view.debug_request("set-line-box-borders"sv, m_show_line_box_borders_action->checked() ? "on"sv : "off"sv);
|
||||||
|
view.debug_request("scripting"sv, m_enable_scripting_action->checked() ? "on"sv : "off"sv);
|
||||||
|
view.debug_request("content-filtering"sv, m_enable_content_filtering_action->checked() ? "on"sv : "off"sv);
|
||||||
|
view.debug_request("block-pop-ups"sv, m_block_pop_ups_action->checked() ? "on"sv : "off"sv);
|
||||||
|
view.debug_request("spoof-user-agent"sv, m_user_agent_string);
|
||||||
|
view.debug_request("navigator-compatibility-mode"sv, m_navigator_compatibility_mode);
|
||||||
}
|
}
|
||||||
|
|
||||||
ErrorOr<Application::DevtoolsState> Application::toggle_devtools_enabled()
|
ErrorOr<Application::DevtoolsState> Application::toggle_devtools_enabled()
|
||||||
|
|
|
@ -74,6 +74,10 @@ public:
|
||||||
Action& select_all_action() { return *m_select_all_action; }
|
Action& select_all_action() { return *m_select_all_action; }
|
||||||
Action& view_source_action() { return *m_view_source_action; }
|
Action& view_source_action() { return *m_view_source_action; }
|
||||||
|
|
||||||
|
Menu& debug_menu() { return *m_debug_menu; }
|
||||||
|
|
||||||
|
void apply_view_options(Badge<ViewImplementation>, ViewImplementation&);
|
||||||
|
|
||||||
enum class DevtoolsState {
|
enum class DevtoolsState {
|
||||||
Disabled,
|
Disabled,
|
||||||
Enabled,
|
Enabled,
|
||||||
|
@ -166,6 +170,14 @@ private:
|
||||||
RefPtr<Action> m_select_all_action;
|
RefPtr<Action> m_select_all_action;
|
||||||
RefPtr<Action> m_view_source_action;
|
RefPtr<Action> m_view_source_action;
|
||||||
|
|
||||||
|
RefPtr<Menu> m_debug_menu;
|
||||||
|
RefPtr<Action> m_show_line_box_borders_action;
|
||||||
|
RefPtr<Action> m_enable_scripting_action;
|
||||||
|
RefPtr<Action> m_enable_content_filtering_action;
|
||||||
|
RefPtr<Action> m_block_pop_ups_action;
|
||||||
|
StringView m_user_agent_string;
|
||||||
|
StringView m_navigator_compatibility_mode;
|
||||||
|
|
||||||
#if defined(AK_OS_MACOS)
|
#if defined(AK_OS_MACOS)
|
||||||
OwnPtr<MachPortServer> m_mach_port_server;
|
OwnPtr<MachPortServer> m_mach_port_server;
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -52,6 +52,28 @@ enum class ActionID {
|
||||||
UnmuteMedia,
|
UnmuteMedia,
|
||||||
ToggleMediaControlsState,
|
ToggleMediaControlsState,
|
||||||
ToggleMediaLoopState,
|
ToggleMediaLoopState,
|
||||||
|
|
||||||
|
DumpSessionHistoryTree,
|
||||||
|
DumpDOMTree,
|
||||||
|
DumpLayoutTree,
|
||||||
|
DumpPaintTree,
|
||||||
|
DumpStackingContextTree,
|
||||||
|
DumpDisplayList,
|
||||||
|
DumpStyleSheets,
|
||||||
|
DumpStyles,
|
||||||
|
DumpCSSErrors,
|
||||||
|
DumpCookies,
|
||||||
|
DumpLocalStorage,
|
||||||
|
DumpGCGraph,
|
||||||
|
ShowLineBoxBorders,
|
||||||
|
CollectGarbage,
|
||||||
|
ClearCache,
|
||||||
|
ClearCookies,
|
||||||
|
SpoofUserAgent,
|
||||||
|
NavigatorCompatibilityMode,
|
||||||
|
EnableScripting,
|
||||||
|
EnableContentFiltering,
|
||||||
|
BlockPopUps,
|
||||||
};
|
};
|
||||||
|
|
||||||
class WEBVIEW_API Action
|
class WEBVIEW_API Action
|
||||||
|
|
|
@ -588,11 +588,7 @@ void ViewImplementation::initialize_client(CreateNewClient create_new_client)
|
||||||
if (auto webdriver_content_ipc_path = Application::browser_options().webdriver_content_ipc_path; webdriver_content_ipc_path.has_value())
|
if (auto webdriver_content_ipc_path = Application::browser_options().webdriver_content_ipc_path; webdriver_content_ipc_path.has_value())
|
||||||
client().async_connect_to_webdriver(m_client_state.page_index, *webdriver_content_ipc_path);
|
client().async_connect_to_webdriver(m_client_state.page_index, *webdriver_content_ipc_path);
|
||||||
|
|
||||||
if (Application::browser_options().allow_popups == AllowPopups::Yes)
|
Application::the().apply_view_options({}, *this);
|
||||||
client().async_debug_request(m_client_state.page_index, "block-pop-ups"sv, "off"sv);
|
|
||||||
|
|
||||||
if (auto const& user_agent_preset = Application::web_content_options().user_agent_preset; user_agent_preset.has_value())
|
|
||||||
client().async_debug_request(m_client_state.page_index, "spoof-user-agent"sv, *user_agents.get(*user_agent_preset));
|
|
||||||
|
|
||||||
default_zoom_level_factor_changed();
|
default_zoom_level_factor_changed();
|
||||||
languages_changed();
|
languages_changed();
|
||||||
|
|
|
@ -5,7 +5,6 @@
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include <LibWebView/Application.h>
|
#include <LibWebView/Application.h>
|
||||||
#include <LibWebView/CookieJar.h>
|
|
||||||
|
|
||||||
#import <Application/ApplicationDelegate.h>
|
#import <Application/ApplicationDelegate.h>
|
||||||
#import <Interface/InfoBar.h>
|
#import <Interface/InfoBar.h>
|
||||||
|
@ -13,7 +12,6 @@
|
||||||
#import <Interface/Menu.h>
|
#import <Interface/Menu.h>
|
||||||
#import <Interface/Tab.h>
|
#import <Interface/Tab.h>
|
||||||
#import <Interface/TabController.h>
|
#import <Interface/TabController.h>
|
||||||
#import <LibWebView/UserAgent.h>
|
|
||||||
#import <Utilities/Conversions.h>
|
#import <Utilities/Conversions.h>
|
||||||
|
|
||||||
#if !__has_feature(objc_arc)
|
#if !__has_feature(objc_arc)
|
||||||
|
@ -25,7 +23,6 @@
|
||||||
Web::CSS::PreferredColorScheme m_preferred_color_scheme;
|
Web::CSS::PreferredColorScheme m_preferred_color_scheme;
|
||||||
Web::CSS::PreferredContrast m_preferred_contrast;
|
Web::CSS::PreferredContrast m_preferred_contrast;
|
||||||
Web::CSS::PreferredMotion m_preferred_motion;
|
Web::CSS::PreferredMotion m_preferred_motion;
|
||||||
ByteString m_navigator_compatibility_mode;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@property (nonatomic, strong) NSMutableArray<TabController*>* managed_tabs;
|
@property (nonatomic, strong) NSMutableArray<TabController*>* managed_tabs;
|
||||||
|
@ -69,7 +66,6 @@
|
||||||
m_preferred_color_scheme = Web::CSS::PreferredColorScheme::Auto;
|
m_preferred_color_scheme = Web::CSS::PreferredColorScheme::Auto;
|
||||||
m_preferred_contrast = Web::CSS::PreferredContrast::Auto;
|
m_preferred_contrast = Web::CSS::PreferredContrast::Auto;
|
||||||
m_preferred_motion = Web::CSS::PreferredMotion::Auto;
|
m_preferred_motion = Web::CSS::PreferredMotion::Auto;
|
||||||
m_navigator_compatibility_mode = "chrome";
|
|
||||||
|
|
||||||
// Reduce the tooltip delay, as the default delay feels quite long.
|
// Reduce the tooltip delay, as the default delay feels quite long.
|
||||||
[[NSUserDefaults standardUserDefaults] setObject:@100 forKey:@"NSInitialToolTipDelay"];
|
[[NSUserDefaults standardUserDefaults] setObject:@100 forKey:@"NSInitialToolTipDelay"];
|
||||||
|
@ -166,6 +162,32 @@
|
||||||
activateTab:Web::HTML::ActivateTab::Yes];
|
activateTab:Web::HTML::ActivateTab::Yes];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
- (void)openSettings:(id)sender
|
||||||
|
{
|
||||||
|
[self createNewTab:URL::URL::about("settings"_string)
|
||||||
|
fromTab:self.active_tab
|
||||||
|
activateTab:Web::HTML::ActivateTab::Yes];
|
||||||
|
}
|
||||||
|
|
||||||
|
- (void)openTaskManager:(id)sender
|
||||||
|
{
|
||||||
|
[self createNewTab:URL::URL::about("processes"_string)
|
||||||
|
fromTab:self.active_tab
|
||||||
|
activateTab:Web::HTML::ActivateTab::Yes];
|
||||||
|
}
|
||||||
|
|
||||||
|
- (void)openLocation:(id)sender
|
||||||
|
{
|
||||||
|
auto* current_tab = [NSApp keyWindow];
|
||||||
|
|
||||||
|
if (![current_tab isKindOfClass:[Tab class]]) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
auto* controller = (TabController*)[current_tab windowController];
|
||||||
|
[controller focusLocationToolbarItem];
|
||||||
|
}
|
||||||
|
|
||||||
- (nonnull TabController*)createNewTab:(Web::HTML::ActivateTab)activate_tab
|
- (nonnull TabController*)createNewTab:(Web::HTML::ActivateTab)activate_tab
|
||||||
fromTab:(nullable Tab*)tab
|
fromTab:(nullable Tab*)tab
|
||||||
{
|
{
|
||||||
|
@ -209,14 +231,6 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
[self.managed_tabs addObject:controller];
|
[self.managed_tabs addObject:controller];
|
||||||
[controller onCreateNewTab];
|
|
||||||
}
|
|
||||||
|
|
||||||
- (void)openSettings:(id)sender
|
|
||||||
{
|
|
||||||
[self createNewTab:URL::URL::about("settings"_string)
|
|
||||||
fromTab:self.active_tab
|
|
||||||
activateTab:Web::HTML::ActivateTab::Yes];
|
|
||||||
}
|
}
|
||||||
|
|
||||||
- (void)closeCurrentTab:(id)sender
|
- (void)closeCurrentTab:(id)sender
|
||||||
|
@ -276,25 +290,6 @@
|
||||||
activeTab:self.active_tab];
|
activeTab:self.active_tab];
|
||||||
}
|
}
|
||||||
|
|
||||||
- (void)openTaskManager:(id)sender
|
|
||||||
{
|
|
||||||
[self createNewTab:URL::URL::about("processes"_string)
|
|
||||||
fromTab:self.active_tab
|
|
||||||
activateTab:Web::HTML::ActivateTab::Yes];
|
|
||||||
}
|
|
||||||
|
|
||||||
- (void)openLocation:(id)sender
|
|
||||||
{
|
|
||||||
auto* current_tab = [NSApp keyWindow];
|
|
||||||
|
|
||||||
if (![current_tab isKindOfClass:[Tab class]]) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
auto* controller = (TabController*)[current_tab windowController];
|
|
||||||
[controller focusLocationToolbarItem];
|
|
||||||
}
|
|
||||||
|
|
||||||
- (void)setAutoPreferredColorScheme:(id)sender
|
- (void)setAutoPreferredColorScheme:(id)sender
|
||||||
{
|
{
|
||||||
m_preferred_color_scheme = Web::CSS::PreferredColorScheme::Auto;
|
m_preferred_color_scheme = Web::CSS::PreferredColorScheme::Auto;
|
||||||
|
@ -394,16 +389,6 @@
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
- (void)dumpCookies:(id)sender
|
|
||||||
{
|
|
||||||
WebView::Application::cookie_jar().dump_cookies();
|
|
||||||
}
|
|
||||||
|
|
||||||
- (void)clearAllCookies:(id)sender
|
|
||||||
{
|
|
||||||
WebView::Application::cookie_jar().clear_all_cookies();
|
|
||||||
}
|
|
||||||
|
|
||||||
- (NSMenuItem*)createApplicationMenu
|
- (NSMenuItem*)createApplicationMenu
|
||||||
{
|
{
|
||||||
auto* menu = [[NSMenuItem alloc] init];
|
auto* menu = [[NSMenuItem alloc] init];
|
||||||
|
@ -619,107 +604,10 @@
|
||||||
- (NSMenuItem*)createDebugMenu
|
- (NSMenuItem*)createDebugMenu
|
||||||
{
|
{
|
||||||
auto* menu = [[NSMenuItem alloc] init];
|
auto* menu = [[NSMenuItem alloc] init];
|
||||||
auto* submenu = [[NSMenu alloc] initWithTitle:@"Debug"];
|
|
||||||
|
|
||||||
[submenu addItem:[[NSMenuItem alloc] initWithTitle:@"Dump DOM Tree"
|
|
||||||
action:@selector(dumpDOMTree:)
|
|
||||||
keyEquivalent:@""]];
|
|
||||||
[submenu addItem:[[NSMenuItem alloc] initWithTitle:@"Dump Layout Tree"
|
|
||||||
action:@selector(dumpLayoutTree:)
|
|
||||||
keyEquivalent:@""]];
|
|
||||||
[submenu addItem:[[NSMenuItem alloc] initWithTitle:@"Dump Paint Tree"
|
|
||||||
action:@selector(dumpPaintTree:)
|
|
||||||
keyEquivalent:@""]];
|
|
||||||
[submenu addItem:[[NSMenuItem alloc] initWithTitle:@"Dump Stacking Context Tree"
|
|
||||||
action:@selector(dumpStackingContextTree:)
|
|
||||||
keyEquivalent:@""]];
|
|
||||||
[submenu addItem:[[NSMenuItem alloc] initWithTitle:@"Dump Display List"
|
|
||||||
action:@selector(dumpDisplayList:)
|
|
||||||
keyEquivalent:@""]];
|
|
||||||
[submenu addItem:[[NSMenuItem alloc] initWithTitle:@"Dump Style Sheets"
|
|
||||||
action:@selector(dumpStyleSheets:)
|
|
||||||
keyEquivalent:@""]];
|
|
||||||
[submenu addItem:[[NSMenuItem alloc] initWithTitle:@"Dump All Resolved Styles"
|
|
||||||
action:@selector(dumpAllResolvedStyles:)
|
|
||||||
keyEquivalent:@""]];
|
|
||||||
[submenu addItem:[[NSMenuItem alloc] initWithTitle:@"Dump CSS Errors"
|
|
||||||
action:@selector(dumpCSSErrors:)
|
|
||||||
keyEquivalent:@""]];
|
|
||||||
[submenu addItem:[[NSMenuItem alloc] initWithTitle:@"Dump History"
|
|
||||||
action:@selector(dumpHistory:)
|
|
||||||
keyEquivalent:@""]];
|
|
||||||
[submenu addItem:[[NSMenuItem alloc] initWithTitle:@"Dump Cookies"
|
|
||||||
action:@selector(dumpCookies:)
|
|
||||||
keyEquivalent:@""]];
|
|
||||||
[submenu addItem:[[NSMenuItem alloc] initWithTitle:@"Dump Local Storage"
|
|
||||||
action:@selector(dumpLocalStorage:)
|
|
||||||
keyEquivalent:@""]];
|
|
||||||
[submenu addItem:[NSMenuItem separatorItem]];
|
|
||||||
|
|
||||||
[submenu addItem:[[NSMenuItem alloc] initWithTitle:@"Show Line Box Borders"
|
|
||||||
action:@selector(toggleLineBoxBorders:)
|
|
||||||
keyEquivalent:@""]];
|
|
||||||
[submenu addItem:[NSMenuItem separatorItem]];
|
|
||||||
|
|
||||||
[submenu addItem:[[NSMenuItem alloc] initWithTitle:@"Collect Garbage"
|
|
||||||
action:@selector(collectGarbage:)
|
|
||||||
keyEquivalent:@""]];
|
|
||||||
[submenu addItem:[[NSMenuItem alloc] initWithTitle:@"Dump GC Graph"
|
|
||||||
action:@selector(dumpGCGraph:)
|
|
||||||
keyEquivalent:@""]];
|
|
||||||
[submenu addItem:[[NSMenuItem alloc] initWithTitle:@"Clear Cache"
|
|
||||||
action:@selector(clearCache:)
|
|
||||||
keyEquivalent:@""]];
|
|
||||||
[submenu addItem:[[NSMenuItem alloc] initWithTitle:@"Clear All Cookies"
|
|
||||||
action:@selector(clearAllCookies:)
|
|
||||||
keyEquivalent:@""]];
|
|
||||||
|
|
||||||
[submenu addItem:[NSMenuItem separatorItem]];
|
|
||||||
|
|
||||||
auto* spoof_user_agent_menu = [[NSMenu alloc] init];
|
|
||||||
auto add_user_agent = [spoof_user_agent_menu](ByteString name) {
|
|
||||||
[spoof_user_agent_menu addItem:[[NSMenuItem alloc] initWithTitle:Ladybird::string_to_ns_string(name)
|
|
||||||
action:@selector(setUserAgentSpoof:)
|
|
||||||
keyEquivalent:@""]];
|
|
||||||
};
|
|
||||||
|
|
||||||
add_user_agent("Disabled");
|
|
||||||
for (auto const& userAgent : WebView::user_agents)
|
|
||||||
add_user_agent(userAgent.key);
|
|
||||||
|
|
||||||
auto* spoof_user_agent_menu_item = [[NSMenuItem alloc] initWithTitle:@"Spoof User Agent"
|
|
||||||
action:nil
|
|
||||||
keyEquivalent:@""];
|
|
||||||
[spoof_user_agent_menu_item setSubmenu:spoof_user_agent_menu];
|
|
||||||
|
|
||||||
[submenu addItem:spoof_user_agent_menu_item];
|
|
||||||
|
|
||||||
auto* navigator_compatibility_mode_menu = [[NSMenu alloc] init];
|
|
||||||
auto add_navigator_compatibility_mode = [navigator_compatibility_mode_menu](ByteString name) {
|
|
||||||
[navigator_compatibility_mode_menu addItem:[[NSMenuItem alloc] initWithTitle:Ladybird::string_to_ns_string(name)
|
|
||||||
action:@selector(setNavigatorCompatibilityMode:)
|
|
||||||
keyEquivalent:@""]];
|
|
||||||
};
|
|
||||||
add_navigator_compatibility_mode("Chrome");
|
|
||||||
add_navigator_compatibility_mode("Gecko");
|
|
||||||
add_navigator_compatibility_mode("WebKit");
|
|
||||||
|
|
||||||
auto* navigator_compatibility_mode_menu_item = [[NSMenuItem alloc] initWithTitle:@"Navigator Compatibility Mode"
|
|
||||||
action:nil
|
|
||||||
keyEquivalent:@""];
|
|
||||||
[navigator_compatibility_mode_menu_item setSubmenu:navigator_compatibility_mode_menu];
|
|
||||||
|
|
||||||
[submenu addItem:navigator_compatibility_mode_menu_item];
|
|
||||||
[submenu addItem:[NSMenuItem separatorItem]];
|
|
||||||
|
|
||||||
[submenu addItem:[[NSMenuItem alloc] initWithTitle:@"Enable Scripting"
|
|
||||||
action:@selector(toggleScripting:)
|
|
||||||
keyEquivalent:@""]];
|
|
||||||
[submenu addItem:[[NSMenuItem alloc] initWithTitle:@"Block Pop-ups"
|
|
||||||
action:@selector(togglePopupBlocking:)
|
|
||||||
keyEquivalent:@""]];
|
|
||||||
|
|
||||||
|
auto* submenu = Ladybird::create_application_menu(WebView::Application::the().debug_menu());
|
||||||
[menu setSubmenu:submenu];
|
[menu setSubmenu:submenu];
|
||||||
|
|
||||||
return menu;
|
return menu;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -80,6 +80,4 @@
|
||||||
- (void)resetZoom;
|
- (void)resetZoom;
|
||||||
- (float)zoomLevel;
|
- (float)zoomLevel;
|
||||||
|
|
||||||
- (void)debugRequest:(ByteString const&)request argument:(ByteString const&)argument;
|
|
||||||
|
|
||||||
@end
|
@end
|
||||||
|
|
|
@ -241,11 +241,6 @@ struct HideCursor {
|
||||||
m_web_view_bridge->set_preferred_motion(motion);
|
m_web_view_bridge->set_preferred_motion(motion);
|
||||||
}
|
}
|
||||||
|
|
||||||
- (void)debugRequest:(ByteString const&)request argument:(ByteString const&)argument
|
|
||||||
{
|
|
||||||
m_web_view_bridge->debug_request(request, argument);
|
|
||||||
}
|
|
||||||
|
|
||||||
#pragma mark - Private methods
|
#pragma mark - Private methods
|
||||||
|
|
||||||
static void copy_data_to_clipboard(StringView data, NSPasteboardType pasteboard_type)
|
static void copy_data_to_clipboard(StringView data, NSPasteboardType pasteboard_type)
|
||||||
|
|
|
@ -13,14 +13,6 @@
|
||||||
|
|
||||||
@class Tab;
|
@class Tab;
|
||||||
|
|
||||||
struct TabSettings {
|
|
||||||
BOOL should_show_line_box_borders { NO };
|
|
||||||
BOOL scripting_enabled { YES };
|
|
||||||
BOOL block_popups { YES };
|
|
||||||
ByteString user_agent_name { "Disabled"sv };
|
|
||||||
ByteString navigator_compatibility_mode { "chrome"sv };
|
|
||||||
};
|
|
||||||
|
|
||||||
@interface TabController : NSWindowController <NSWindowDelegate>
|
@interface TabController : NSWindowController <NSWindowDelegate>
|
||||||
|
|
||||||
- (instancetype)init;
|
- (instancetype)init;
|
||||||
|
@ -34,14 +26,8 @@ struct TabSettings {
|
||||||
|
|
||||||
- (void)onURLChange:(URL::URL const&)url;
|
- (void)onURLChange:(URL::URL const&)url;
|
||||||
|
|
||||||
- (void)onCreateNewTab;
|
|
||||||
|
|
||||||
- (void)clearHistory;
|
- (void)clearHistory;
|
||||||
|
|
||||||
- (void)setPopupBlocking:(BOOL)block_popups;
|
|
||||||
- (void)setScripting:(BOOL)enabled;
|
|
||||||
- (void)debugRequest:(ByteString const&)request argument:(ByteString const&)argument;
|
|
||||||
|
|
||||||
- (void)focusLocationToolbarItem;
|
- (void)focusLocationToolbarItem;
|
||||||
|
|
||||||
@end
|
@end
|
||||||
|
|
|
@ -4,11 +4,9 @@
|
||||||
* SPDX-License-Identifier: BSD-2-Clause
|
* SPDX-License-Identifier: BSD-2-Clause
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include <LibWeb/Loader/UserAgent.h>
|
|
||||||
#include <LibWebView/Application.h>
|
#include <LibWebView/Application.h>
|
||||||
#include <LibWebView/Autocomplete.h>
|
#include <LibWebView/Autocomplete.h>
|
||||||
#include <LibWebView/URL.h>
|
#include <LibWebView/URL.h>
|
||||||
#include <LibWebView/UserAgent.h>
|
|
||||||
#include <LibWebView/ViewImplementation.h>
|
#include <LibWebView/ViewImplementation.h>
|
||||||
|
|
||||||
#import <Application/ApplicationDelegate.h>
|
#import <Application/ApplicationDelegate.h>
|
||||||
|
@ -54,8 +52,6 @@ static NSString* const TOOLBAR_TAB_OVERVIEW_IDENTIFIER = @"ToolbarTabOverviewIde
|
||||||
{
|
{
|
||||||
u64 m_page_index;
|
u64 m_page_index;
|
||||||
|
|
||||||
TabSettings m_settings;
|
|
||||||
|
|
||||||
OwnPtr<WebView::Autocomplete> m_autocomplete;
|
OwnPtr<WebView::Autocomplete> m_autocomplete;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -105,14 +101,6 @@ static NSString* const TOOLBAR_TAB_OVERVIEW_IDENTIFIER = @"ToolbarTabOverviewIde
|
||||||
|
|
||||||
m_page_index = 0;
|
m_page_index = 0;
|
||||||
|
|
||||||
m_settings = {
|
|
||||||
.scripting_enabled = WebView::Application::browser_options().disable_scripting == WebView::DisableScripting::Yes ? NO : YES,
|
|
||||||
.block_popups = WebView::Application::browser_options().allow_popups == WebView::AllowPopups::Yes ? NO : YES,
|
|
||||||
};
|
|
||||||
|
|
||||||
if (auto const& user_agent_preset = WebView::Application::web_content_options().user_agent_preset; user_agent_preset.has_value())
|
|
||||||
m_settings.user_agent_name = *user_agent_preset;
|
|
||||||
|
|
||||||
self.autocomplete = [[Autocomplete alloc] init:self withToolbarItem:self.location_toolbar_item];
|
self.autocomplete = [[Autocomplete alloc] init:self withToolbarItem:self.location_toolbar_item];
|
||||||
m_autocomplete = make<WebView::Autocomplete>();
|
m_autocomplete = make<WebView::Autocomplete>();
|
||||||
|
|
||||||
|
@ -163,12 +151,6 @@ static NSString* const TOOLBAR_TAB_OVERVIEW_IDENTIFIER = @"ToolbarTabOverviewIde
|
||||||
[self.window makeFirstResponder:[self tab].web_view];
|
[self.window makeFirstResponder:[self tab].web_view];
|
||||||
}
|
}
|
||||||
|
|
||||||
- (void)onCreateNewTab
|
|
||||||
{
|
|
||||||
[self setPopupBlocking:m_settings.block_popups];
|
|
||||||
[self setScripting:m_settings.scripting_enabled];
|
|
||||||
}
|
|
||||||
|
|
||||||
- (void)zoomIn:(id)sender
|
- (void)zoomIn:(id)sender
|
||||||
{
|
{
|
||||||
[[[self tab] web_view] zoomIn];
|
[[[self tab] web_view] zoomIn];
|
||||||
|
@ -192,11 +174,6 @@ static NSString* const TOOLBAR_TAB_OVERVIEW_IDENTIFIER = @"ToolbarTabOverviewIde
|
||||||
// FIXME: Reimplement clearing history using WebContent's history.
|
// FIXME: Reimplement clearing history using WebContent's history.
|
||||||
}
|
}
|
||||||
|
|
||||||
- (void)debugRequest:(ByteString const&)request argument:(ByteString const&)argument
|
|
||||||
{
|
|
||||||
[[[self tab] web_view] debugRequest:request argument:argument];
|
|
||||||
}
|
|
||||||
|
|
||||||
- (void)focusLocationToolbarItem
|
- (void)focusLocationToolbarItem
|
||||||
{
|
{
|
||||||
[self.window makeFirstResponder:self.location_toolbar_item.view];
|
[self.window makeFirstResponder:self.location_toolbar_item.view];
|
||||||
|
@ -291,124 +268,6 @@ static NSString* const TOOLBAR_TAB_OVERVIEW_IDENTIFIER = @"ToolbarTabOverviewIde
|
||||||
[[self.zoom_toolbar_item view] setHidden:zoom_button_hidden];
|
[[self.zoom_toolbar_item view] setHidden:zoom_button_hidden];
|
||||||
}
|
}
|
||||||
|
|
||||||
- (void)dumpDOMTree:(id)sender
|
|
||||||
{
|
|
||||||
[self debugRequest:"dump-dom-tree" argument:""];
|
|
||||||
}
|
|
||||||
|
|
||||||
- (void)dumpDisplayList:(id)sender
|
|
||||||
{
|
|
||||||
[self debugRequest:"dump-display-list" argument:""];
|
|
||||||
}
|
|
||||||
|
|
||||||
- (void)dumpLayoutTree:(id)sender
|
|
||||||
{
|
|
||||||
[self debugRequest:"dump-layout-tree" argument:""];
|
|
||||||
}
|
|
||||||
|
|
||||||
- (void)dumpPaintTree:(id)sender
|
|
||||||
{
|
|
||||||
[self debugRequest:"dump-paint-tree" argument:""];
|
|
||||||
}
|
|
||||||
|
|
||||||
- (void)dumpStackingContextTree:(id)sender
|
|
||||||
{
|
|
||||||
[self debugRequest:"dump-stacking-context-tree" argument:""];
|
|
||||||
}
|
|
||||||
|
|
||||||
- (void)dumpStyleSheets:(id)sender
|
|
||||||
{
|
|
||||||
[self debugRequest:"dump-style-sheets" argument:""];
|
|
||||||
}
|
|
||||||
|
|
||||||
- (void)dumpAllResolvedStyles:(id)sender
|
|
||||||
{
|
|
||||||
[self debugRequest:"dump-all-resolved-styles" argument:""];
|
|
||||||
}
|
|
||||||
|
|
||||||
- (void)dumpCSSErrors:(id)sender
|
|
||||||
{
|
|
||||||
[self debugRequest:"dump-all-css-errors" argument:""];
|
|
||||||
}
|
|
||||||
|
|
||||||
- (void)dumpHistory:(id)sender
|
|
||||||
{
|
|
||||||
[self debugRequest:"dump-session-history" argument:""];
|
|
||||||
}
|
|
||||||
|
|
||||||
- (void)dumpLocalStorage:(id)sender
|
|
||||||
{
|
|
||||||
[self debugRequest:"dump-local-storage" argument:""];
|
|
||||||
}
|
|
||||||
|
|
||||||
- (void)toggleLineBoxBorders:(id)sender
|
|
||||||
{
|
|
||||||
m_settings.should_show_line_box_borders = !m_settings.should_show_line_box_borders;
|
|
||||||
[self debugRequest:"set-line-box-borders" argument:m_settings.should_show_line_box_borders ? "on" : "off"];
|
|
||||||
}
|
|
||||||
|
|
||||||
- (void)collectGarbage:(id)sender
|
|
||||||
{
|
|
||||||
[self debugRequest:"collect-garbage" argument:""];
|
|
||||||
}
|
|
||||||
|
|
||||||
- (void)dumpGCGraph:(id)sender
|
|
||||||
{
|
|
||||||
auto& view_impl = [[[self tab] web_view] view];
|
|
||||||
auto gc_graph_path = view_impl.dump_gc_graph();
|
|
||||||
warnln("\033[33;1mDumped GC-graph into {}\033[0m", gc_graph_path);
|
|
||||||
}
|
|
||||||
|
|
||||||
- (void)clearCache:(id)sender
|
|
||||||
{
|
|
||||||
[self debugRequest:"clear-cache" argument:""];
|
|
||||||
}
|
|
||||||
|
|
||||||
- (void)toggleScripting:(id)sender
|
|
||||||
{
|
|
||||||
m_settings.scripting_enabled = !m_settings.scripting_enabled;
|
|
||||||
[self setScripting:m_settings.scripting_enabled];
|
|
||||||
}
|
|
||||||
|
|
||||||
- (void)setScripting:(BOOL)enabled
|
|
||||||
{
|
|
||||||
[self debugRequest:"scripting" argument:enabled ? "on" : "off"];
|
|
||||||
}
|
|
||||||
|
|
||||||
- (void)togglePopupBlocking:(id)sender
|
|
||||||
{
|
|
||||||
m_settings.block_popups = !m_settings.block_popups;
|
|
||||||
[self setPopupBlocking:m_settings.block_popups];
|
|
||||||
}
|
|
||||||
|
|
||||||
- (void)setPopupBlocking:(BOOL)block_popups
|
|
||||||
{
|
|
||||||
[self debugRequest:"block-pop-ups" argument:block_popups ? "on" : "off"];
|
|
||||||
}
|
|
||||||
|
|
||||||
- (void)setUserAgentSpoof:(NSMenuItem*)sender
|
|
||||||
{
|
|
||||||
ByteString const user_agent_name = [[sender title] UTF8String];
|
|
||||||
ByteString user_agent = "";
|
|
||||||
if (user_agent_name == "Disabled"sv) {
|
|
||||||
user_agent = Web::default_user_agent;
|
|
||||||
} else {
|
|
||||||
user_agent = WebView::user_agents.get(user_agent_name).value();
|
|
||||||
}
|
|
||||||
m_settings.user_agent_name = user_agent_name;
|
|
||||||
|
|
||||||
[self debugRequest:"spoof-user-agent" argument:user_agent];
|
|
||||||
[self debugRequest:"clear-cache" argument:""]; // clear the cache to ensure requests are re-done with the new user agent
|
|
||||||
}
|
|
||||||
|
|
||||||
- (void)setNavigatorCompatibilityMode:(NSMenuItem*)sender
|
|
||||||
{
|
|
||||||
ByteString const compatibility_mode = [[[sender title] lowercaseString] UTF8String];
|
|
||||||
m_settings.navigator_compatibility_mode = compatibility_mode;
|
|
||||||
|
|
||||||
[self debugRequest:"navigator-compatibility-mode" argument:compatibility_mode];
|
|
||||||
}
|
|
||||||
|
|
||||||
#pragma mark - Properties
|
#pragma mark - Properties
|
||||||
|
|
||||||
- (NSButton*)create_button:(NSImageName)image
|
- (NSButton*)create_button:(NSImageName)image
|
||||||
|
@ -605,23 +464,6 @@ static NSString* const TOOLBAR_TAB_OVERVIEW_IDENTIFIER = @"ToolbarTabOverviewIde
|
||||||
[[[self tab] web_view] handleDisplayRefreshRateChange];
|
[[[self tab] web_view] handleDisplayRefreshRateChange];
|
||||||
}
|
}
|
||||||
|
|
||||||
- (BOOL)validateMenuItem:(NSMenuItem*)item
|
|
||||||
{
|
|
||||||
if ([item action] == @selector(toggleLineBoxBorders:)) {
|
|
||||||
[item setState:m_settings.should_show_line_box_borders ? NSControlStateValueOn : NSControlStateValueOff];
|
|
||||||
} else if ([item action] == @selector(toggleScripting:)) {
|
|
||||||
[item setState:m_settings.scripting_enabled ? NSControlStateValueOn : NSControlStateValueOff];
|
|
||||||
} else if ([item action] == @selector(togglePopupBlocking:)) {
|
|
||||||
[item setState:m_settings.block_popups ? NSControlStateValueOn : NSControlStateValueOff];
|
|
||||||
} else if ([item action] == @selector(setUserAgentSpoof:)) {
|
|
||||||
[item setState:(m_settings.user_agent_name == [[item title] UTF8String]) ? NSControlStateValueOn : NSControlStateValueOff];
|
|
||||||
} else if ([item action] == @selector(setNavigatorCompatibilityMode:)) {
|
|
||||||
[item setState:(m_settings.navigator_compatibility_mode == [[[item title] lowercaseString] UTF8String]) ? NSControlStateValueOn : NSControlStateValueOff];
|
|
||||||
}
|
|
||||||
|
|
||||||
return YES;
|
|
||||||
}
|
|
||||||
|
|
||||||
#pragma mark - NSToolbarDelegate
|
#pragma mark - NSToolbarDelegate
|
||||||
|
|
||||||
- (NSToolbarItem*)toolbar:(NSToolbar*)toolbar
|
- (NSToolbarItem*)toolbar:(NSToolbar*)toolbar
|
||||||
|
|
|
@ -12,10 +12,7 @@
|
||||||
#include <LibWeb/CSS/PreferredColorScheme.h>
|
#include <LibWeb/CSS/PreferredColorScheme.h>
|
||||||
#include <LibWeb/CSS/PreferredContrast.h>
|
#include <LibWeb/CSS/PreferredContrast.h>
|
||||||
#include <LibWeb/CSS/PreferredMotion.h>
|
#include <LibWeb/CSS/PreferredMotion.h>
|
||||||
#include <LibWeb/Loader/UserAgent.h>
|
|
||||||
#include <LibWebView/Application.h>
|
#include <LibWebView/Application.h>
|
||||||
#include <LibWebView/CookieJar.h>
|
|
||||||
#include <LibWebView/UserAgent.h>
|
|
||||||
#include <UI/Qt/Application.h>
|
#include <UI/Qt/Application.h>
|
||||||
#include <UI/Qt/BrowserWindow.h>
|
#include <UI/Qt/BrowserWindow.h>
|
||||||
#include <UI/Qt/Icon.h>
|
#include <UI/Qt/Icon.h>
|
||||||
|
@ -351,238 +348,10 @@ BrowserWindow::BrowserWindow(Vector<URL::URL> const& initial_urls, IsPopupWindow
|
||||||
new_tab_from_url(URL::URL::about("processes"_string), Web::HTML::ActivateTab::Yes);
|
new_tab_from_url(URL::URL::about("processes"_string), Web::HTML::ActivateTab::Yes);
|
||||||
});
|
});
|
||||||
|
|
||||||
auto* debug_menu = m_hamburger_menu->addMenu("&Debug");
|
auto* debug_menu = create_application_menu(*m_hamburger_menu, Application::the().debug_menu());
|
||||||
|
m_hamburger_menu->addMenu(debug_menu);
|
||||||
menuBar()->addMenu(debug_menu);
|
menuBar()->addMenu(debug_menu);
|
||||||
|
|
||||||
auto* dump_session_history_tree_action = new QAction("Dump Session History Tree", this);
|
|
||||||
dump_session_history_tree_action->setIcon(load_icon_from_uri("resource://icons/16x16/history.png"sv));
|
|
||||||
debug_menu->addAction(dump_session_history_tree_action);
|
|
||||||
QObject::connect(dump_session_history_tree_action, &QAction::triggered, this, [this] {
|
|
||||||
debug_request("dump-session-history");
|
|
||||||
});
|
|
||||||
|
|
||||||
auto* dump_dom_tree_action = new QAction("Dump &DOM Tree", this);
|
|
||||||
dump_dom_tree_action->setIcon(load_icon_from_uri("resource://icons/browser/dom-tree.png"sv));
|
|
||||||
debug_menu->addAction(dump_dom_tree_action);
|
|
||||||
QObject::connect(dump_dom_tree_action, &QAction::triggered, this, [this] {
|
|
||||||
debug_request("dump-dom-tree");
|
|
||||||
});
|
|
||||||
|
|
||||||
auto* dump_layout_tree_action = new QAction("Dump &Layout Tree", this);
|
|
||||||
dump_layout_tree_action->setIcon(load_icon_from_uri("resource://icons/16x16/layout.png"sv));
|
|
||||||
debug_menu->addAction(dump_layout_tree_action);
|
|
||||||
QObject::connect(dump_layout_tree_action, &QAction::triggered, this, [this] {
|
|
||||||
debug_request("dump-layout-tree");
|
|
||||||
});
|
|
||||||
|
|
||||||
auto* dump_paint_tree_action = new QAction("Dump &Paint Tree", this);
|
|
||||||
dump_paint_tree_action->setIcon(load_icon_from_uri("resource://icons/16x16/layout.png"sv));
|
|
||||||
debug_menu->addAction(dump_paint_tree_action);
|
|
||||||
QObject::connect(dump_paint_tree_action, &QAction::triggered, this, [this] {
|
|
||||||
debug_request("dump-paint-tree");
|
|
||||||
});
|
|
||||||
|
|
||||||
auto* dump_stacking_context_tree_action = new QAction("Dump S&tacking Context Tree", this);
|
|
||||||
dump_stacking_context_tree_action->setIcon(load_icon_from_uri("resource://icons/16x16/layers.png"sv));
|
|
||||||
debug_menu->addAction(dump_stacking_context_tree_action);
|
|
||||||
QObject::connect(dump_stacking_context_tree_action, &QAction::triggered, this, [this] {
|
|
||||||
debug_request("dump-stacking-context-tree");
|
|
||||||
});
|
|
||||||
|
|
||||||
auto* dump_display_list = new QAction("Dump Display List", this);
|
|
||||||
dump_display_list->setIcon(load_icon_from_uri("resource://icons/16x16/layout.png"sv));
|
|
||||||
debug_menu->addAction(dump_display_list);
|
|
||||||
QObject::connect(dump_display_list, &QAction::triggered, this, [this] {
|
|
||||||
debug_request("dump-display-list");
|
|
||||||
});
|
|
||||||
|
|
||||||
auto* dump_style_sheets_action = new QAction("Dump &Style Sheets", this);
|
|
||||||
dump_style_sheets_action->setIcon(load_icon_from_uri("resource://icons/16x16/filetype-css.png"sv));
|
|
||||||
debug_menu->addAction(dump_style_sheets_action);
|
|
||||||
QObject::connect(dump_style_sheets_action, &QAction::triggered, this, [this] {
|
|
||||||
debug_request("dump-style-sheets");
|
|
||||||
});
|
|
||||||
|
|
||||||
auto* dump_styles_action = new QAction("Dump &All Resolved Styles", this);
|
|
||||||
dump_styles_action->setIcon(load_icon_from_uri("resource://icons/16x16/filetype-css.png"sv));
|
|
||||||
debug_menu->addAction(dump_styles_action);
|
|
||||||
QObject::connect(dump_styles_action, &QAction::triggered, this, [this] {
|
|
||||||
debug_request("dump-all-resolved-styles");
|
|
||||||
});
|
|
||||||
|
|
||||||
auto* dump_css_errors_action = new QAction("Dump CSS &Errors", this);
|
|
||||||
dump_css_errors_action->setIcon(load_icon_from_uri("resource://icons/16x16/error.png"sv));
|
|
||||||
debug_menu->addAction(dump_css_errors_action);
|
|
||||||
QObject::connect(dump_css_errors_action, &QAction::triggered, this, [this] {
|
|
||||||
debug_request("dump-all-css-errors");
|
|
||||||
});
|
|
||||||
|
|
||||||
auto* dump_cookies_action = new QAction("Dump C&ookies", this);
|
|
||||||
dump_cookies_action->setIcon(load_icon_from_uri("resource://icons/browser/cookie.png"sv));
|
|
||||||
debug_menu->addAction(dump_cookies_action);
|
|
||||||
QObject::connect(dump_cookies_action, &QAction::triggered, this, [] {
|
|
||||||
WebView::Application::cookie_jar().dump_cookies();
|
|
||||||
});
|
|
||||||
|
|
||||||
auto* dump_local_storage_action = new QAction("Dump Loc&al Storage", this);
|
|
||||||
dump_local_storage_action->setIcon(load_icon_from_uri("resource://icons/browser/local-storage.png"sv));
|
|
||||||
debug_menu->addAction(dump_local_storage_action);
|
|
||||||
QObject::connect(dump_local_storage_action, &QAction::triggered, this, [this] {
|
|
||||||
debug_request("dump-local-storage");
|
|
||||||
});
|
|
||||||
|
|
||||||
debug_menu->addSeparator();
|
|
||||||
|
|
||||||
m_show_line_box_borders_action = new QAction("Show Line Box Borders", this);
|
|
||||||
m_show_line_box_borders_action->setCheckable(true);
|
|
||||||
m_show_line_box_borders_action->setIcon(load_icon_from_uri("resource://icons/16x16/box.png"sv));
|
|
||||||
debug_menu->addAction(m_show_line_box_borders_action);
|
|
||||||
QObject::connect(m_show_line_box_borders_action, &QAction::triggered, this, [this] {
|
|
||||||
bool state = m_show_line_box_borders_action->isChecked();
|
|
||||||
for_each_tab([state](auto& tab) {
|
|
||||||
tab.set_line_box_borders(state);
|
|
||||||
});
|
|
||||||
});
|
|
||||||
|
|
||||||
debug_menu->addSeparator();
|
|
||||||
|
|
||||||
auto* collect_garbage_action = new QAction("Collect &Garbage", this);
|
|
||||||
collect_garbage_action->setShortcut(QKeySequence(Qt::CTRL | Qt::SHIFT | Qt::Key_G));
|
|
||||||
collect_garbage_action->setIcon(load_icon_from_uri("resource://icons/16x16/trash-can.png"sv));
|
|
||||||
debug_menu->addAction(collect_garbage_action);
|
|
||||||
QObject::connect(collect_garbage_action, &QAction::triggered, this, [this] {
|
|
||||||
debug_request("collect-garbage");
|
|
||||||
});
|
|
||||||
|
|
||||||
auto* dump_gc_graph_action = new QAction("Dump GC graph", this);
|
|
||||||
debug_menu->addAction(dump_gc_graph_action);
|
|
||||||
QObject::connect(dump_gc_graph_action, &QAction::triggered, this, [this] {
|
|
||||||
if (m_current_tab) {
|
|
||||||
auto gc_graph_path = m_current_tab->view().dump_gc_graph();
|
|
||||||
warnln("\033[33;1mDumped GC-graph into {}"
|
|
||||||
"\033[0m",
|
|
||||||
gc_graph_path);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
auto* clear_cache_action = new QAction("Clear &Cache", this);
|
|
||||||
clear_cache_action->setIcon(load_icon_from_uri("resource://icons/browser/clear-cache.png"sv));
|
|
||||||
debug_menu->addAction(clear_cache_action);
|
|
||||||
QObject::connect(clear_cache_action, &QAction::triggered, this, [this] {
|
|
||||||
debug_request("clear-cache");
|
|
||||||
});
|
|
||||||
|
|
||||||
auto* clear_all_cookies_action = new QAction("Clear All Cookies", this);
|
|
||||||
debug_menu->addAction(clear_all_cookies_action);
|
|
||||||
QObject::connect(clear_all_cookies_action, &QAction::triggered, this, [] {
|
|
||||||
WebView::Application::cookie_jar().clear_all_cookies();
|
|
||||||
});
|
|
||||||
|
|
||||||
auto* spoof_user_agent_menu = debug_menu->addMenu("Spoof &User Agent");
|
|
||||||
spoof_user_agent_menu->setIcon(load_icon_from_uri("resource://icons/16x16/spoof.png"sv));
|
|
||||||
|
|
||||||
auto* user_agent_group = new QActionGroup(this);
|
|
||||||
|
|
||||||
auto add_user_agent = [this, &user_agent_group, &spoof_user_agent_menu](auto name, auto const& user_agent) {
|
|
||||||
auto* action = new QAction(qstring_from_ak_string(name), this);
|
|
||||||
action->setCheckable(true);
|
|
||||||
user_agent_group->addAction(action);
|
|
||||||
spoof_user_agent_menu->addAction(action);
|
|
||||||
QObject::connect(action, &QAction::triggered, this, [this, user_agent] {
|
|
||||||
for_each_tab([user_agent](auto& tab) {
|
|
||||||
tab.set_user_agent_string(user_agent);
|
|
||||||
});
|
|
||||||
set_user_agent_string(user_agent);
|
|
||||||
});
|
|
||||||
return action;
|
|
||||||
};
|
|
||||||
|
|
||||||
auto const& user_agent_preset = WebView::Application::web_content_options().user_agent_preset;
|
|
||||||
set_user_agent_string(user_agent_preset.has_value() ? *WebView::user_agents.get(*user_agent_preset) : Web::default_user_agent);
|
|
||||||
|
|
||||||
auto* disable_spoofing = add_user_agent("Disabled"sv, Web::default_user_agent);
|
|
||||||
disable_spoofing->setChecked(!user_agent_preset.has_value());
|
|
||||||
for (auto const& user_agent : WebView::user_agents) {
|
|
||||||
auto* spoofed_user_agent = add_user_agent(user_agent.key, user_agent.value.to_byte_string());
|
|
||||||
spoofed_user_agent->setChecked(user_agent.key == user_agent_preset);
|
|
||||||
}
|
|
||||||
|
|
||||||
auto* custom_user_agent_action = new QAction("Custom...", this);
|
|
||||||
custom_user_agent_action->setCheckable(true);
|
|
||||||
user_agent_group->addAction(custom_user_agent_action);
|
|
||||||
spoof_user_agent_menu->addAction(custom_user_agent_action);
|
|
||||||
QObject::connect(custom_user_agent_action, &QAction::triggered, this, [this, disable_spoofing] {
|
|
||||||
auto user_agent = QInputDialog::getText(this, "Custom User Agent", "Enter User Agent:");
|
|
||||||
if (!user_agent.isEmpty()) {
|
|
||||||
auto user_agent_byte_string = ak_byte_string_from_qstring(user_agent);
|
|
||||||
for_each_tab([&](auto& tab) {
|
|
||||||
tab.set_user_agent_string(user_agent_byte_string);
|
|
||||||
});
|
|
||||||
set_user_agent_string(user_agent_byte_string);
|
|
||||||
} else {
|
|
||||||
disable_spoofing->activate(QAction::Trigger);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
auto* navigator_compatibility_mode_menu = debug_menu->addMenu("Navigator Compatibility Mode");
|
|
||||||
navigator_compatibility_mode_menu->setIcon(load_icon_from_uri("resource://icons/16x16/spoof.png"sv));
|
|
||||||
|
|
||||||
auto* navigator_compatibility_mode_group = new QActionGroup(this);
|
|
||||||
|
|
||||||
auto add_navigator_compatibility_mode = [this, &navigator_compatibility_mode_group, &navigator_compatibility_mode_menu](auto name, auto const& compatibility_mode) {
|
|
||||||
auto* action = new QAction(qstring_from_ak_string(name), this);
|
|
||||||
action->setCheckable(true);
|
|
||||||
navigator_compatibility_mode_group->addAction(action);
|
|
||||||
navigator_compatibility_mode_menu->addAction(action);
|
|
||||||
QObject::connect(action, &QAction::triggered, this, [this, compatibility_mode] {
|
|
||||||
for_each_tab([compatibility_mode](auto& tab) {
|
|
||||||
tab.set_navigator_compatibility_mode(compatibility_mode);
|
|
||||||
});
|
|
||||||
set_navigator_compatibility_mode(compatibility_mode);
|
|
||||||
});
|
|
||||||
return action;
|
|
||||||
};
|
|
||||||
auto* chrome_compatibility_mode = add_navigator_compatibility_mode("Chrome"_string, "chrome"sv.to_byte_string());
|
|
||||||
chrome_compatibility_mode->setChecked(true);
|
|
||||||
add_navigator_compatibility_mode("Gecko"_string, "gecko"sv.to_byte_string());
|
|
||||||
add_navigator_compatibility_mode("WebKit"_string, "webkit"sv.to_byte_string());
|
|
||||||
set_navigator_compatibility_mode("chrome");
|
|
||||||
|
|
||||||
debug_menu->addSeparator();
|
|
||||||
|
|
||||||
m_enable_scripting_action = new QAction("Enable Scripting", this);
|
|
||||||
m_enable_scripting_action->setCheckable(true);
|
|
||||||
m_enable_scripting_action->setChecked(browser_options.disable_scripting == WebView::DisableScripting::No);
|
|
||||||
debug_menu->addAction(m_enable_scripting_action);
|
|
||||||
QObject::connect(m_enable_scripting_action, &QAction::triggered, this, [this] {
|
|
||||||
bool state = m_enable_scripting_action->isChecked();
|
|
||||||
for_each_tab([state](auto& tab) {
|
|
||||||
tab.set_scripting(state);
|
|
||||||
});
|
|
||||||
});
|
|
||||||
|
|
||||||
m_enable_content_filtering_action = new QAction("Enable Content Filtering", this);
|
|
||||||
m_enable_content_filtering_action->setCheckable(true);
|
|
||||||
m_enable_content_filtering_action->setChecked(true);
|
|
||||||
debug_menu->addAction(m_enable_content_filtering_action);
|
|
||||||
QObject::connect(m_enable_content_filtering_action, &QAction::triggered, this, [this] {
|
|
||||||
bool const state = m_enable_content_filtering_action->isChecked();
|
|
||||||
for_each_tab([state](auto& tab) {
|
|
||||||
tab.set_content_filtering(state);
|
|
||||||
});
|
|
||||||
});
|
|
||||||
|
|
||||||
m_block_pop_ups_action = new QAction("Block Pop-ups", this);
|
|
||||||
m_block_pop_ups_action->setCheckable(true);
|
|
||||||
m_block_pop_ups_action->setChecked(browser_options.allow_popups == WebView::AllowPopups::No);
|
|
||||||
debug_menu->addAction(m_block_pop_ups_action);
|
|
||||||
QObject::connect(m_block_pop_ups_action, &QAction::triggered, this, [this] {
|
|
||||||
bool state = m_block_pop_ups_action->isChecked();
|
|
||||||
for_each_tab([state](auto& tab) {
|
|
||||||
tab.set_block_popups(state);
|
|
||||||
});
|
|
||||||
});
|
|
||||||
|
|
||||||
auto* help_menu = m_hamburger_menu->addMenu("&Help");
|
auto* help_menu = m_hamburger_menu->addMenu("&Help");
|
||||||
menuBar()->addMenu(help_menu);
|
menuBar()->addMenu(help_menu);
|
||||||
|
|
||||||
|
@ -686,13 +455,6 @@ void BrowserWindow::set_current_tab(Tab* tab)
|
||||||
update_displayed_zoom_level();
|
update_displayed_zoom_level();
|
||||||
}
|
}
|
||||||
|
|
||||||
void BrowserWindow::debug_request(ByteString const& request, ByteString const& argument)
|
|
||||||
{
|
|
||||||
if (!m_current_tab)
|
|
||||||
return;
|
|
||||||
m_current_tab->debug_request(request, argument);
|
|
||||||
}
|
|
||||||
|
|
||||||
Tab& BrowserWindow::new_tab_from_url(URL::URL const& url, Web::HTML::ActivateTab activate_tab)
|
Tab& BrowserWindow::new_tab_from_url(URL::URL const& url, Web::HTML::ActivateTab activate_tab)
|
||||||
{
|
{
|
||||||
auto& tab = create_new_tab(activate_tab);
|
auto& tab = create_new_tab(activate_tab);
|
||||||
|
@ -797,12 +559,6 @@ void BrowserWindow::initialize_tab(Tab* tab)
|
||||||
m_tabs_container->setTabIcon(m_tabs_container->indexOf(tab), tab->favicon());
|
m_tabs_container->setTabIcon(m_tabs_container->indexOf(tab), tab->favicon());
|
||||||
create_close_button_for_tab(tab);
|
create_close_button_for_tab(tab);
|
||||||
|
|
||||||
tab->set_line_box_borders(m_show_line_box_borders_action->isChecked());
|
|
||||||
tab->set_scripting(m_enable_scripting_action->isChecked());
|
|
||||||
tab->set_content_filtering(m_enable_content_filtering_action->isChecked());
|
|
||||||
tab->set_block_popups(m_block_pop_ups_action->isChecked());
|
|
||||||
tab->set_user_agent_string(user_agent_string());
|
|
||||||
tab->set_navigator_compatibility_mode(navigator_compatibility_mode());
|
|
||||||
tab->view().set_preferred_color_scheme(m_preferred_color_scheme);
|
tab->view().set_preferred_color_scheme(m_preferred_color_scheme);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -94,8 +94,6 @@ private:
|
||||||
Tab& create_new_tab(Web::HTML::ActivateTab, Tab& parent, Optional<u64> page_index);
|
Tab& create_new_tab(Web::HTML::ActivateTab, Tab& parent, Optional<u64> page_index);
|
||||||
void initialize_tab(Tab*);
|
void initialize_tab(Tab*);
|
||||||
|
|
||||||
void debug_request(ByteString const& request, ByteString const& argument = "");
|
|
||||||
|
|
||||||
void set_current_tab(Tab* tab);
|
void set_current_tab(Tab* tab);
|
||||||
|
|
||||||
template<typename Callback>
|
template<typename Callback>
|
||||||
|
@ -115,11 +113,6 @@ private:
|
||||||
|
|
||||||
void set_window_rect(Optional<Web::DevicePixels> x, Optional<Web::DevicePixels> y, Optional<Web::DevicePixels> width, Optional<Web::DevicePixels> height);
|
void set_window_rect(Optional<Web::DevicePixels> x, Optional<Web::DevicePixels> y, Optional<Web::DevicePixels> width, Optional<Web::DevicePixels> height);
|
||||||
|
|
||||||
ByteString user_agent_string() const { return m_user_agent_string; }
|
|
||||||
void set_user_agent_string(ByteString const& user_agent_string) { m_user_agent_string = user_agent_string; }
|
|
||||||
ByteString navigator_compatibility_mode() const { return m_navigator_compatibility_mode; }
|
|
||||||
void set_navigator_compatibility_mode(ByteString const& navigator_compatibility_mode) { m_navigator_compatibility_mode = navigator_compatibility_mode; }
|
|
||||||
|
|
||||||
QScreen* m_current_screen { nullptr };
|
QScreen* m_current_screen { nullptr };
|
||||||
double m_device_pixel_ratio { 0 };
|
double m_device_pixel_ratio { 0 };
|
||||||
double m_refresh_rate { 60.0 };
|
double m_refresh_rate { 60.0 };
|
||||||
|
@ -142,13 +135,6 @@ private:
|
||||||
QAction* m_new_window_action { nullptr };
|
QAction* m_new_window_action { nullptr };
|
||||||
QAction* m_find_in_page_action { nullptr };
|
QAction* m_find_in_page_action { nullptr };
|
||||||
QAction* m_enable_devtools_action { nullptr };
|
QAction* m_enable_devtools_action { nullptr };
|
||||||
QAction* m_show_line_box_borders_action { nullptr };
|
|
||||||
QAction* m_enable_scripting_action { nullptr };
|
|
||||||
QAction* m_enable_content_filtering_action { nullptr };
|
|
||||||
QAction* m_block_pop_ups_action { nullptr };
|
|
||||||
|
|
||||||
ByteString m_user_agent_string {};
|
|
||||||
ByteString m_navigator_compatibility_mode {};
|
|
||||||
|
|
||||||
IsPopupWindow m_is_popup_window { IsPopupWindow::No };
|
IsPopupWindow m_is_popup_window { IsPopupWindow::No };
|
||||||
};
|
};
|
||||||
|
|
|
@ -149,6 +149,44 @@ static void initialize_native_control(WebView::Action& action, QAction& qaction,
|
||||||
qaction.setIcon(load_icon_from_uri("resource://icons/16x16/audio-volume-high.png"sv));
|
qaction.setIcon(load_icon_from_uri("resource://icons/16x16/audio-volume-high.png"sv));
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
case WebView::ActionID::DumpSessionHistoryTree:
|
||||||
|
qaction.setIcon(load_icon_from_uri("resource://icons/16x16/history.png"sv));
|
||||||
|
break;
|
||||||
|
case WebView::ActionID::DumpDOMTree:
|
||||||
|
qaction.setIcon(load_icon_from_uri("resource://icons/browser/dom-tree.png"sv));
|
||||||
|
break;
|
||||||
|
case WebView::ActionID::DumpLayoutTree:
|
||||||
|
case WebView::ActionID::DumpPaintTree:
|
||||||
|
case WebView::ActionID::DumpDisplayList:
|
||||||
|
qaction.setIcon(load_icon_from_uri("resource://icons/16x16/layout.png"sv));
|
||||||
|
break;
|
||||||
|
case WebView::ActionID::DumpStackingContextTree:
|
||||||
|
qaction.setIcon(load_icon_from_uri("resource://icons/16x16/layers.png"sv));
|
||||||
|
break;
|
||||||
|
case WebView::ActionID::DumpStyleSheets:
|
||||||
|
case WebView::ActionID::DumpStyles:
|
||||||
|
qaction.setIcon(load_icon_from_uri("resource://icons/16x16/filetype-css.png"sv));
|
||||||
|
break;
|
||||||
|
case WebView::ActionID::DumpCSSErrors:
|
||||||
|
qaction.setIcon(load_icon_from_uri("resource://icons/16x16/error.png"sv));
|
||||||
|
break;
|
||||||
|
case WebView::ActionID::DumpCookies:
|
||||||
|
qaction.setIcon(load_icon_from_uri("resource://icons/browser/cookie.png"sv));
|
||||||
|
break;
|
||||||
|
case WebView::ActionID::DumpLocalStorage:
|
||||||
|
qaction.setIcon(load_icon_from_uri("resource://icons/browser/local-storage.png"sv));
|
||||||
|
break;
|
||||||
|
case WebView::ActionID::ShowLineBoxBorders:
|
||||||
|
qaction.setIcon(load_icon_from_uri("resource://icons/16x16/box.png"sv));
|
||||||
|
break;
|
||||||
|
case WebView::ActionID::CollectGarbage:
|
||||||
|
qaction.setIcon(load_icon_from_uri("resource://icons/16x16/trash-can.png"sv));
|
||||||
|
qaction.setShortcut(QKeySequence(Qt::CTRL | Qt::SHIFT | Qt::Key_G));
|
||||||
|
break;
|
||||||
|
case WebView::ActionID::ClearCache:
|
||||||
|
qaction.setIcon(load_icon_from_uri("resource://icons/browser/clear-cache.png"sv));
|
||||||
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -166,6 +204,11 @@ static void add_items_to_menu(QMenu& menu, QWidget& parent, Span<WebView::Menu::
|
||||||
[&](NonnullRefPtr<WebView::Action>& action) {
|
[&](NonnullRefPtr<WebView::Action>& action) {
|
||||||
auto* qaction = create_application_action(parent, action);
|
auto* qaction = create_application_action(parent, action);
|
||||||
menu.addAction(qaction);
|
menu.addAction(qaction);
|
||||||
|
|
||||||
|
if (action->id() == WebView::ActionID::SpoofUserAgent || action->id() == WebView::ActionID::NavigatorCompatibilityMode) {
|
||||||
|
if (menu.icon().isNull())
|
||||||
|
menu.setIcon(load_icon_from_uri("resource://icons/16x16/spoof.png"sv));
|
||||||
|
}
|
||||||
},
|
},
|
||||||
[&](NonnullRefPtr<WebView::Menu> const& submenu) {
|
[&](NonnullRefPtr<WebView::Menu> const& submenu) {
|
||||||
auto* qsubmenu = new QMenu(qstring_from_ak_string(submenu->title()), &menu);
|
auto* qsubmenu = new QMenu(qstring_from_ak_string(submenu->title()), &menu);
|
||||||
|
|
|
@ -523,11 +523,6 @@ int Tab::tab_index()
|
||||||
return m_window->tab_index(this);
|
return m_window->tab_index(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
void Tab::debug_request(ByteString const& request, ByteString const& argument)
|
|
||||||
{
|
|
||||||
m_view->debug_request(request, argument);
|
|
||||||
}
|
|
||||||
|
|
||||||
void Tab::resizeEvent(QResizeEvent* event)
|
void Tab::resizeEvent(QResizeEvent* event)
|
||||||
{
|
{
|
||||||
QWidget::resizeEvent(event);
|
QWidget::resizeEvent(event);
|
||||||
|
@ -587,36 +582,4 @@ void Tab::find_next()
|
||||||
m_find_in_page->find_next();
|
m_find_in_page->find_next();
|
||||||
}
|
}
|
||||||
|
|
||||||
void Tab::set_block_popups(bool enabled)
|
|
||||||
{
|
|
||||||
debug_request("block-pop-ups", enabled ? "on" : "off");
|
|
||||||
}
|
|
||||||
|
|
||||||
void Tab::set_line_box_borders(bool enabled)
|
|
||||||
{
|
|
||||||
debug_request("set-line-box-borders", enabled ? "on" : "off");
|
|
||||||
}
|
|
||||||
|
|
||||||
void Tab::set_scripting(bool enabled)
|
|
||||||
{
|
|
||||||
debug_request("scripting", enabled ? "on" : "off");
|
|
||||||
}
|
|
||||||
|
|
||||||
void Tab::set_content_filtering(bool const enabled)
|
|
||||||
{
|
|
||||||
debug_request("content-filtering", enabled ? "on" : "off");
|
|
||||||
}
|
|
||||||
|
|
||||||
void Tab::set_user_agent_string(ByteString const& user_agent)
|
|
||||||
{
|
|
||||||
debug_request("spoof-user-agent", user_agent);
|
|
||||||
// Clear the cache to ensure requests are re-done with the new user agent.
|
|
||||||
debug_request("clear-cache");
|
|
||||||
}
|
|
||||||
|
|
||||||
void Tab::set_navigator_compatibility_mode(ByteString const& compatibility_mode)
|
|
||||||
{
|
|
||||||
debug_request("navigator-compatibility-mode", compatibility_mode);
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -55,8 +55,6 @@ public:
|
||||||
void navigate(URL::URL const&);
|
void navigate(URL::URL const&);
|
||||||
void load_html(StringView);
|
void load_html(StringView);
|
||||||
|
|
||||||
void debug_request(ByteString const& request, ByteString const& argument = "");
|
|
||||||
|
|
||||||
void open_file();
|
void open_file();
|
||||||
void update_reset_zoom_button();
|
void update_reset_zoom_button();
|
||||||
|
|
||||||
|
@ -73,13 +71,6 @@ public:
|
||||||
|
|
||||||
void update_hover_label();
|
void update_hover_label();
|
||||||
|
|
||||||
void set_block_popups(bool);
|
|
||||||
void set_line_box_borders(bool);
|
|
||||||
void set_scripting(bool);
|
|
||||||
void set_content_filtering(bool);
|
|
||||||
void set_user_agent_string(ByteString const&);
|
|
||||||
void set_navigator_compatibility_mode(ByteString const&);
|
|
||||||
|
|
||||||
bool url_is_hidden() const { return m_location_edit->url_is_hidden(); }
|
bool url_is_hidden() const { return m_location_edit->url_is_hidden(); }
|
||||||
void set_url_is_hidden(bool url_is_hidden) { m_location_edit->set_url_is_hidden(url_is_hidden); }
|
void set_url_is_hidden(bool url_is_hidden) { m_location_edit->set_url_is_hidden(url_is_hidden); }
|
||||||
|
|
||||||
|
|
|
@ -112,8 +112,6 @@ private:
|
||||||
Optional<ByteString> m_tooltip_text;
|
Optional<ByteString> m_tooltip_text;
|
||||||
QTimer m_tooltip_hover_timer;
|
QTimer m_tooltip_hover_timer;
|
||||||
|
|
||||||
bool m_should_show_line_box_borders { false };
|
|
||||||
|
|
||||||
Gfx::IntSize m_viewport_size;
|
Gfx::IntSize m_viewport_size;
|
||||||
|
|
||||||
QMenu* m_select_dropdown { nullptr };
|
QMenu* m_select_dropdown { nullptr };
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue