1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-27 01:37:36 +00:00

Browser: Simplify the History class and fix back/forward history push

This code was previously relying on the PageView::on_load_start hook
firing synchronously when calling PageView::load(). This was not
happening with WebContentView, so it broke the back/forward history.

Instead, we now differentiate between history navigations and normal
loads in Tab::load(). History navigations don't push new entries into
history, but instead just move the history pointer.
This commit is contained in:
Andreas Kling 2020-07-07 15:04:05 +02:00
parent b5e04cb070
commit 1493dd9dc6
5 changed files with 119 additions and 76 deletions

View file

@ -53,8 +53,15 @@ public:
URL url() const;
void load(const URL&);
enum class LoadType {
Normal,
HistoryNavigation,
};
void load(const URL&, LoadType = LoadType::Normal);
void reload();
void go_back();
void go_forward();
void did_become_active();
void context_menu_requested(const Gfx::IntPoint& screen_position);
@ -78,7 +85,7 @@ private:
Type m_type;
History<URL> m_history;
History m_history;
RefPtr<Web::PageView> m_page_view;
RefPtr<WebContentView> m_web_content_view;
@ -102,8 +109,6 @@ private:
String m_title;
RefPtr<const Gfx::Bitmap> m_icon;
bool m_should_push_loads_to_history { true };
};
}