LibWeb+LibWebView+WebContent: Add did_update_navigation_buttons_state()

It is going to be used to communicate whether it is possible to navigate
back or forward after session history stored on browser side will no
longer be used to driver navigation.
This commit is contained in:
Aliaksandr Kalenik 2024-04-13 23:12:55 +02:00 committed by Alexander Kalenik
commit 461184d964
Notes: sideshowbarker 2024-07-16 22:14:49 +09:00
9 changed files with 30 additions and 0 deletions

View file

@ -782,6 +782,12 @@ TraversableNavigable::HistoryStepResult TraversableNavigable::apply_the_history_
// 20. Set traversable's current session history step to targetStep.
m_current_session_history_step = target_step;
// Not in the spec:
auto back_enabled = m_current_session_history_step > 0;
VERIFY(m_session_history_entries.size() > 0);
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);
// 21. Return "applied".
return HistoryStepResult::Applied;
}