LibWeb+LibWebView+WebContent: Add did_change_url() IPC call
This commit is contained in:
parent
a8cf1aca7c
commit
c96fc902ff
Notes:
sideshowbarker
2024-07-16 20:51:53 +09:00
Author: https://github.com/kalenikaliaksandr Commit: https://github.com/SerenityOS/serenity/commit/c96fc902ff Pull-request: https://github.com/SerenityOS/serenity/pull/23952 Reviewed-by: https://github.com/trflynn89
8 changed files with 20 additions and 0 deletions
|
@ -788,6 +788,8 @@ TraversableNavigable::HistoryStepResult TraversableNavigable::apply_the_history_
|
|||
auto forward_enabled = m_current_session_history_step < static_cast<int>(m_session_history_entries.size()) - 1;
|
||||
page().client().page_did_update_navigation_buttons_state(back_enabled, forward_enabled);
|
||||
|
||||
page().client().page_did_change_url(current_session_history_entry()->url());
|
||||
|
||||
// 21. Return "applied".
|
||||
return HistoryStepResult::Applied;
|
||||
}
|
||||
|
|
|
@ -251,6 +251,7 @@ public:
|
|||
virtual CSS::PreferredColorScheme preferred_color_scheme() const = 0;
|
||||
virtual void paint(DevicePixelRect const&, Gfx::Bitmap&, PaintOptions = {}) = 0;
|
||||
virtual void page_did_change_title(ByteString const&) { }
|
||||
virtual void page_did_change_url(URL::URL const&) { }
|
||||
virtual void page_did_request_navigate_back() { }
|
||||
virtual void page_did_request_navigate_forward() { }
|
||||
virtual void page_did_request_refresh() { }
|
||||
|
|
|
@ -143,6 +143,7 @@ public:
|
|||
Function<void(URL::URL const&, ByteString const& target, unsigned modifiers)> on_link_click;
|
||||
Function<void(URL::URL const&, ByteString const& target, unsigned modifiers)> on_link_middle_click;
|
||||
Function<void(ByteString const&)> on_title_change;
|
||||
Function<void(URL::URL const&)> on_url_change;
|
||||
Function<void(URL::URL const&, bool)> on_load_start;
|
||||
Function<void(URL::URL const&)> on_load_finish;
|
||||
Function<void(URL::URL const&, Web::HTML::HistoryHandlingBehavior)> on_history_api_push_or_replace;
|
||||
|
|
|
@ -142,6 +142,14 @@ void WebContentClient::did_change_title(u64 page_id, ByteString const& title)
|
|||
}
|
||||
}
|
||||
|
||||
void WebContentClient::did_change_url(u64 page_id, URL::URL const& url)
|
||||
{
|
||||
if (auto view = view_for_page_id(page_id); view.has_value()) {
|
||||
if (view->on_url_change)
|
||||
view->on_url_change(url);
|
||||
}
|
||||
}
|
||||
|
||||
void WebContentClient::did_request_scroll(u64 page_id, i32 x_delta, i32 y_delta)
|
||||
{
|
||||
if (auto view = view_for_page_id(page_id); view.has_value()) {
|
||||
|
|
|
@ -47,6 +47,7 @@ private:
|
|||
virtual void did_request_cursor_change(u64 page_id, i32) override;
|
||||
virtual void did_layout(u64 page_id, Gfx::IntSize) override;
|
||||
virtual void did_change_title(u64 page_id, ByteString const&) override;
|
||||
virtual void did_change_url(u64 page_id, URL::URL const&) override;
|
||||
virtual void did_request_scroll(u64 page_id, i32, i32) override;
|
||||
virtual void did_request_scroll_to(u64 page_id, Gfx::IntPoint) override;
|
||||
virtual void did_enter_tooltip_area(u64 page_id, Gfx::IntPoint, ByteString const&) override;
|
||||
|
|
|
@ -257,6 +257,11 @@ void PageClient::page_did_change_title(ByteString const& title)
|
|||
client().async_did_change_title(m_id, title);
|
||||
}
|
||||
|
||||
void PageClient::page_did_change_url(URL::URL const& url)
|
||||
{
|
||||
client().async_did_change_url(m_id, url);
|
||||
}
|
||||
|
||||
void PageClient::page_did_request_navigate_back()
|
||||
{
|
||||
client().async_did_request_navigate_back(m_id);
|
||||
|
|
|
@ -95,6 +95,7 @@ private:
|
|||
virtual void page_did_request_cursor_change(Gfx::StandardCursor) override;
|
||||
virtual void page_did_layout() override;
|
||||
virtual void page_did_change_title(ByteString const&) override;
|
||||
virtual void page_did_change_url(URL::URL const&) override;
|
||||
virtual void page_did_request_navigate_back() override;
|
||||
virtual void page_did_request_navigate_forward() override;
|
||||
virtual void page_did_request_refresh() override;
|
||||
|
|
|
@ -31,6 +31,7 @@ endpoint WebContentClient
|
|||
did_request_cursor_change(u64 page_id, i32 cursor_type) =|
|
||||
did_layout(u64 page_id, Gfx::IntSize content_size) =|
|
||||
did_change_title(u64 page_id, ByteString title) =|
|
||||
did_change_url(u64 page_id, URL::URL url) =|
|
||||
did_request_scroll(u64 page_id, i32 x_delta, i32 y_delta) =|
|
||||
did_request_scroll_to(u64 page_id, Gfx::IntPoint scroll_position) =|
|
||||
did_enter_tooltip_area(u64 page_id, Gfx::IntPoint content_position, ByteString title) =|
|
||||
|
|
Loading…
Add table
Reference in a new issue