diff --git a/Userland/Libraries/LibWeb/Page/Page.cpp b/Userland/Libraries/LibWeb/Page/Page.cpp index ad4d53f89c3..7cb246af910 100644 --- a/Userland/Libraries/LibWeb/Page/Page.cpp +++ b/Userland/Libraries/LibWeb/Page/Page.cpp @@ -79,6 +79,11 @@ void Page::reload() top_level_traversable()->reload(); } +void Page::traverse_the_history_by_delta(int delta) +{ + top_level_traversable()->traverse_the_history_by_delta(delta); +} + Gfx::Palette Page::palette() const { return m_client->palette(); diff --git a/Userland/Libraries/LibWeb/Page/Page.h b/Userland/Libraries/LibWeb/Page/Page.h index eaf5362f57e..868dd9b7151 100644 --- a/Userland/Libraries/LibWeb/Page/Page.h +++ b/Userland/Libraries/LibWeb/Page/Page.h @@ -78,6 +78,8 @@ public: void reload(); + void traverse_the_history_by_delta(int delta); + CSSPixelPoint device_to_css_point(DevicePixelPoint) const; DevicePixelPoint css_to_device_point(CSSPixelPoint) const; DevicePixelRect css_to_device_rect(CSSPixelRect) const; diff --git a/Userland/Libraries/LibWebView/ViewImplementation.cpp b/Userland/Libraries/LibWebView/ViewImplementation.cpp index d909eb38477..49c6c50d163 100644 --- a/Userland/Libraries/LibWebView/ViewImplementation.cpp +++ b/Userland/Libraries/LibWebView/ViewImplementation.cpp @@ -95,6 +95,11 @@ void ViewImplementation::reload() client().async_reload(page_id()); } +void ViewImplementation::traverse_the_history_by_delta(int delta) +{ + client().async_traverse_the_history_by_delta(page_id(), delta); +} + void ViewImplementation::zoom_in() { if (m_zoom_level >= ZOOM_MAX_LEVEL) diff --git a/Userland/Libraries/LibWebView/ViewImplementation.h b/Userland/Libraries/LibWebView/ViewImplementation.h index d6708007d69..848b8a2018f 100644 --- a/Userland/Libraries/LibWebView/ViewImplementation.h +++ b/Userland/Libraries/LibWebView/ViewImplementation.h @@ -50,6 +50,7 @@ public: void load_html(StringView); void load_empty_document(); void reload(); + void traverse_the_history_by_delta(int delta); void zoom_in(); void zoom_out(); diff --git a/Userland/Services/WebContent/ConnectionFromClient.cpp b/Userland/Services/WebContent/ConnectionFromClient.cpp index c0f794c877f..2a6558bdabe 100644 --- a/Userland/Services/WebContent/ConnectionFromClient.cpp +++ b/Userland/Services/WebContent/ConnectionFromClient.cpp @@ -162,6 +162,12 @@ void ConnectionFromClient::reload(u64 page_id) page->page().reload(); } +void ConnectionFromClient::traverse_the_history_by_delta(u64 page_id, i32 delta) +{ + if (auto page = this->page(page_id); page.has_value()) + page->page().traverse_the_history_by_delta(delta); +} + void ConnectionFromClient::set_viewport_rect(u64 page_id, Web::DevicePixelRect const& rect) { if (auto page = this->page(page_id); page.has_value()) diff --git a/Userland/Services/WebContent/ConnectionFromClient.h b/Userland/Services/WebContent/ConnectionFromClient.h index 80a86219580..6759c961638 100644 --- a/Userland/Services/WebContent/ConnectionFromClient.h +++ b/Userland/Services/WebContent/ConnectionFromClient.h @@ -58,6 +58,7 @@ private: virtual void load_url(u64 page_id, URL::URL const&) override; virtual void load_html(u64 page_id, ByteString const&) override; virtual void reload(u64 page_id) override; + virtual void traverse_the_history_by_delta(u64 page_id, i32 delta) override; virtual void set_viewport_rect(u64 page_id, Web::DevicePixelRect const&) override; virtual void key_event(u64 page_id, Web::KeyEvent const&) override; virtual void mouse_event(u64 page_id, Web::MouseEvent const&) override; diff --git a/Userland/Services/WebContent/WebContentServer.ipc b/Userland/Services/WebContent/WebContentServer.ipc index f0967d9050d..90634584ca5 100644 --- a/Userland/Services/WebContent/WebContentServer.ipc +++ b/Userland/Services/WebContent/WebContentServer.ipc @@ -25,6 +25,7 @@ endpoint WebContentServer load_url(u64 page_id, URL::URL url) =| load_html(u64 page_id, ByteString html) =| reload(u64 page_id) =| + traverse_the_history_by_delta(u64 page_id, i32 delta) =| add_backing_store(u64 page_id, i32 front_bitmap_id, Gfx::ShareableBitmap front_bitmap, i32 back_bitmap_id, Gfx::ShareableBitmap back_bitmap) =| ready_to_paint(u64 page_id) =|