Browser+Ladybird+LibWebView: Handle trivial content APIs in LibWebView

The goal here is to reduce the amount of WebContent client APIs that are
duplicated across every ViewImplementation. Across our three browsers,
we currently:

    Ladybird - Mix some AK::Function callbacks and Qt signals to notify
    tabs of WebContent events.

    Browser - Use only AK::Function callbacks.

    headless-browser - Drop most events on the floor.

Instead, let's only use AK::Function callbacks across all three browsers
to propagate events to tabs. This allows us to invoke those callbacks
directly from LibWebView instead of all three browsers needing to define
a trivial `if (callback) callback();` override of a LibWebView virtual
function. For headless-browser, we can simply not set these callbacks.

As a first pass, this only converts WebContent events that are trivial
to this approach. That is, events that were simply passed onto the tab
or handled without much fuss.
This commit is contained in:
Timothy Flynn 2023-05-17 12:37:31 -04:00 committed by Andreas Kling
parent c113d780c6
commit 6970f1b6c1
Notes: sideshowbarker 2024-07-17 08:34:29 +09:00
10 changed files with 236 additions and 799 deletions

View file

@ -97,36 +97,33 @@ Tab::Tab(BrowserWindow* window, StringView webdriver_content_ipc_path, WebView::
update_reset_zoom_button();
});
QObject::connect(m_view, &WebContentView::link_unhovered, [this] {
m_hover_label->hide();
});
QObject::connect(m_view, &WebContentView::activate_tab, [this] {
view().on_activate_tab = [this] {
m_window->activate_tab(tab_index());
});
};
QObject::connect(m_view, &WebContentView::close, [this] {
view().on_close = [this] {
m_window->close_tab(tab_index());
});
};
QObject::connect(m_view, &WebContentView::link_hovered, [this](QString const& title) {
m_hover_label->setText(title);
view().on_link_hover = [this](auto const& url) {
m_hover_label->setText(qstring_from_ak_deprecated_string(url.to_deprecated_string()));
update_hover_label();
m_hover_label->show();
});
QObject::connect(m_view, &WebContentView::link_unhovered, [this] {
};
view().on_link_unhover = [this]() {
m_hover_label->hide();
});
};
QObject::connect(m_view, &WebContentView::back_mouse_button, [this] {
view().on_back_button = [this] {
back();
});
};
QObject::connect(m_view, &WebContentView::forward_mouse_button, [this] {
view().on_forward_button = [this] {
forward();
});
};
QObject::connect(m_view, &WebContentView::load_started, [this](const URL& url, bool is_redirect) {
view().on_load_start = [this](const URL& url, bool is_redirect) {
// If we are loading due to a redirect, we replace the current history entry
// with the loaded URL
if (is_redirect) {
@ -150,7 +147,7 @@ Tab::Tab(BrowserWindow* window, StringView webdriver_content_ipc_path, WebView::
if (m_console_widget)
m_console_widget->reset();
});
};
view().on_load_finish = [this](auto&) {
if (m_inspector_widget != nullptr && m_inspector_widget->isVisible()) {
@ -160,45 +157,76 @@ Tab::Tab(BrowserWindow* window, StringView webdriver_content_ipc_path, WebView::
};
QObject::connect(m_location_edit, &QLineEdit::returnPressed, this, &Tab::location_edit_return_pressed);
QObject::connect(m_view, &WebContentView::title_changed, this, &Tab::page_title_changed);
QObject::connect(m_view, &WebContentView::favicon_changed, this, &Tab::page_favicon_changed);
view().on_title_change = [this](auto const& title) {
m_title = qstring_from_ak_deprecated_string(title);
m_history.update_title(title);
emit title_changed(tab_index(), m_title);
};
view().on_favicon_change = [this](auto const& bitmap) {
auto qimage = QImage(bitmap.scanline_u8(0), bitmap.width(), bitmap.height(), QImage::Format_ARGB32);
if (qimage.isNull())
return;
auto qpixmap = QPixmap::fromImage(qimage);
if (qpixmap.isNull())
return;
emit favicon_changed(tab_index(), QIcon(qpixmap));
};
QObject::connect(focus_location_editor_action, &QAction::triggered, this, &Tab::focus_location_editor);
QObject::connect(m_view, &WebContentView::got_source, this, [this](AK::URL, QString const& source) {
view().on_get_source = [this](auto const& url, auto const& source) {
auto* text_edit = new QPlainTextEdit(this);
text_edit->setWindowFlags(Qt::Window);
text_edit->setFont(QFontDatabase::systemFont(QFontDatabase::SystemFont::FixedFont));
text_edit->resize(800, 600);
text_edit->setPlainText(source);
text_edit->setWindowTitle(qstring_from_ak_deprecated_string(url.to_deprecated_string()));
text_edit->setPlainText(qstring_from_ak_deprecated_string(source));
text_edit->show();
});
};
QObject::connect(m_view, &WebContentView::navigate_back, this, &Tab::back);
QObject::connect(m_view, &WebContentView::navigate_forward, this, &Tab::forward);
QObject::connect(m_view, &WebContentView::refresh, this, &Tab::reload);
QObject::connect(m_view, &WebContentView::restore_window, this, [this]() {
view().on_navigate_back = [this]() {
back();
};
view().on_navigate_forward = [this]() {
forward();
};
view().on_refresh = [this]() {
reload();
};
view().on_restore_window = [this]() {
m_window->showNormal();
});
QObject::connect(m_view, &WebContentView::reposition_window, this, [this](auto const& position) {
};
view().on_reposition_window = [this](auto const& position) {
m_window->move(position.x(), position.y());
return Gfx::IntPoint { m_window->x(), m_window->y() };
});
QObject::connect(m_view, &WebContentView::resize_window, this, [this](auto const& size) {
};
view().on_resize_window = [this](auto const& size) {
m_window->resize(size.width(), size.height());
return Gfx::IntSize { m_window->width(), m_window->height() };
});
QObject::connect(m_view, &WebContentView::maximize_window, this, [this]() {
};
view().on_maximize_window = [this]() {
m_window->showMaximized();
return Gfx::IntRect { m_window->x(), m_window->y(), m_window->width(), m_window->height() };
});
QObject::connect(m_view, &WebContentView::minimize_window, this, [this]() {
};
view().on_minimize_window = [this]() {
m_window->showMinimized();
return Gfx::IntRect { m_window->x(), m_window->y(), m_window->width(), m_window->height() };
});
QObject::connect(m_view, &WebContentView::fullscreen_window, this, [this]() {
};
view().on_fullscreen_window = [this]() {
m_window->showFullScreen();
return Gfx::IntRect { m_window->x(), m_window->y(), m_window->width(), m_window->height() };
});
};
view().on_get_dom_tree = [this](auto& dom_tree) {
if (m_inspector_widget)
@ -492,18 +520,6 @@ void Tab::location_edit_return_pressed()
navigate(m_location_edit->text());
}
void Tab::page_title_changed(QString title)
{
m_title = title;
m_history.update_title(ak_deprecated_string_from_qstring(m_title));
emit title_changed(tab_index(), std::move(title));
}
void Tab::page_favicon_changed(QIcon icon)
{
emit favicon_changed(tab_index(), std::move(icon));
}
int Tab::tab_index()
{
return m_window->tab_index(this);

View file

@ -37,6 +37,9 @@ public:
HistoryNavigation,
};
void navigate(QString, LoadType = LoadType::Normal);
void back();
void forward();
void reload();
void debug_request(DeprecatedString const& request, DeprecatedString const& argument);
@ -54,11 +57,6 @@ public:
public slots:
void focus_location_editor();
void location_edit_return_pressed();
void page_title_changed(QString);
void page_favicon_changed(QIcon);
void back();
void forward();
void reload();
signals:
void title_changed(int id, QString);

View file

@ -16,7 +16,6 @@
#include <AK/NonnullOwnPtr.h>
#include <AK/StringBuilder.h>
#include <AK/Types.h>
#include <Browser/CookieJar.h>
#include <Kernel/API/KeyCode.h>
#include <LibCore/ArgsParser.h>
#include <LibCore/EventLoop.h>
@ -292,9 +291,11 @@ void WebContentView::mouseReleaseEvent(QMouseEvent* event)
auto button = get_button_from_qt_event(*event);
if (event->button() & Qt::MouseButton::BackButton) {
emit back_mouse_button();
if (on_back_button)
on_back_button();
} else if (event->button() & Qt::MouseButton::ForwardButton) {
emit forward_mouse_button();
if (on_forward_button)
on_forward_button();
}
if (button == 0) {
@ -640,11 +641,6 @@ void WebContentView::notify_server_did_layout(Badge<WebContentClient>, Gfx::IntS
horizontalScrollBar()->setPageStep(m_viewport_rect.width());
}
void WebContentView::notify_server_did_change_title(Badge<WebContentClient>, DeprecatedString const& title)
{
emit title_changed(qstring_from_ak_deprecated_string(title));
}
void WebContentView::notify_server_did_request_scroll(Badge<WebContentClient>, i32 x_delta, i32 y_delta)
{
horizontalScrollBar()->setValue(max(0, horizontalScrollBar()->value() + x_delta));
@ -683,82 +679,6 @@ void WebContentView::notify_server_did_leave_tooltip_area(Badge<WebContentClient
QToolTip::hideText();
}
void WebContentView::notify_server_did_hover_link(Badge<WebContentClient>, AK::URL const& url)
{
emit link_hovered(qstring_from_ak_deprecated_string(url.to_deprecated_string()));
}
void WebContentView::notify_server_did_unhover_link(Badge<WebContentClient>)
{
emit link_unhovered();
}
void WebContentView::notify_server_did_click_link(Badge<WebContentClient>, AK::URL const& url, DeprecatedString const& target, unsigned int modifiers)
{
if (on_link_click) {
on_link_click(url, target, modifiers);
}
}
void WebContentView::notify_server_did_middle_click_link(Badge<WebContentClient>, AK::URL const& url, DeprecatedString const& target, unsigned int modifiers)
{
if (on_link_middle_click) {
on_link_middle_click(url, target, modifiers);
}
}
void WebContentView::notify_server_did_start_loading(Badge<WebContentClient>, AK::URL const& url, bool is_redirect)
{
m_url = url;
emit load_started(url, is_redirect);
}
void WebContentView::notify_server_did_finish_loading(Badge<WebContentClient>, AK::URL const& url)
{
m_url = url;
if (on_load_finish)
on_load_finish(url);
}
void WebContentView::notify_server_did_request_navigate_back(Badge<WebContentClient>)
{
emit navigate_back();
}
void WebContentView::notify_server_did_request_navigate_forward(Badge<WebContentClient>)
{
emit navigate_forward();
}
void WebContentView::notify_server_did_request_refresh(Badge<WebContentClient>)
{
emit refresh();
}
void WebContentView::notify_server_did_request_context_menu(Badge<WebContentClient>, Gfx::IntPoint content_position)
{
if (on_context_menu_request)
on_context_menu_request(to_widget_position(content_position));
}
void WebContentView::notify_server_did_request_link_context_menu(Badge<WebContentClient>, Gfx::IntPoint content_position, AK::URL const& url, DeprecatedString const&, unsigned)
{
if (on_link_context_menu_request)
on_link_context_menu_request(url, to_widget_position(content_position));
}
void WebContentView::notify_server_did_request_image_context_menu(Badge<WebContentClient>, Gfx::IntPoint content_position, AK::URL const& url, DeprecatedString const&, unsigned, Gfx::ShareableBitmap const& bitmap)
{
if (on_image_context_menu_request)
on_image_context_menu_request(url, to_widget_position(content_position), bitmap);
}
void WebContentView::notify_server_did_request_video_context_menu(Badge<WebContentClient>, Gfx::IntPoint content_position, AK::URL const& url, DeprecatedString const&, unsigned, bool is_playing, bool has_user_agent_controls, bool is_looping)
{
if (on_video_context_menu_request)
on_video_context_menu_request(url, to_widget_position(content_position), is_playing, has_user_agent_controls, is_looping);
}
void WebContentView::notify_server_did_request_alert(Badge<WebContentClient>, String const& message)
{
m_dialog = new QMessageBox(QMessageBox::Icon::Warning, "Ladybird", qstring_from_ak_string(message), QMessageBox::StandardButton::Ok, this);
@ -812,132 +732,6 @@ void WebContentView::notify_server_did_request_dismiss_dialog(Badge<WebContentCl
m_dialog->reject();
}
void WebContentView::notify_server_did_get_source(AK::URL const& url, DeprecatedString const& source)
{
emit got_source(url, qstring_from_ak_deprecated_string(source));
}
void WebContentView::notify_server_did_get_dom_tree(DeprecatedString const& dom_tree)
{
if (on_get_dom_tree)
on_get_dom_tree(dom_tree);
}
void WebContentView::notify_server_did_get_dom_node_properties(i32 node_id, DeprecatedString const& specified_style, DeprecatedString const& computed_style, DeprecatedString const& custom_properties, DeprecatedString const& node_box_sizing)
{
if (on_get_dom_node_properties)
on_get_dom_node_properties(node_id, specified_style, computed_style, custom_properties, node_box_sizing);
}
void WebContentView::notify_server_did_output_js_console_message(i32 message_index)
{
if (on_js_console_new_message)
on_js_console_new_message(message_index);
}
void WebContentView::notify_server_did_get_js_console_messages(i32 start_index, Vector<DeprecatedString> const& message_types, Vector<DeprecatedString> const& messages)
{
if (on_get_js_console_messages)
on_get_js_console_messages(start_index, message_types, messages);
}
void WebContentView::notify_server_did_change_favicon(Gfx::Bitmap const& bitmap)
{
auto qimage = QImage(bitmap.scanline_u8(0), bitmap.width(), bitmap.height(), QImage::Format_ARGB32);
if (qimage.isNull())
return;
auto qpixmap = QPixmap::fromImage(qimage);
if (qpixmap.isNull())
return;
emit favicon_changed(QIcon(qpixmap));
}
Vector<Web::Cookie::Cookie> WebContentView::notify_server_did_request_all_cookies(Badge<WebContentClient>, AK::URL const& url)
{
if (on_get_all_cookies)
return on_get_all_cookies(url);
return {};
}
Optional<Web::Cookie::Cookie> WebContentView::notify_server_did_request_named_cookie(Badge<WebContentClient>, AK::URL const& url, DeprecatedString const& name)
{
if (on_get_named_cookie)
return on_get_named_cookie(url, name);
return {};
}
DeprecatedString WebContentView::notify_server_did_request_cookie(Badge<WebContentClient>, AK::URL const& url, Web::Cookie::Source source)
{
if (on_get_cookie)
return on_get_cookie(url, source);
return {};
}
void WebContentView::notify_server_did_set_cookie(Badge<WebContentClient>, AK::URL const& url, Web::Cookie::ParsedCookie const& cookie, Web::Cookie::Source source)
{
if (on_set_cookie)
on_set_cookie(url, cookie, source);
}
void WebContentView::notify_server_did_update_cookie(Badge<WebContentClient>, Web::Cookie::Cookie const& cookie)
{
if (on_update_cookie)
on_update_cookie(cookie);
}
void WebContentView::notify_server_did_close_browsing_context(Badge<WebContentClient>)
{
emit close();
}
String WebContentView::notify_server_did_request_new_tab(Badge<WebContentClient>, Web::HTML::ActivateTab activate_tab)
{
if (on_new_tab)
return on_new_tab(activate_tab);
return {};
}
void WebContentView::notify_server_did_request_activate_tab(Badge<WebContentClient>)
{
emit activate_tab();
}
void WebContentView::notify_server_did_update_resource_count(i32 count_waiting)
{
// FIXME
(void)count_waiting;
}
void WebContentView::notify_server_did_request_restore_window()
{
emit restore_window();
}
Gfx::IntPoint WebContentView::notify_server_did_request_reposition_window(Gfx::IntPoint position)
{
return emit reposition_window(position);
}
Gfx::IntSize WebContentView::notify_server_did_request_resize_window(Gfx::IntSize size)
{
return emit resize_window(size);
}
Gfx::IntRect WebContentView::notify_server_did_request_maximize_window()
{
return emit maximize_window();
}
Gfx::IntRect WebContentView::notify_server_did_request_minimize_window()
{
return emit minimize_window();
}
Gfx::IntRect WebContentView::notify_server_did_request_fullscreen_window()
{
return emit fullscreen_window();
}
void WebContentView::notify_server_did_request_file(Badge<WebContentClient>, DeprecatedString const& path, i32 request_id)
{
auto file = Core::File::open(path, Core::File::OpenMode::Read);
@ -992,12 +786,6 @@ void WebContentView::notify_server_did_finish_handling_input_event(bool event_wa
(void)event_was_accepted;
}
void WebContentView::notify_server_did_get_accessibility_tree(DeprecatedString const& accessibility_tree)
{
if (on_get_accessibility_tree)
on_get_accessibility_tree(accessibility_tree);
}
ErrorOr<String> WebContentView::dump_layout_tree()
{
return String::from_deprecated_string(client().dump_layout_tree());

View file

@ -42,34 +42,7 @@ public:
explicit WebContentView(StringView webdriver_content_ipc_path, WebView::EnableCallgrindProfiling);
virtual ~WebContentView() override;
Function<String(Web::HTML::ActivateTab)> on_new_tab;
Function<String(const AK::URL&, Web::HTML::ActivateTab)> on_tab_open_request;
Function<void()> on_close;
Function<void(Gfx::IntPoint screen_position)> on_context_menu_request;
Function<void(const AK::URL&, DeprecatedString const& target, unsigned modifiers)> on_link_click;
Function<void(const AK::URL&, Gfx::IntPoint screen_position)> on_link_context_menu_request;
Function<void(const AK::URL&, Gfx::IntPoint screen_position, Gfx::ShareableBitmap const&)> on_image_context_menu_request;
Function<void(const AK::URL&, Gfx::IntPoint screen_position, bool, bool, bool)> on_video_context_menu_request;
Function<void(const AK::URL&, DeprecatedString const& target, unsigned modifiers)> on_link_middle_click;
Function<void(const AK::URL&)> on_link_hover;
Function<void(DeprecatedString const&)> on_title_change;
Function<void(const AK::URL&)> on_load_start;
Function<void(const AK::URL&)> on_load_finish;
Function<void(Gfx::Bitmap const&)> on_favicon_change;
Function<void(const AK::URL&)> on_url_drop;
Function<void(Web::DOM::Document*)> on_set_document;
Function<void(const AK::URL&, DeprecatedString const&)> on_get_source;
Function<void(DeprecatedString const&)> on_get_dom_tree;
Function<void(i32 node_id, DeprecatedString const& specified_style, DeprecatedString const& computed_style, DeprecatedString const& custom_properties, DeprecatedString const& node_box_sizing)> on_get_dom_node_properties;
Function<void(DeprecatedString const&)> on_get_accessibility_tree;
Function<void(i32 message_id)> on_js_console_new_message;
Function<void(i32 start_index, Vector<DeprecatedString> const& message_types, Vector<DeprecatedString> const& messages)> on_get_js_console_messages;
Function<Vector<Web::Cookie::Cookie>(AK::URL const& url)> on_get_all_cookies;
Function<Optional<Web::Cookie::Cookie>(AK::URL const& url, DeprecatedString const& name)> on_get_named_cookie;
Function<DeprecatedString(const AK::URL& url, Web::Cookie::Source source)> on_get_cookie;
Function<void(const AK::URL& url, Web::Cookie::ParsedCookie const& cookie, Web::Cookie::Source source)> on_set_cookie;
Function<void(Web::Cookie::Cookie const& cookie)> on_update_cookie;
Function<void(i32 count_waiting)> on_resource_status_change;
virtual void paintEvent(QPaintEvent*) override;
virtual void resizeEvent(QResizeEvent*) override;
@ -104,77 +77,22 @@ public:
virtual void notify_server_did_invalidate_content_rect(Badge<WebContentClient>, Gfx::IntRect const&) override;
virtual void notify_server_did_change_selection(Badge<WebContentClient>) override;
virtual void notify_server_did_request_cursor_change(Badge<WebContentClient>, Gfx::StandardCursor cursor) override;
virtual void notify_server_did_change_title(Badge<WebContentClient>, DeprecatedString const&) override;
virtual void notify_server_did_request_scroll(Badge<WebContentClient>, i32, i32) override;
virtual void notify_server_did_request_scroll_to(Badge<WebContentClient>, Gfx::IntPoint) override;
virtual void notify_server_did_request_scroll_into_view(Badge<WebContentClient>, Gfx::IntRect const&) override;
virtual void notify_server_did_enter_tooltip_area(Badge<WebContentClient>, Gfx::IntPoint, DeprecatedString const&) override;
virtual void notify_server_did_leave_tooltip_area(Badge<WebContentClient>) override;
virtual void notify_server_did_hover_link(Badge<WebContentClient>, const AK::URL&) override;
virtual void notify_server_did_unhover_link(Badge<WebContentClient>) override;
virtual void notify_server_did_click_link(Badge<WebContentClient>, const AK::URL&, DeprecatedString const& target, unsigned modifiers) override;
virtual void notify_server_did_middle_click_link(Badge<WebContentClient>, const AK::URL&, DeprecatedString const& target, unsigned modifiers) override;
virtual void notify_server_did_start_loading(Badge<WebContentClient>, const AK::URL&, bool) override;
virtual void notify_server_did_finish_loading(Badge<WebContentClient>, const AK::URL&) override;
virtual void notify_server_did_request_navigate_back(Badge<WebContentClient>) override;
virtual void notify_server_did_request_navigate_forward(Badge<WebContentClient>) override;
virtual void notify_server_did_request_refresh(Badge<WebContentClient>) override;
virtual void notify_server_did_request_context_menu(Badge<WebContentClient>, Gfx::IntPoint) override;
virtual void notify_server_did_request_link_context_menu(Badge<WebContentClient>, Gfx::IntPoint, const AK::URL&, DeprecatedString const& target, unsigned modifiers) override;
virtual void notify_server_did_request_image_context_menu(Badge<WebContentClient>, Gfx::IntPoint, const AK::URL&, DeprecatedString const& target, unsigned modifiers, Gfx::ShareableBitmap const&) override;
virtual void notify_server_did_request_video_context_menu(Badge<WebContentClient>, Gfx::IntPoint, const AK::URL&, DeprecatedString const& target, unsigned modifiers, bool is_playing, bool has_user_agent_controls, bool is_looping) override;
virtual void notify_server_did_request_alert(Badge<WebContentClient>, String const& message) override;
virtual void notify_server_did_request_confirm(Badge<WebContentClient>, String const& message) override;
virtual void notify_server_did_request_prompt(Badge<WebContentClient>, String const& message, String const& default_) override;
virtual void notify_server_did_request_set_prompt_text(Badge<WebContentClient>, String const& message) override;
virtual void notify_server_did_request_accept_dialog(Badge<WebContentClient>) override;
virtual void notify_server_did_request_dismiss_dialog(Badge<WebContentClient>) override;
virtual void notify_server_did_get_source(const AK::URL& url, DeprecatedString const& source) override;
virtual void notify_server_did_get_dom_tree(DeprecatedString const& dom_tree) override;
virtual void notify_server_did_get_dom_node_properties(i32 node_id, DeprecatedString const& specified_style, DeprecatedString const& computed_style, DeprecatedString const& custom_properties, DeprecatedString const& node_box_sizing) override;
virtual void notify_server_did_get_accessibility_tree(DeprecatedString const& accessibility_tree) override;
virtual void notify_server_did_output_js_console_message(i32 message_index) override;
virtual void notify_server_did_get_js_console_messages(i32 start_index, Vector<DeprecatedString> const& message_types, Vector<DeprecatedString> const& messages) override;
virtual void notify_server_did_change_favicon(Gfx::Bitmap const& favicon) override;
virtual Vector<Web::Cookie::Cookie> notify_server_did_request_all_cookies(Badge<WebContentClient>, AK::URL const& url) override;
virtual Optional<Web::Cookie::Cookie> notify_server_did_request_named_cookie(Badge<WebContentClient>, AK::URL const& url, DeprecatedString const& name) override;
virtual DeprecatedString notify_server_did_request_cookie(Badge<WebContentClient>, const AK::URL& url, Web::Cookie::Source source) override;
virtual void notify_server_did_set_cookie(Badge<WebContentClient>, const AK::URL& url, Web::Cookie::ParsedCookie const& cookie, Web::Cookie::Source source) override;
virtual void notify_server_did_update_cookie(Badge<WebContentClient>, Web::Cookie::Cookie const& cookie) override;
virtual String notify_server_did_request_new_tab(Badge<WebContentClient>, Web::HTML::ActivateTab activate_tab) override;
virtual void notify_server_did_request_activate_tab(Badge<WebContentClient>) override;
virtual void notify_server_did_close_browsing_context(Badge<WebContentClient>) override;
virtual void notify_server_did_update_resource_count(i32 count_waiting) override;
virtual void notify_server_did_request_restore_window() override;
virtual Gfx::IntPoint notify_server_did_request_reposition_window(Gfx::IntPoint) override;
virtual Gfx::IntSize notify_server_did_request_resize_window(Gfx::IntSize) override;
virtual Gfx::IntRect notify_server_did_request_maximize_window() override;
virtual Gfx::IntRect notify_server_did_request_minimize_window() override;
virtual Gfx::IntRect notify_server_did_request_fullscreen_window() override;
virtual void notify_server_did_request_file(Badge<WebContentClient>, DeprecatedString const& path, i32) override;
virtual void notify_server_did_finish_handling_input_event(bool event_was_accepted) override;
signals:
void activate_tab();
void close();
void link_hovered(QString, int timeout = 0);
void link_unhovered();
void back_mouse_button();
void forward_mouse_button();
void load_started(const URL&, bool);
void title_changed(QString);
void favicon_changed(QIcon);
void got_source(URL, QString);
void navigate_back();
void navigate_forward();
void refresh();
void restore_window();
void urls_dropped(QList<QUrl> const&);
Gfx::IntPoint reposition_window(Gfx::IntPoint);
Gfx::IntSize resize_window(Gfx::IntSize);
Gfx::IntRect maximize_window();
Gfx::IntRect minimize_window();
Gfx::IntRect fullscreen_window();
private:
// ^WebView::ViewImplementation

View file

@ -336,8 +336,10 @@ Tab::Tab(BrowserWindow& window)
m_link_context_menu->add_separator();
m_link_context_menu->add_action(window.inspect_dom_node_action());
view().on_link_context_menu_request = [this](auto& url, auto screen_position) {
view().on_link_context_menu_request = [this](auto& url, auto widget_position) {
m_link_context_menu_url = url;
auto screen_position = view().screen_relative_rect().location().translated(widget_position);
m_link_context_menu->popup(screen_position, m_link_context_menu_default_action);
};
@ -363,9 +365,11 @@ Tab::Tab(BrowserWindow& window)
m_image_context_menu->add_separator();
m_image_context_menu->add_action(window.inspect_dom_node_action());
view().on_image_context_menu_request = [this](auto& image_url, auto screen_position, Gfx::ShareableBitmap const& shareable_bitmap) {
view().on_image_context_menu_request = [this](auto& image_url, auto widget_position, Gfx::ShareableBitmap const& shareable_bitmap) {
m_image_context_menu_url = image_url;
m_image_context_menu_bitmap = shareable_bitmap;
auto screen_position = view().screen_relative_rect().location().translated(widget_position);
m_image_context_menu->popup(screen_position);
};
@ -401,7 +405,7 @@ Tab::Tab(BrowserWindow& window)
m_video_context_menu->add_separator();
m_video_context_menu->add_action(window.inspect_dom_node_action());
view().on_video_context_menu_request = [this](auto& video_url, auto screen_position, bool is_playing, bool has_user_agent_controls, bool is_looping) {
view().on_video_context_menu_request = [this](auto& video_url, auto widget_position, bool is_playing, bool has_user_agent_controls, bool is_looping) {
m_video_context_menu_url = video_url;
if (is_playing) {
@ -415,6 +419,7 @@ Tab::Tab(BrowserWindow& window)
m_video_context_menu_controls_action->set_checked(has_user_agent_controls);
m_video_context_menu_loop_action->set_checked(is_looping);
auto screen_position = view().screen_relative_rect().location().translated(widget_position);
m_video_context_menu->popup(screen_position);
};
@ -507,14 +512,12 @@ Tab::Tab(BrowserWindow& window)
m_statusbar = *find_descendant_of_type_named<GUI::Statusbar>("statusbar");
view().on_link_hover = [this](auto& url) {
if (url.is_valid())
update_status(url.to_deprecated_string());
else
update_status();
update_status(url.to_deprecated_string());
};
view().on_url_drop = [this](auto& url) {
load(url);
view().on_link_unhover = [this]() {
view().set_override_cursor(Gfx::StandardCursor::None);
update_status();
};
view().on_back_button = [this] {
@ -588,7 +591,9 @@ Tab::Tab(BrowserWindow& window)
m_page_context_menu->add_action(window.view_source_action());
m_page_context_menu->add_action(window.inspect_dom_tree_action());
m_page_context_menu->add_action(window.inspect_dom_node_action());
view().on_context_menu_request = [&](auto screen_position) {
view().on_context_menu_request = [&](auto widget_position) {
auto screen_position = view().screen_relative_rect().location().translated(widget_position);
m_page_context_menu->popup(screen_position);
};
}

View file

@ -126,10 +126,12 @@ void OutOfProcessWebView::mouseup_event(GUI::MouseEvent& event)
{
enqueue_input_event(event);
if (event.button() == GUI::MouseButton::Backward && on_back_button) {
on_back_button();
} else if (event.button() == GUI::MouseButton::Forward && on_forward_button) {
on_forward_button();
if (event.button() == GUI::MouseButton::Backward) {
if (on_back_button)
on_back_button();
} else if (event.button() == GUI::MouseButton::Forward) {
if (on_forward_button)
on_forward_button();
}
}
@ -198,12 +200,6 @@ void OutOfProcessWebView::notify_server_did_layout(Badge<WebContentClient>, Gfx:
set_content_size(content_size);
}
void OutOfProcessWebView::notify_server_did_change_title(Badge<WebContentClient>, DeprecatedString const& title)
{
if (on_title_change)
on_title_change(title);
}
void OutOfProcessWebView::notify_server_did_request_scroll(Badge<WebContentClient>, i32 x_delta, i32 y_delta)
{
horizontal_scrollbar().increase_slider_by(x_delta);
@ -231,87 +227,6 @@ void OutOfProcessWebView::notify_server_did_leave_tooltip_area(Badge<WebContentC
GUI::Application::the()->hide_tooltip();
}
void OutOfProcessWebView::notify_server_did_hover_link(Badge<WebContentClient>, const AK::URL& url)
{
if (on_link_hover)
on_link_hover(url);
}
void OutOfProcessWebView::notify_server_did_unhover_link(Badge<WebContentClient>)
{
set_override_cursor(Gfx::StandardCursor::None);
if (on_link_hover)
on_link_hover({});
}
void OutOfProcessWebView::notify_server_did_click_link(Badge<WebContentClient>, const AK::URL& url, DeprecatedString const& target, unsigned int modifiers)
{
if (on_link_click)
on_link_click(url, target, modifiers);
}
void OutOfProcessWebView::notify_server_did_middle_click_link(Badge<WebContentClient>, const AK::URL& url, DeprecatedString const& target, unsigned int modifiers)
{
if (on_link_middle_click)
on_link_middle_click(url, target, modifiers);
}
void OutOfProcessWebView::notify_server_did_start_loading(Badge<WebContentClient>, const AK::URL& url, bool is_redirect)
{
m_url = url;
if (on_load_start)
on_load_start(url, is_redirect);
}
void OutOfProcessWebView::notify_server_did_finish_loading(Badge<WebContentClient>, const AK::URL& url)
{
m_url = url;
if (on_load_finish)
on_load_finish(url);
}
void OutOfProcessWebView::notify_server_did_request_navigate_back(Badge<WebContentClient>)
{
if (on_navigate_back)
on_navigate_back();
}
void OutOfProcessWebView::notify_server_did_request_navigate_forward(Badge<WebContentClient>)
{
if (on_navigate_forward)
on_navigate_forward();
}
void OutOfProcessWebView::notify_server_did_request_refresh(Badge<WebContentClient>)
{
if (on_refresh)
on_refresh();
}
void OutOfProcessWebView::notify_server_did_request_context_menu(Badge<WebContentClient>, Gfx::IntPoint content_position)
{
if (on_context_menu_request)
on_context_menu_request(screen_relative_rect().location().translated(to_widget_position(content_position)));
}
void OutOfProcessWebView::notify_server_did_request_link_context_menu(Badge<WebContentClient>, Gfx::IntPoint content_position, const AK::URL& url, DeprecatedString const&, unsigned)
{
if (on_link_context_menu_request)
on_link_context_menu_request(url, screen_relative_rect().location().translated(to_widget_position(content_position)));
}
void OutOfProcessWebView::notify_server_did_request_image_context_menu(Badge<WebContentClient>, Gfx::IntPoint content_position, const AK::URL& url, DeprecatedString const&, unsigned, Gfx::ShareableBitmap const& bitmap)
{
if (on_image_context_menu_request)
on_image_context_menu_request(url, screen_relative_rect().location().translated(to_widget_position(content_position)), bitmap);
}
void OutOfProcessWebView::notify_server_did_request_video_context_menu(Badge<WebContentClient>, Gfx::IntPoint content_position, const AK::URL& url, DeprecatedString const&, unsigned, bool is_playing, bool has_user_agent_controls, bool is_looping)
{
if (on_video_context_menu_request)
on_video_context_menu_request(url, screen_relative_rect().location().translated(to_widget_position(content_position)), is_playing, has_user_agent_controls, is_looping);
}
void OutOfProcessWebView::notify_server_did_request_alert(Badge<WebContentClient>, String const& message)
{
m_dialog = GUI::MessageBox::create(window(), message, "Alert"sv, GUI::MessageBox::Type::Information, GUI::MessageBox::InputType::OK).release_value_but_fixme_should_propagate_errors();
@ -367,141 +282,6 @@ void OutOfProcessWebView::notify_server_did_request_dismiss_dialog(Badge<WebCont
m_dialog->done(GUI::Dialog::ExecResult::Cancel);
}
void OutOfProcessWebView::notify_server_did_get_source(const AK::URL& url, DeprecatedString const& source)
{
if (on_get_source)
on_get_source(url, source);
}
void OutOfProcessWebView::notify_server_did_get_dom_tree(DeprecatedString const& dom_tree)
{
if (on_get_dom_tree)
on_get_dom_tree(dom_tree);
}
void OutOfProcessWebView::notify_server_did_get_dom_node_properties(i32 node_id, DeprecatedString const& computed_style, DeprecatedString const& resolved_style, DeprecatedString const& custom_properties, DeprecatedString const& node_box_sizing)
{
if (on_get_dom_node_properties)
on_get_dom_node_properties(node_id, computed_style, resolved_style, custom_properties, node_box_sizing);
}
void OutOfProcessWebView::notify_server_did_output_js_console_message(i32 message_index)
{
if (on_js_console_new_message)
on_js_console_new_message(message_index);
}
void OutOfProcessWebView::notify_server_did_get_js_console_messages(i32 start_index, Vector<DeprecatedString> const& message_types, Vector<DeprecatedString> const& messages)
{
if (on_get_js_console_messages)
on_get_js_console_messages(start_index, message_types, messages);
}
void OutOfProcessWebView::notify_server_did_change_favicon(Gfx::Bitmap const& favicon)
{
if (on_favicon_change)
on_favicon_change(favicon);
}
Vector<Web::Cookie::Cookie> OutOfProcessWebView::notify_server_did_request_all_cookies(Badge<WebContentClient>, AK::URL const& url)
{
if (on_get_all_cookies)
return on_get_all_cookies(url);
return {};
}
Optional<Web::Cookie::Cookie> OutOfProcessWebView::notify_server_did_request_named_cookie(Badge<WebContentClient>, AK::URL const& url, DeprecatedString const& name)
{
if (on_get_named_cookie)
return on_get_named_cookie(url, name);
return {};
}
DeprecatedString OutOfProcessWebView::notify_server_did_request_cookie(Badge<WebContentClient>, const AK::URL& url, Web::Cookie::Source source)
{
if (on_get_cookie)
return on_get_cookie(url, source);
return {};
}
void OutOfProcessWebView::notify_server_did_set_cookie(Badge<WebContentClient>, const AK::URL& url, Web::Cookie::ParsedCookie const& cookie, Web::Cookie::Source source)
{
if (on_set_cookie)
on_set_cookie(url, cookie, source);
}
void OutOfProcessWebView::notify_server_did_update_cookie(Badge<WebContentClient>, Web::Cookie::Cookie const& cookie)
{
if (on_update_cookie)
on_update_cookie(cookie);
}
String OutOfProcessWebView::notify_server_did_request_new_tab(Badge<WebContentClient>, Web::HTML::ActivateTab activate_tab)
{
if (on_new_tab)
return on_new_tab(activate_tab);
return {};
}
void OutOfProcessWebView::notify_server_did_request_activate_tab(Badge<WebContentClient>)
{
if (on_activate_tab)
on_activate_tab();
}
void OutOfProcessWebView::notify_server_did_close_browsing_context(Badge<WebContentClient>)
{
if (on_close)
on_close();
}
void OutOfProcessWebView::notify_server_did_update_resource_count(i32 count_waiting)
{
if (on_resource_status_change)
on_resource_status_change(count_waiting);
}
void OutOfProcessWebView::notify_server_did_request_restore_window()
{
if (on_restore_window)
on_restore_window();
}
Gfx::IntPoint OutOfProcessWebView::notify_server_did_request_reposition_window(Gfx::IntPoint position)
{
if (on_reposition_window)
return on_reposition_window(position);
return {};
}
Gfx::IntSize OutOfProcessWebView::notify_server_did_request_resize_window(Gfx::IntSize size)
{
if (on_resize_window)
return on_resize_window(size);
return {};
}
Gfx::IntRect OutOfProcessWebView::notify_server_did_request_maximize_window()
{
if (on_maximize_window)
return on_maximize_window();
return {};
}
Gfx::IntRect OutOfProcessWebView::notify_server_did_request_minimize_window()
{
if (on_minimize_window)
return on_minimize_window();
return {};
}
Gfx::IntRect OutOfProcessWebView::notify_server_did_request_fullscreen_window()
{
if (on_fullscreen_window)
return on_fullscreen_window();
return {};
}
void OutOfProcessWebView::notify_server_did_request_file(Badge<WebContentClient>, DeprecatedString const& path, i32 request_id)
{
auto file = FileSystemAccessClient::Client::the().request_file_read_only_approved(window(), path);
@ -721,12 +501,6 @@ void OutOfProcessWebView::notify_server_did_finish_handling_input_event(bool eve
process_next_input_event();
}
void OutOfProcessWebView::notify_server_did_get_accessibility_tree(DeprecatedString const& accessibility_tree)
{
if (on_get_accessibility_tree)
on_get_accessibility_tree(accessibility_tree);
}
void OutOfProcessWebView::set_content_scales_to_viewport(bool b)
{
m_content_scales_to_viewport = b;

View file

@ -54,46 +54,6 @@ public:
// In practice, this means that OOPWV may render scaled stale versions of the content while resizing.
void set_content_scales_to_viewport(bool);
Function<String(Web::HTML::ActivateTab)> on_new_tab;
Function<void()> on_activate_tab;
Function<void()> on_close;
Function<void(Gfx::IntPoint screen_position)> on_context_menu_request;
Function<void(const AK::URL&, DeprecatedString const& target, unsigned modifiers)> on_link_click;
Function<void(const AK::URL&, Gfx::IntPoint screen_position)> on_link_context_menu_request;
Function<void(const AK::URL&, Gfx::IntPoint screen_position, Gfx::ShareableBitmap const&)> on_image_context_menu_request;
Function<void(const AK::URL&, Gfx::IntPoint screen_position, bool, bool, bool)> on_video_context_menu_request;
Function<void(const AK::URL&, DeprecatedString const& target, unsigned modifiers)> on_link_middle_click;
Function<void(const AK::URL&)> on_link_hover;
Function<void(DeprecatedString const&)> on_title_change;
Function<void(const AK::URL&, bool)> on_load_start;
Function<void(const AK::URL&)> on_load_finish;
Function<void()> on_navigate_back;
Function<void()> on_navigate_forward;
Function<void()> on_refresh;
Function<void(Gfx::Bitmap const&)> on_favicon_change;
Function<void(const AK::URL&)> on_url_drop;
Function<void(Web::DOM::Document*)> on_set_document;
Function<void(const AK::URL&, DeprecatedString const&)> on_get_source;
Function<void(DeprecatedString const&)> on_get_dom_tree;
Function<void(i32 node_id, DeprecatedString const& computed_style, DeprecatedString const& resolved_style, DeprecatedString const& custom_properties, DeprecatedString const& node_box_sizing)> on_get_dom_node_properties;
Function<void(DeprecatedString const&)> on_get_accessibility_tree;
Function<void(i32 message_id)> on_js_console_new_message;
Function<void(i32 start_index, Vector<DeprecatedString> const& message_types, Vector<DeprecatedString> const& messages)> on_get_js_console_messages;
Function<Vector<Web::Cookie::Cookie>(AK::URL const& url)> on_get_all_cookies;
Function<Optional<Web::Cookie::Cookie>(AK::URL const& url, DeprecatedString const& name)> on_get_named_cookie;
Function<DeprecatedString(const AK::URL& url, Web::Cookie::Source source)> on_get_cookie;
Function<void(const AK::URL& url, Web::Cookie::ParsedCookie const& cookie, Web::Cookie::Source source)> on_set_cookie;
Function<void(Web::Cookie::Cookie const& cookie)> on_update_cookie;
Function<void(i32 count_waiting)> on_resource_status_change;
Function<void()> on_restore_window;
Function<Gfx::IntPoint(Gfx::IntPoint)> on_reposition_window;
Function<Gfx::IntSize(Gfx::IntSize)> on_resize_window;
Function<Gfx::IntRect()> on_maximize_window;
Function<Gfx::IntRect()> on_minimize_window;
Function<Gfx::IntRect()> on_fullscreen_window;
Function<void()> on_back_button;
Function<void()> on_forward_button;
private:
OutOfProcessWebView();
@ -125,53 +85,17 @@ private:
virtual void notify_server_did_invalidate_content_rect(Badge<WebContentClient>, Gfx::IntRect const&) override;
virtual void notify_server_did_change_selection(Badge<WebContentClient>) override;
virtual void notify_server_did_request_cursor_change(Badge<WebContentClient>, Gfx::StandardCursor cursor) override;
virtual void notify_server_did_change_title(Badge<WebContentClient>, DeprecatedString const&) override;
virtual void notify_server_did_request_scroll(Badge<WebContentClient>, i32, i32) override;
virtual void notify_server_did_request_scroll_to(Badge<WebContentClient>, Gfx::IntPoint) override;
virtual void notify_server_did_request_scroll_into_view(Badge<WebContentClient>, Gfx::IntRect const&) override;
virtual void notify_server_did_enter_tooltip_area(Badge<WebContentClient>, Gfx::IntPoint, DeprecatedString const&) override;
virtual void notify_server_did_leave_tooltip_area(Badge<WebContentClient>) override;
virtual void notify_server_did_hover_link(Badge<WebContentClient>, const AK::URL&) override;
virtual void notify_server_did_unhover_link(Badge<WebContentClient>) override;
virtual void notify_server_did_click_link(Badge<WebContentClient>, const AK::URL&, DeprecatedString const& target, unsigned modifiers) override;
virtual void notify_server_did_middle_click_link(Badge<WebContentClient>, const AK::URL&, DeprecatedString const& target, unsigned modifiers) override;
virtual void notify_server_did_start_loading(Badge<WebContentClient>, const AK::URL&, bool) override;
virtual void notify_server_did_finish_loading(Badge<WebContentClient>, const AK::URL&) override;
virtual void notify_server_did_request_navigate_back(Badge<WebContentClient>) override;
virtual void notify_server_did_request_navigate_forward(Badge<WebContentClient>) override;
virtual void notify_server_did_request_refresh(Badge<WebContentClient>) override;
virtual void notify_server_did_request_context_menu(Badge<WebContentClient>, Gfx::IntPoint) override;
virtual void notify_server_did_request_link_context_menu(Badge<WebContentClient>, Gfx::IntPoint, const AK::URL&, DeprecatedString const& target, unsigned modifiers) override;
virtual void notify_server_did_request_image_context_menu(Badge<WebContentClient>, Gfx::IntPoint, const AK::URL&, DeprecatedString const& target, unsigned modifiers, Gfx::ShareableBitmap const&) override;
virtual void notify_server_did_request_video_context_menu(Badge<WebContentClient>, Gfx::IntPoint, const AK::URL&, DeprecatedString const& target, unsigned modifiers, bool is_playing, bool has_user_agent_controls, bool is_looping) override;
virtual void notify_server_did_request_alert(Badge<WebContentClient>, String const& message) override;
virtual void notify_server_did_request_confirm(Badge<WebContentClient>, String const& message) override;
virtual void notify_server_did_request_prompt(Badge<WebContentClient>, String const& message, String const& default_) override;
virtual void notify_server_did_request_set_prompt_text(Badge<WebContentClient>, String const& message) override;
virtual void notify_server_did_request_accept_dialog(Badge<WebContentClient>) override;
virtual void notify_server_did_request_dismiss_dialog(Badge<WebContentClient>) override;
virtual void notify_server_did_get_source(const AK::URL& url, DeprecatedString const& source) override;
virtual void notify_server_did_get_dom_tree(DeprecatedString const& dom_tree) override;
virtual void notify_server_did_get_dom_node_properties(i32 node_id, DeprecatedString const& computed_style, DeprecatedString const& resolved_style, DeprecatedString const& custom_properties, DeprecatedString const& node_box_sizing) override;
virtual void notify_server_did_get_accessibility_tree(DeprecatedString const& accessibility_tree) override;
virtual void notify_server_did_output_js_console_message(i32 message_index) override;
virtual void notify_server_did_get_js_console_messages(i32 start_index, Vector<DeprecatedString> const& message_types, Vector<DeprecatedString> const& messages) override;
virtual void notify_server_did_change_favicon(Gfx::Bitmap const& favicon) override;
virtual Vector<Web::Cookie::Cookie> notify_server_did_request_all_cookies(Badge<WebContentClient>, AK::URL const& url) override;
virtual Optional<Web::Cookie::Cookie> notify_server_did_request_named_cookie(Badge<WebContentClient>, AK::URL const& url, DeprecatedString const& name) override;
virtual DeprecatedString notify_server_did_request_cookie(Badge<WebContentClient>, const AK::URL& url, Web::Cookie::Source source) override;
virtual void notify_server_did_set_cookie(Badge<WebContentClient>, const AK::URL& url, Web::Cookie::ParsedCookie const& cookie, Web::Cookie::Source source) override;
virtual void notify_server_did_update_cookie(Badge<WebContentClient>, Web::Cookie::Cookie const& cookie) override;
virtual String notify_server_did_request_new_tab(Badge<WebContentClient>, Web::HTML::ActivateTab activate_tab) override;
virtual void notify_server_did_request_activate_tab(Badge<WebContentClient>) override;
virtual void notify_server_did_close_browsing_context(Badge<WebContentClient>) override;
virtual void notify_server_did_update_resource_count(i32 count_waiting) override;
virtual void notify_server_did_request_restore_window() override;
virtual Gfx::IntPoint notify_server_did_request_reposition_window(Gfx::IntPoint) override;
virtual Gfx::IntSize notify_server_did_request_resize_window(Gfx::IntSize) override;
virtual Gfx::IntRect notify_server_did_request_maximize_window() override;
virtual Gfx::IntRect notify_server_did_request_minimize_window() override;
virtual Gfx::IntRect notify_server_did_request_fullscreen_window() override;
virtual void notify_server_did_request_file(Badge<WebContentClient>, DeprecatedString const& path, i32) override;
virtual void notify_server_did_finish_handling_input_event(bool event_was_accepted) override;

View file

@ -8,6 +8,7 @@
#pragma once
#include <AK/Forward.h>
#include <AK/Function.h>
#include <AK/String.h>
#include <LibGfx/Forward.h>
#include <LibGfx/StandardCursor.h>
@ -40,6 +41,7 @@ public:
String node_box_sizing_json;
};
void set_url(Badge<WebContentClient>, AK::URL url) { m_url = move(url); }
AK::URL const& url() const { return m_url; }
String const& handle() const { return m_client_state.client_handle; }
@ -82,58 +84,61 @@ public:
};
ErrorOr<void> take_screenshot(ScreenshotType);
Function<String(Web::HTML::ActivateTab)> on_new_tab;
Function<void()> on_activate_tab;
Function<void()> on_close;
Function<void(Gfx::IntPoint screen_position)> on_context_menu_request;
Function<void(const AK::URL&, Gfx::IntPoint screen_position)> on_link_context_menu_request;
Function<void(const AK::URL&, Gfx::IntPoint screen_position, Gfx::ShareableBitmap const&)> on_image_context_menu_request;
Function<void(const AK::URL&, Gfx::IntPoint screen_position, bool, bool, bool)> on_video_context_menu_request;
Function<void(const AK::URL&)> on_link_hover;
Function<void()> on_link_unhover;
Function<void(const AK::URL&, DeprecatedString const& target, unsigned modifiers)> on_link_click;
Function<void(const AK::URL&, DeprecatedString const& target, unsigned modifiers)> on_link_middle_click;
Function<void(DeprecatedString const&)> on_title_change;
Function<void(const AK::URL&, bool)> on_load_start;
Function<void(const AK::URL&)> on_load_finish;
Function<void()> on_navigate_back;
Function<void()> on_navigate_forward;
Function<void()> on_refresh;
Function<void(Gfx::Bitmap const&)> on_favicon_change;
Function<void(const AK::URL&, DeprecatedString const&)> on_get_source;
Function<void(DeprecatedString const&)> on_get_dom_tree;
Function<void(i32 node_id, DeprecatedString const& computed_style, DeprecatedString const& resolved_style, DeprecatedString const& custom_properties, DeprecatedString const& node_box_sizing)> on_get_dom_node_properties;
Function<void(DeprecatedString const&)> on_get_accessibility_tree;
Function<void(i32 message_id)> on_js_console_new_message;
Function<void(i32 start_index, Vector<DeprecatedString> const& message_types, Vector<DeprecatedString> const& messages)> on_get_js_console_messages;
Function<Vector<Web::Cookie::Cookie>(AK::URL const& url)> on_get_all_cookies;
Function<Optional<Web::Cookie::Cookie>(AK::URL const& url, DeprecatedString const& name)> on_get_named_cookie;
Function<DeprecatedString(const AK::URL& url, Web::Cookie::Source source)> on_get_cookie;
Function<void(const AK::URL& url, Web::Cookie::ParsedCookie const& cookie, Web::Cookie::Source source)> on_set_cookie;
Function<void(Web::Cookie::Cookie const& cookie)> on_update_cookie;
Function<void(i32 count_waiting)> on_resource_status_change;
Function<void()> on_restore_window;
Function<Gfx::IntPoint(Gfx::IntPoint)> on_reposition_window;
Function<Gfx::IntSize(Gfx::IntSize)> on_resize_window;
Function<Gfx::IntRect()> on_maximize_window;
Function<Gfx::IntRect()> on_minimize_window;
Function<Gfx::IntRect()> on_fullscreen_window;
Function<void()> on_back_button;
Function<void()> on_forward_button;
virtual void notify_server_did_layout(Badge<WebContentClient>, Gfx::IntSize content_size) = 0;
virtual void notify_server_did_paint(Badge<WebContentClient>, i32 bitmap_id, Gfx::IntSize) = 0;
virtual void notify_server_did_invalidate_content_rect(Badge<WebContentClient>, Gfx::IntRect const&) = 0;
virtual void notify_server_did_change_selection(Badge<WebContentClient>) = 0;
virtual void notify_server_did_request_cursor_change(Badge<WebContentClient>, Gfx::StandardCursor cursor) = 0;
virtual void notify_server_did_change_title(Badge<WebContentClient>, DeprecatedString const&) = 0;
virtual void notify_server_did_request_scroll(Badge<WebContentClient>, i32, i32) = 0;
virtual void notify_server_did_request_scroll_to(Badge<WebContentClient>, Gfx::IntPoint) = 0;
virtual void notify_server_did_request_scroll_into_view(Badge<WebContentClient>, Gfx::IntRect const&) = 0;
virtual void notify_server_did_enter_tooltip_area(Badge<WebContentClient>, Gfx::IntPoint, DeprecatedString const&) = 0;
virtual void notify_server_did_leave_tooltip_area(Badge<WebContentClient>) = 0;
virtual void notify_server_did_hover_link(Badge<WebContentClient>, const AK::URL&) = 0;
virtual void notify_server_did_unhover_link(Badge<WebContentClient>) = 0;
virtual void notify_server_did_click_link(Badge<WebContentClient>, const AK::URL&, DeprecatedString const& target, unsigned modifiers) = 0;
virtual void notify_server_did_middle_click_link(Badge<WebContentClient>, const AK::URL&, DeprecatedString const& target, unsigned modifiers) = 0;
virtual void notify_server_did_start_loading(Badge<WebContentClient>, const AK::URL&, bool is_redirect) = 0;
virtual void notify_server_did_finish_loading(Badge<WebContentClient>, const AK::URL&) = 0;
virtual void notify_server_did_request_navigate_back(Badge<WebContentClient>) = 0;
virtual void notify_server_did_request_navigate_forward(Badge<WebContentClient>) = 0;
virtual void notify_server_did_request_refresh(Badge<WebContentClient>) = 0;
virtual void notify_server_did_request_context_menu(Badge<WebContentClient>, Gfx::IntPoint) = 0;
virtual void notify_server_did_request_link_context_menu(Badge<WebContentClient>, Gfx::IntPoint, const AK::URL&, DeprecatedString const& target, unsigned modifiers) = 0;
virtual void notify_server_did_request_image_context_menu(Badge<WebContentClient>, Gfx::IntPoint, const AK::URL&, DeprecatedString const& target, unsigned modifiers, Gfx::ShareableBitmap const&) = 0;
virtual void notify_server_did_request_video_context_menu(Badge<WebContentClient>, Gfx::IntPoint, const AK::URL&, DeprecatedString const& target, unsigned modifiers, bool is_playing, bool has_user_agent_controls, bool is_looping) = 0;
virtual void notify_server_did_request_alert(Badge<WebContentClient>, String const& message) = 0;
virtual void notify_server_did_request_confirm(Badge<WebContentClient>, String const& message) = 0;
virtual void notify_server_did_request_prompt(Badge<WebContentClient>, String const& message, String const& default_) = 0;
virtual void notify_server_did_request_set_prompt_text(Badge<WebContentClient>, String const& message) = 0;
virtual void notify_server_did_request_accept_dialog(Badge<WebContentClient>) = 0;
virtual void notify_server_did_request_dismiss_dialog(Badge<WebContentClient>) = 0;
virtual void notify_server_did_get_source(const AK::URL& url, DeprecatedString const& source) = 0;
virtual void notify_server_did_get_dom_tree(DeprecatedString const& dom_tree) = 0;
virtual void notify_server_did_get_dom_node_properties(i32 node_id, DeprecatedString const& computed_style, DeprecatedString const& resolved_style, DeprecatedString const& custom_properties, DeprecatedString const& node_box_sizing) = 0;
virtual void notify_server_did_get_accessibility_tree(DeprecatedString const& accessibility_tree) = 0;
virtual void notify_server_did_output_js_console_message(i32 message_index) = 0;
virtual void notify_server_did_get_js_console_messages(i32 start_index, Vector<DeprecatedString> const& message_types, Vector<DeprecatedString> const& messages) = 0;
virtual void notify_server_did_change_favicon(Gfx::Bitmap const& favicon) = 0;
virtual Vector<Web::Cookie::Cookie> notify_server_did_request_all_cookies(Badge<WebContentClient>, AK::URL const& url) = 0;
virtual Optional<Web::Cookie::Cookie> notify_server_did_request_named_cookie(Badge<WebContentClient>, AK::URL const& url, DeprecatedString const& name) = 0;
virtual DeprecatedString notify_server_did_request_cookie(Badge<WebContentClient>, const AK::URL& url, Web::Cookie::Source source) = 0;
virtual void notify_server_did_set_cookie(Badge<WebContentClient>, const AK::URL& url, Web::Cookie::ParsedCookie const& cookie, Web::Cookie::Source source) = 0;
virtual void notify_server_did_update_cookie(Badge<WebContentClient>, Web::Cookie::Cookie const& cookie) = 0;
virtual String notify_server_did_request_new_tab(Badge<WebContentClient>, Web::HTML::ActivateTab activate_tab) = 0;
virtual void notify_server_did_request_activate_tab(Badge<WebContentClient>) = 0;
virtual void notify_server_did_close_browsing_context(Badge<WebContentClient>) = 0;
virtual void notify_server_did_update_resource_count(i32 count_waiting) = 0;
virtual void notify_server_did_request_restore_window() = 0;
virtual Gfx::IntPoint notify_server_did_request_reposition_window(Gfx::IntPoint) = 0;
virtual Gfx::IntSize notify_server_did_request_resize_window(Gfx::IntSize) = 0;
virtual Gfx::IntRect notify_server_did_request_maximize_window() = 0;
virtual Gfx::IntRect notify_server_did_request_minimize_window() = 0;
virtual Gfx::IntRect notify_server_did_request_fullscreen_window() = 0;
virtual void notify_server_did_request_file(Badge<WebContentClient>, DeprecatedString const& path, i32) = 0;
virtual void notify_server_did_finish_handling_input_event(bool event_was_accepted) = 0;

View file

@ -28,24 +28,38 @@ void WebContentClient::did_paint(Gfx::IntRect const& rect, i32 bitmap_id)
m_view.notify_server_did_paint({}, bitmap_id, rect.size());
}
void WebContentClient::did_start_loading(AK::URL const& url, bool is_redirect)
{
m_view.set_url({}, url);
if (m_view.on_load_start)
m_view.on_load_start(url, is_redirect);
}
void WebContentClient::did_finish_loading(AK::URL const& url)
{
m_view.notify_server_did_finish_loading({}, url);
m_view.set_url({}, url);
if (m_view.on_load_finish)
m_view.on_load_finish(url);
}
void WebContentClient::did_request_navigate_back()
{
m_view.notify_server_did_request_navigate_back({});
if (m_view.on_navigate_back)
m_view.on_navigate_back();
}
void WebContentClient::did_request_navigate_forward()
{
m_view.notify_server_did_request_navigate_forward({});
if (m_view.on_navigate_forward)
m_view.on_navigate_forward();
}
void WebContentClient::did_request_refresh()
{
m_view.notify_server_did_request_refresh({});
if (m_view.on_refresh)
m_view.on_refresh();
}
void WebContentClient::did_invalidate_content_rect(Gfx::IntRect const& content_rect)
@ -80,7 +94,9 @@ void WebContentClient::did_layout(Gfx::IntSize content_size)
void WebContentClient::did_change_title(DeprecatedString const& title)
{
dbgln_if(SPAM_DEBUG, "handle: WebContentClient::DidChangeTitle! title={}", title);
m_view.notify_server_did_change_title({}, title);
if (m_view.on_title_change)
m_view.on_title_change(title);
}
void WebContentClient::did_request_scroll(i32 x_delta, i32 y_delta)
@ -112,73 +128,89 @@ void WebContentClient::did_leave_tooltip_area()
void WebContentClient::did_hover_link(AK::URL const& url)
{
dbgln_if(SPAM_DEBUG, "handle: WebContentClient::DidHoverLink! url={}", url);
m_view.notify_server_did_hover_link({}, url);
if (m_view.on_link_hover)
m_view.on_link_hover(url);
}
void WebContentClient::did_unhover_link()
{
dbgln_if(SPAM_DEBUG, "handle: WebContentClient::DidUnhoverLink!");
m_view.notify_server_did_unhover_link({});
if (m_view.on_link_unhover)
m_view.on_link_unhover();
}
void WebContentClient::did_click_link(AK::URL const& url, DeprecatedString const& target, unsigned modifiers)
{
m_view.notify_server_did_click_link({}, url, target, modifiers);
if (m_view.on_link_click)
m_view.on_link_click(url, target, modifiers);
}
void WebContentClient::did_middle_click_link(AK::URL const& url, DeprecatedString const& target, unsigned modifiers)
{
m_view.notify_server_did_middle_click_link({}, url, target, modifiers);
}
void WebContentClient::did_start_loading(AK::URL const& url, bool is_redirect)
{
m_view.notify_server_did_start_loading({}, url, is_redirect);
if (m_view.on_link_middle_click)
m_view.on_link_middle_click(url, target, modifiers);
}
void WebContentClient::did_request_context_menu(Gfx::IntPoint content_position)
{
m_view.notify_server_did_request_context_menu({}, content_position);
if (m_view.on_context_menu_request)
m_view.on_context_menu_request(m_view.to_widget_position(content_position));
}
void WebContentClient::did_request_link_context_menu(Gfx::IntPoint content_position, AK::URL const& url, DeprecatedString const& target, unsigned modifiers)
void WebContentClient::did_request_link_context_menu(Gfx::IntPoint content_position, AK::URL const& url, DeprecatedString const&, unsigned)
{
m_view.notify_server_did_request_link_context_menu({}, content_position, url, target, modifiers);
if (m_view.on_link_context_menu_request)
m_view.on_link_context_menu_request(url, m_view.to_widget_position(content_position));
}
void WebContentClient::did_request_image_context_menu(Gfx::IntPoint content_position, AK::URL const& url, DeprecatedString const& target, unsigned modifiers, Gfx::ShareableBitmap const& bitmap)
void WebContentClient::did_request_image_context_menu(Gfx::IntPoint content_position, AK::URL const& url, DeprecatedString const&, unsigned, Gfx::ShareableBitmap const& bitmap)
{
m_view.notify_server_did_request_image_context_menu({}, content_position, url, target, modifiers, bitmap);
if (m_view.on_image_context_menu_request)
m_view.on_image_context_menu_request(url, m_view.to_widget_position(content_position), bitmap);
}
void WebContentClient::did_request_video_context_menu(Gfx::IntPoint content_position, AK::URL const& url, DeprecatedString const& target, unsigned modifiers, bool is_playing, bool has_user_agent_controls, bool is_looping)
void WebContentClient::did_request_video_context_menu(Gfx::IntPoint content_position, AK::URL const& url, DeprecatedString const&, unsigned, bool is_playing, bool has_user_agent_controls, bool is_looping)
{
m_view.notify_server_did_request_video_context_menu({}, content_position, url, target, modifiers, is_playing, has_user_agent_controls, is_looping);
if (m_view.on_video_context_menu_request)
m_view.on_video_context_menu_request(url, m_view.to_widget_position(content_position), is_playing, has_user_agent_controls, is_looping);
}
void WebContentClient::did_get_source(AK::URL const& url, DeprecatedString const& source)
{
m_view.notify_server_did_get_source(url, source);
if (m_view.on_get_source)
m_view.on_get_source(url, source);
}
void WebContentClient::did_get_dom_tree(DeprecatedString const& dom_tree)
{
m_view.notify_server_did_get_dom_tree(dom_tree);
if (m_view.on_get_dom_tree)
m_view.on_get_dom_tree(dom_tree);
}
void WebContentClient::did_get_dom_node_properties(i32 node_id, DeprecatedString const& computed_style, DeprecatedString const& resolved_style, DeprecatedString const& custom_properties, DeprecatedString const& node_box_sizing)
{
m_view.notify_server_did_get_dom_node_properties(node_id, computed_style, resolved_style, custom_properties, node_box_sizing);
if (m_view.on_get_dom_node_properties)
m_view.on_get_dom_node_properties(node_id, computed_style, resolved_style, custom_properties, node_box_sizing);
}
void WebContentClient::did_get_accessibility_tree(DeprecatedString const& accessibility_tree)
{
if (m_view.on_get_accessibility_tree)
m_view.on_get_accessibility_tree(accessibility_tree);
}
void WebContentClient::did_output_js_console_message(i32 message_index)
{
m_view.notify_server_did_output_js_console_message(message_index);
if (m_view.on_js_console_new_message)
m_view.on_js_console_new_message(message_index);
}
void WebContentClient::did_get_js_console_messages(i32 start_index, Vector<DeprecatedString> const& message_types, Vector<DeprecatedString> const& messages)
{
m_view.notify_server_did_get_js_console_messages(start_index, message_types, messages);
if (m_view.on_get_js_console_messages)
m_view.on_get_js_console_messages(start_index, message_types, messages);
}
void WebContentClient::did_request_alert(String const& message)
@ -217,82 +249,108 @@ void WebContentClient::did_change_favicon(Gfx::ShareableBitmap const& favicon)
dbgln("DidChangeFavicon: Received invalid favicon");
return;
}
m_view.notify_server_did_change_favicon(*favicon.bitmap());
if (m_view.on_favicon_change)
m_view.on_favicon_change(*favicon.bitmap());
}
Messages::WebContentClient::DidRequestAllCookiesResponse WebContentClient::did_request_all_cookies(AK::URL const& url)
{
return m_view.notify_server_did_request_all_cookies({}, url);
if (m_view.on_get_all_cookies)
return m_view.on_get_all_cookies(url);
return Vector<Web::Cookie::Cookie> {};
}
Messages::WebContentClient::DidRequestNamedCookieResponse WebContentClient::did_request_named_cookie(AK::URL const& url, DeprecatedString const& name)
{
return m_view.notify_server_did_request_named_cookie({}, url, name);
if (m_view.on_get_named_cookie)
return m_view.on_get_named_cookie(url, name);
return OptionalNone {};
}
Messages::WebContentClient::DidRequestCookieResponse WebContentClient::did_request_cookie(AK::URL const& url, u8 source)
{
return m_view.notify_server_did_request_cookie({}, url, static_cast<Web::Cookie::Source>(source));
if (m_view.on_get_cookie)
return m_view.on_get_cookie(url, static_cast<Web::Cookie::Source>(source));
return DeprecatedString {};
}
void WebContentClient::did_set_cookie(AK::URL const& url, Web::Cookie::ParsedCookie const& cookie, u8 source)
{
m_view.notify_server_did_set_cookie({}, url, cookie, static_cast<Web::Cookie::Source>(source));
if (m_view.on_set_cookie)
m_view.on_set_cookie(url, cookie, static_cast<Web::Cookie::Source>(source));
}
void WebContentClient::did_update_cookie(Web::Cookie::Cookie const& cookie)
{
m_view.notify_server_did_update_cookie({}, cookie);
if (m_view.on_update_cookie)
m_view.on_update_cookie(cookie);
}
Messages::WebContentClient::DidRequestNewTabResponse WebContentClient::did_request_new_tab(Web::HTML::ActivateTab const& activate_tab)
{
return m_view.notify_server_did_request_new_tab({}, activate_tab);
if (m_view.on_new_tab)
return m_view.on_new_tab(activate_tab);
return String {};
}
void WebContentClient::did_request_activate_tab()
{
m_view.notify_server_did_request_activate_tab({});
if (m_view.on_activate_tab)
m_view.on_activate_tab();
}
void WebContentClient::did_close_browsing_context()
{
m_view.notify_server_did_close_browsing_context({});
if (m_view.on_close)
m_view.on_close();
}
void WebContentClient::did_update_resource_count(i32 count_waiting)
{
m_view.notify_server_did_update_resource_count(count_waiting);
if (m_view.on_resource_status_change)
m_view.on_resource_status_change(count_waiting);
}
void WebContentClient::did_request_restore_window()
{
m_view.notify_server_did_request_restore_window();
if (m_view.on_restore_window)
m_view.on_restore_window();
}
Messages::WebContentClient::DidRequestRepositionWindowResponse WebContentClient::did_request_reposition_window(Gfx::IntPoint position)
{
return m_view.notify_server_did_request_reposition_window(position);
if (m_view.on_reposition_window)
return m_view.on_reposition_window(position);
return Gfx::IntPoint {};
}
Messages::WebContentClient::DidRequestResizeWindowResponse WebContentClient::did_request_resize_window(Gfx::IntSize size)
{
return m_view.notify_server_did_request_resize_window(size);
if (m_view.on_resize_window)
return m_view.on_resize_window(size);
return Gfx::IntSize {};
}
Messages::WebContentClient::DidRequestMaximizeWindowResponse WebContentClient::did_request_maximize_window()
{
return m_view.notify_server_did_request_maximize_window();
if (m_view.on_maximize_window)
return m_view.on_maximize_window();
return Gfx::IntRect {};
}
Messages::WebContentClient::DidRequestMinimizeWindowResponse WebContentClient::did_request_minimize_window()
{
return m_view.notify_server_did_request_minimize_window();
if (m_view.on_minimize_window)
return m_view.on_minimize_window();
return Gfx::IntRect {};
}
Messages::WebContentClient::DidRequestFullscreenWindowResponse WebContentClient::did_request_fullscreen_window()
{
return m_view.notify_server_did_request_fullscreen_window();
if (m_view.on_fullscreen_window)
return m_view.on_fullscreen_window();
return Gfx::IntRect {};
}
void WebContentClient::did_request_file(DeprecatedString const& path, i32 request_id)
@ -305,9 +363,4 @@ void WebContentClient::did_finish_handling_input_event(bool event_was_accepted)
m_view.notify_server_did_finish_handling_input_event(event_was_accepted);
}
void WebContentClient::did_get_accessibility_tree(DeprecatedString const& accessibility_tree)
{
m_view.notify_server_did_get_accessibility_tree(accessibility_tree);
}
}

View file

@ -79,8 +79,6 @@ public:
return String::from_deprecated_string(client().dump_layout_tree());
}
Function<void(const URL&)> on_load_finish;
private:
HeadlessWebContentView() = default;
@ -89,59 +87,17 @@ private:
void notify_server_did_invalidate_content_rect(Badge<WebView::WebContentClient>, Gfx::IntRect const&) override { }
void notify_server_did_change_selection(Badge<WebView::WebContentClient>) override { }
void notify_server_did_request_cursor_change(Badge<WebView::WebContentClient>, Gfx::StandardCursor) override { }
void notify_server_did_change_title(Badge<WebView::WebContentClient>, DeprecatedString const&) override { }
void notify_server_did_request_scroll(Badge<WebView::WebContentClient>, i32, i32) override { }
void notify_server_did_request_scroll_to(Badge<WebView::WebContentClient>, Gfx::IntPoint) override { }
void notify_server_did_request_scroll_into_view(Badge<WebView::WebContentClient>, Gfx::IntRect const&) override { }
void notify_server_did_enter_tooltip_area(Badge<WebView::WebContentClient>, Gfx::IntPoint, DeprecatedString const&) override { }
void notify_server_did_leave_tooltip_area(Badge<WebView::WebContentClient>) override { }
void notify_server_did_hover_link(Badge<WebView::WebContentClient>, const URL&) override { }
void notify_server_did_unhover_link(Badge<WebView::WebContentClient>) override { }
void notify_server_did_click_link(Badge<WebView::WebContentClient>, const URL&, DeprecatedString const&, unsigned) override { }
void notify_server_did_middle_click_link(Badge<WebView::WebContentClient>, const URL&, DeprecatedString const&, unsigned) override { }
void notify_server_did_start_loading(Badge<WebView::WebContentClient>, const URL&, bool) override { }
void notify_server_did_finish_loading(Badge<WebView::WebContentClient>, const URL& url) override
{
if (on_load_finish)
on_load_finish(url);
}
void notify_server_did_request_navigate_back(Badge<WebView::WebContentClient>) override { }
void notify_server_did_request_navigate_forward(Badge<WebView::WebContentClient>) override { }
void notify_server_did_request_refresh(Badge<WebView::WebContentClient>) override { }
void notify_server_did_request_context_menu(Badge<WebView::WebContentClient>, Gfx::IntPoint) override { }
void notify_server_did_request_link_context_menu(Badge<WebView::WebContentClient>, Gfx::IntPoint, const URL&, DeprecatedString const&, unsigned) override { }
void notify_server_did_request_image_context_menu(Badge<WebView::WebContentClient>, Gfx::IntPoint, const URL&, DeprecatedString const&, unsigned, Gfx::ShareableBitmap const&) override { }
void notify_server_did_request_video_context_menu(Badge<WebView::WebContentClient>, Gfx::IntPoint, const URL&, DeprecatedString const&, unsigned, bool, bool, bool) override { }
void notify_server_did_request_alert(Badge<WebView::WebContentClient>, String const&) override { }
void notify_server_did_request_confirm(Badge<WebView::WebContentClient>, String const&) override { }
void notify_server_did_request_prompt(Badge<WebView::WebContentClient>, String const&, String const&) override { }
void notify_server_did_request_set_prompt_text(Badge<WebView::WebContentClient>, String const&) override { }
void notify_server_did_request_accept_dialog(Badge<WebView::WebContentClient>) override { }
void notify_server_did_request_dismiss_dialog(Badge<WebView::WebContentClient>) override { }
void notify_server_did_get_source(const URL&, DeprecatedString const&) override { }
void notify_server_did_get_dom_tree(DeprecatedString const&) override { }
void notify_server_did_get_dom_node_properties(i32, DeprecatedString const&, DeprecatedString const&, DeprecatedString const&, DeprecatedString const&) override { }
void notify_server_did_get_accessibility_tree(DeprecatedString const&) override { }
void notify_server_did_output_js_console_message(i32) override { }
void notify_server_did_get_js_console_messages(i32, Vector<DeprecatedString> const&, Vector<DeprecatedString> const&) override { }
void notify_server_did_change_favicon(Gfx::Bitmap const&) override { }
Vector<Web::Cookie::Cookie> notify_server_did_request_all_cookies(Badge<WebView::WebContentClient>, URL const&) override { return {}; }
Optional<Web::Cookie::Cookie> notify_server_did_request_named_cookie(Badge<WebView::WebContentClient>, URL const&, DeprecatedString const&) override { return {}; }
DeprecatedString notify_server_did_request_cookie(Badge<WebView::WebContentClient>, const URL&, Web::Cookie::Source) override { return {}; }
void notify_server_did_set_cookie(Badge<WebView::WebContentClient>, const URL&, Web::Cookie::ParsedCookie const&, Web::Cookie::Source) override { }
void notify_server_did_update_cookie(Badge<WebView::WebContentClient>, Web::Cookie::Cookie const&) override { }
String notify_server_did_request_new_tab(Badge<WebView::WebContentClient>, Web::HTML::ActivateTab) override { return {}; }
void notify_server_did_request_activate_tab(Badge<WebView::WebContentClient>) override { }
void notify_server_did_close_browsing_context(Badge<WebView::WebContentClient>) override { }
void notify_server_did_update_resource_count(i32) override { }
void notify_server_did_request_restore_window() override { }
Gfx::IntPoint notify_server_did_request_reposition_window(Gfx::IntPoint) override { return {}; }
Gfx::IntSize notify_server_did_request_resize_window(Gfx::IntSize) override { return {}; }
Gfx::IntRect notify_server_did_request_maximize_window() override { return {}; }
Gfx::IntRect notify_server_did_request_minimize_window() override { return {}; }
Gfx::IntRect notify_server_did_request_fullscreen_window() override { return {}; }
void notify_server_did_request_file(Badge<WebView::WebContentClient>, DeprecatedString const& path, i32 request_id) override
{