LibWeb: Rename did_update_url() to did_history_api_push_or_replace()

The previous name was extremely misleading, because the call is used for
pushing or replacing new session history entry on chrome side instead of
only changing URL.
This commit is contained in:
Aliaksandr Kalenik 2024-04-13 23:25:10 +02:00 committed by Alexander Kalenik
parent 461184d964
commit a8cf1aca7c
11 changed files with 14 additions and 14 deletions

View file

@ -282,7 +282,7 @@ static void copy_data_to_clipboard(StringView data, NSPasteboardType pasteboard_
[self.observer onLoadFinish:url];
};
m_web_view_bridge->on_url_updated = [self](auto const& url, auto history_behavior) {
m_web_view_bridge->on_history_api_push_or_replace = [self](auto const& url, auto history_behavior) {
[self.observer onURLUpdated:url historyBehavior:history_behavior];
};

View file

@ -150,7 +150,7 @@ Tab::Tab(BrowserWindow* window, WebContentOptions const& web_content_options, St
m_inspector_widget->inspect();
};
view().on_url_updated = [this](auto const& url, auto history_behavior) {
view().on_history_api_push_or_replace = [this](auto const& url, auto history_behavior) {
switch (history_behavior) {
case Web::HTML::HistoryHandlingBehavior::Push:
m_history.push(url, m_title.toUtf8().data());

View file

@ -262,7 +262,7 @@ Tab::Tab(BrowserWindow& window)
m_dom_inspector_widget->inspect();
};
view().on_url_updated = [this](auto const& url, auto history_behavior) {
view().on_history_api_push_or_replace = [this](auto const& url, auto history_behavior) {
switch (history_behavior) {
case Web::HTML::HistoryHandlingBehavior::Push:
m_history.push(url, m_title);

View file

@ -215,7 +215,7 @@ WebIDL::ExceptionOr<void> History::shared_history_push_replace_state(JS::Value d
auto navigable = document->navigable();
if (navigable->is_top_level_traversable()) {
navigable->active_browsing_context()->page().client().page_did_update_url(new_url, history_handling);
navigable->active_browsing_context()->page().client().page_did_history_api_push_or_replace(new_url, history_handling);
}
// 10. Run the URL and history update steps given document and newURL, with serializedData set to

View file

@ -265,7 +265,7 @@ public:
virtual void page_did_change_active_document_in_top_level_browsing_context(Web::DOM::Document&) { }
virtual void page_did_destroy_document(Web::DOM::Document&) { }
virtual void page_did_finish_loading(URL::URL const&) { }
virtual void page_did_update_url(URL::URL const&, Web::HTML::HistoryHandlingBehavior) { }
virtual void page_did_history_api_push_or_replace(URL::URL const&, Web::HTML::HistoryHandlingBehavior) { }
virtual void page_did_request_cursor_change(Gfx::StandardCursor) { }
virtual void page_did_request_context_menu(CSSPixelPoint) { }
virtual void page_did_request_link_context_menu(CSSPixelPoint, URL::URL const&, [[maybe_unused]] ByteString const& target, [[maybe_unused]] unsigned modifiers) { }

View file

@ -145,7 +145,7 @@ public:
Function<void(ByteString const&)> on_title_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_url_updated;
Function<void(URL::URL const&, Web::HTML::HistoryHandlingBehavior)> on_history_api_push_or_replace;
Function<void(ByteString const& path, i32)> on_request_file;
Function<void()> on_navigate_back;
Function<void()> on_navigate_forward;

View file

@ -66,13 +66,13 @@ void WebContentClient::did_finish_loading(u64 page_id, URL::URL const& url)
}
}
void WebContentClient::did_update_url(u64 page_id, URL::URL const& url, Web::HTML::HistoryHandlingBehavior history_behavior)
void WebContentClient::did_history_api_push_or_replace(u64 page_id, URL::URL const& url, Web::HTML::HistoryHandlingBehavior history_behavior)
{
if (auto view = view_for_page_id(page_id); view.has_value()) {
view->set_url({}, url);
if (view->on_url_updated)
view->on_url_updated(url, history_behavior);
if (view->on_history_api_push_or_replace)
view->on_history_api_push_or_replace(url, history_behavior);
}
}

View file

@ -40,7 +40,7 @@ private:
virtual void notify_process_information(WebView::ProcessHandle const&) override;
virtual void did_paint(u64 page_id, Gfx::IntRect const&, i32) override;
virtual void did_finish_loading(u64 page_id, URL::URL const&) override;
virtual void did_update_url(u64 page_id, URL::URL const& url, Web::HTML::HistoryHandlingBehavior history_behavior) override;
virtual void did_history_api_push_or_replace(u64 page_id, URL::URL const& url, Web::HTML::HistoryHandlingBehavior history_behavior) override;
virtual void did_request_navigate_back(u64 page_id) override;
virtual void did_request_navigate_forward(u64 page_id) override;
virtual void did_request_refresh(u64 page_id) override;

View file

@ -371,9 +371,9 @@ void PageClient::page_did_finish_loading(URL::URL const& url)
client().async_did_finish_loading(m_id, url);
}
void PageClient::page_did_update_url(URL::URL const& url, Web::HTML::HistoryHandlingBehavior history_behavior)
void PageClient::page_did_history_api_push_or_replace(URL::URL const& url, Web::HTML::HistoryHandlingBehavior history_behavior)
{
client().async_did_update_url(m_id, url, history_behavior);
client().async_did_history_api_push_or_replace(m_id, url, history_behavior);
}
void PageClient::page_did_finish_text_test()

View file

@ -120,7 +120,7 @@ private:
virtual void page_did_change_active_document_in_top_level_browsing_context(Web::DOM::Document&) override;
virtual void page_did_destroy_document(Web::DOM::Document&) override;
virtual void page_did_finish_loading(URL::URL const&) override;
virtual void page_did_update_url(URL::URL const&, Web::HTML::HistoryHandlingBehavior) override;
virtual void page_did_history_api_push_or_replace(URL::URL const&, Web::HTML::HistoryHandlingBehavior) override;
virtual void page_did_request_alert(String const&) override;
virtual void page_did_request_confirm(String const&) override;
virtual void page_did_request_prompt(String const&, String const&) override;

View file

@ -23,7 +23,7 @@ endpoint WebContentClient
did_start_loading(u64 page_id, URL::URL url, bool is_redirect) =|
did_finish_loading(u64 page_id, URL::URL url) =|
did_update_url(u64 page_id, URL::URL url, Web::HTML::HistoryHandlingBehavior history_behavior) =|
did_history_api_push_or_replace(u64 page_id, URL::URL url, Web::HTML::HistoryHandlingBehavior history_behavior) =|
did_request_navigate_back(u64 page_id) =|
did_request_navigate_forward(u64 page_id) =|
did_request_refresh(u64 page_id) =|