mirror of
https://github.com/RGBCube/serenity
synced 2025-05-31 14:28:12 +00:00
LibWebView+Ladybird: Remove duplicate WebContent callback
We have on_navigate_back + on_back_button and on_navigate_forward + on_forward_button. Remove the *_button variants.
This commit is contained in:
parent
1adf06c9f0
commit
9608bfb576
5 changed files with 14 additions and 28 deletions
|
@ -113,14 +113,6 @@ Tab::Tab(BrowserWindow* window, StringView webdriver_content_ipc_path, WebView::
|
||||||
m_hover_label->hide();
|
m_hover_label->hide();
|
||||||
};
|
};
|
||||||
|
|
||||||
view().on_back_button = [this] {
|
|
||||||
back();
|
|
||||||
};
|
|
||||||
|
|
||||||
view().on_forward_button = [this] {
|
|
||||||
forward();
|
|
||||||
};
|
|
||||||
|
|
||||||
view().on_load_start = [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
|
// If we are loading due to a redirect, we replace the current history entry
|
||||||
// with the loaded URL
|
// with the loaded URL
|
||||||
|
|
|
@ -324,11 +324,11 @@ void WebContentView::mouseReleaseEvent(QMouseEvent* event)
|
||||||
auto button = get_button_from_qt_event(*event);
|
auto button = get_button_from_qt_event(*event);
|
||||||
|
|
||||||
if (event->button() & Qt::MouseButton::BackButton) {
|
if (event->button() & Qt::MouseButton::BackButton) {
|
||||||
if (on_back_button)
|
if (on_navigate_back)
|
||||||
on_back_button();
|
on_navigate_back();
|
||||||
} else if (event->button() & Qt::MouseButton::ForwardButton) {
|
} else if (event->button() & Qt::MouseButton::ForwardButton) {
|
||||||
if (on_forward_button)
|
if (on_navigate_forward)
|
||||||
on_forward_button();
|
on_navigate_forward();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (button == 0) {
|
if (button == 0) {
|
||||||
|
|
|
@ -554,16 +554,6 @@ Tab::Tab(BrowserWindow& window)
|
||||||
update_status();
|
update_status();
|
||||||
};
|
};
|
||||||
|
|
||||||
view().on_back_button = [this] {
|
|
||||||
if (m_history.can_go_back())
|
|
||||||
go_back();
|
|
||||||
};
|
|
||||||
|
|
||||||
view().on_forward_button = [this] {
|
|
||||||
if (m_history.can_go_forward())
|
|
||||||
go_forward();
|
|
||||||
};
|
|
||||||
|
|
||||||
view().on_new_tab = [this](auto activate_tab) {
|
view().on_new_tab = [this](auto activate_tab) {
|
||||||
auto& tab = this->window().create_new_tab(URL("about:blank"), activate_tab);
|
auto& tab = this->window().create_new_tab(URL("about:blank"), activate_tab);
|
||||||
return tab.view().handle();
|
return tab.view().handle();
|
||||||
|
@ -689,6 +679,9 @@ void Tab::reload()
|
||||||
|
|
||||||
void Tab::go_back(int steps)
|
void Tab::go_back(int steps)
|
||||||
{
|
{
|
||||||
|
if (!m_history.can_go_back(steps))
|
||||||
|
return;
|
||||||
|
|
||||||
m_history.go_back(steps);
|
m_history.go_back(steps);
|
||||||
update_actions();
|
update_actions();
|
||||||
load(m_history.current().url, LoadType::HistoryNavigation);
|
load(m_history.current().url, LoadType::HistoryNavigation);
|
||||||
|
@ -696,6 +689,9 @@ void Tab::go_back(int steps)
|
||||||
|
|
||||||
void Tab::go_forward(int steps)
|
void Tab::go_forward(int steps)
|
||||||
{
|
{
|
||||||
|
if (!m_history.can_go_forward(steps))
|
||||||
|
return;
|
||||||
|
|
||||||
m_history.go_forward(steps);
|
m_history.go_forward(steps);
|
||||||
update_actions();
|
update_actions();
|
||||||
load(m_history.current().url, LoadType::HistoryNavigation);
|
load(m_history.current().url, LoadType::HistoryNavigation);
|
||||||
|
|
|
@ -134,11 +134,11 @@ void OutOfProcessWebView::mouseup_event(GUI::MouseEvent& event)
|
||||||
enqueue_input_event(event);
|
enqueue_input_event(event);
|
||||||
|
|
||||||
if (event.button() == GUI::MouseButton::Backward) {
|
if (event.button() == GUI::MouseButton::Backward) {
|
||||||
if (on_back_button)
|
if (on_navigate_back)
|
||||||
on_back_button();
|
on_navigate_back();
|
||||||
} else if (event.button() == GUI::MouseButton::Forward) {
|
} else if (event.button() == GUI::MouseButton::Forward) {
|
||||||
if (on_forward_button)
|
if (on_navigate_forward)
|
||||||
on_forward_button();
|
on_navigate_forward();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -122,8 +122,6 @@ public:
|
||||||
Function<Gfx::IntRect()> on_maximize_window;
|
Function<Gfx::IntRect()> on_maximize_window;
|
||||||
Function<Gfx::IntRect()> on_minimize_window;
|
Function<Gfx::IntRect()> on_minimize_window;
|
||||||
Function<Gfx::IntRect()> on_fullscreen_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_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_paint(Badge<WebContentClient>, i32 bitmap_id, Gfx::IntSize) = 0;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue