summaryrefslogtreecommitdiff
path: root/Userland
diff options
context:
space:
mode:
Diffstat (limited to 'Userland')
-rw-r--r--Userland/Libraries/LibWeb/OutOfProcessWebView.cpp5
-rw-r--r--Userland/Libraries/LibWeb/OutOfProcessWebView.h1
-rw-r--r--Userland/Libraries/LibWeb/Page/EventHandler.cpp4
-rw-r--r--Userland/Libraries/LibWeb/Page/Page.h1
-rw-r--r--Userland/Libraries/LibWeb/WebContentClient.cpp5
-rw-r--r--Userland/Libraries/LibWeb/WebContentClient.h1
-rw-r--r--Userland/Services/WebContent/PageHost.cpp5
-rw-r--r--Userland/Services/WebContent/PageHost.h1
-rw-r--r--Userland/Services/WebContent/WebContentClient.ipc1
9 files changed, 24 insertions, 0 deletions
diff --git a/Userland/Libraries/LibWeb/OutOfProcessWebView.cpp b/Userland/Libraries/LibWeb/OutOfProcessWebView.cpp
index d237314168..ad736e70f3 100644
--- a/Userland/Libraries/LibWeb/OutOfProcessWebView.cpp
+++ b/Userland/Libraries/LibWeb/OutOfProcessWebView.cpp
@@ -245,6 +245,11 @@ void OutOfProcessWebView::notify_server_did_change_title(Badge<WebContentClient>
on_title_change(title);
}
+void OutOfProcessWebView::notify_server_did_request_scroll(Badge<WebContentClient>, int wheel_delta)
+{
+ vertical_scrollbar().set_value(vertical_scrollbar().value() + wheel_delta * 20);
+}
+
void OutOfProcessWebView::notify_server_did_request_scroll_into_view(Badge<WebContentClient>, const Gfx::IntRect& rect)
{
scroll_into_view(rect, true, true);
diff --git a/Userland/Libraries/LibWeb/OutOfProcessWebView.h b/Userland/Libraries/LibWeb/OutOfProcessWebView.h
index 82a663ce9c..c4f353e3c5 100644
--- a/Userland/Libraries/LibWeb/OutOfProcessWebView.h
+++ b/Userland/Libraries/LibWeb/OutOfProcessWebView.h
@@ -60,6 +60,7 @@ public:
void notify_server_did_change_selection(Badge<WebContentClient>);
void notify_server_did_request_cursor_change(Badge<WebContentClient>, Gfx::StandardCursor cursor);
void notify_server_did_change_title(Badge<WebContentClient>, const String&);
+ void notify_server_did_request_scroll(Badge<WebContentClient>, int);
void notify_server_did_request_scroll_into_view(Badge<WebContentClient>, const Gfx::IntRect&);
void notify_server_did_hover_link(Badge<WebContentClient>, const URL&);
void notify_server_did_unhover_link(Badge<WebContentClient>);
diff --git a/Userland/Libraries/LibWeb/Page/EventHandler.cpp b/Userland/Libraries/LibWeb/Page/EventHandler.cpp
index f4f4cd886d..7539f92f04 100644
--- a/Userland/Libraries/LibWeb/Page/EventHandler.cpp
+++ b/Userland/Libraries/LibWeb/Page/EventHandler.cpp
@@ -141,6 +141,10 @@ bool EventHandler::handle_mousewheel(const Gfx::IntPoint& position, unsigned int
if (result.layout_node) {
if (result.layout_node->handle_mousewheel({}, position, buttons, modifiers, wheel_delta))
return true;
+ }
+
+ if (auto* page = m_frame.page()) {
+ page->client().page_did_request_scroll(wheel_delta);
return true;
}
diff --git a/Userland/Libraries/LibWeb/Page/Page.h b/Userland/Libraries/LibWeb/Page/Page.h
index 589159cc48..a45072edab 100644
--- a/Userland/Libraries/LibWeb/Page/Page.h
+++ b/Userland/Libraries/LibWeb/Page/Page.h
@@ -104,6 +104,7 @@ public:
virtual void page_did_invalidate(const Gfx::IntRect&) { }
virtual void page_did_change_favicon(const Gfx::Bitmap&) { }
virtual void page_did_layout() { }
+ virtual void page_did_request_scroll(int) { }
virtual void page_did_request_scroll_into_view(const Gfx::IntRect&) { }
virtual void page_did_request_alert(const String&) { }
virtual bool page_did_request_confirm(const String&) { return false; }
diff --git a/Userland/Libraries/LibWeb/WebContentClient.cpp b/Userland/Libraries/LibWeb/WebContentClient.cpp
index cc0db47d84..9dfbfc9702 100644
--- a/Userland/Libraries/LibWeb/WebContentClient.cpp
+++ b/Userland/Libraries/LibWeb/WebContentClient.cpp
@@ -95,6 +95,11 @@ void WebContentClient::handle(const Messages::WebContentClient::DidChangeTitle&
m_view.notify_server_did_change_title({}, message.title());
}
+void WebContentClient::handle(const Messages::WebContentClient::DidRequestScroll& message)
+{
+ m_view.notify_server_did_request_scroll({}, message.wheel_delta());
+}
+
void WebContentClient::handle(const Messages::WebContentClient::DidRequestScrollIntoView& message)
{
dbgln_if(SPAM_DEBUG, "handle: WebContentClient::DidRequestScrollIntoView! rect={}", message.rect());
diff --git a/Userland/Libraries/LibWeb/WebContentClient.h b/Userland/Libraries/LibWeb/WebContentClient.h
index 33e22a9ad6..5f83d1eb4a 100644
--- a/Userland/Libraries/LibWeb/WebContentClient.h
+++ b/Userland/Libraries/LibWeb/WebContentClient.h
@@ -57,6 +57,7 @@ private:
virtual void handle(const Messages::WebContentClient::DidRequestCursorChange&) override;
virtual void handle(const Messages::WebContentClient::DidLayout&) override;
virtual void handle(const Messages::WebContentClient::DidChangeTitle&) override;
+ virtual void handle(const Messages::WebContentClient::DidRequestScroll&) override;
virtual void handle(const Messages::WebContentClient::DidRequestScrollIntoView&) override;
virtual void handle(const Messages::WebContentClient::DidHoverLink&) override;
virtual void handle(const Messages::WebContentClient::DidUnhoverLink&) override;
diff --git a/Userland/Services/WebContent/PageHost.cpp b/Userland/Services/WebContent/PageHost.cpp
index 1818313d29..4ffabbc4c3 100644
--- a/Userland/Services/WebContent/PageHost.cpp
+++ b/Userland/Services/WebContent/PageHost.cpp
@@ -131,6 +131,11 @@ void PageHost::page_did_change_title(const String& title)
m_client.post_message(Messages::WebContentClient::DidChangeTitle(title));
}
+void PageHost::page_did_request_scroll(int wheel_delta)
+{
+ m_client.post_message(Messages::WebContentClient::DidRequestScroll(wheel_delta));
+}
+
void PageHost::page_did_request_scroll_into_view(const Gfx::IntRect& rect)
{
m_client.post_message(Messages::WebContentClient::DidRequestScrollIntoView(rect));
diff --git a/Userland/Services/WebContent/PageHost.h b/Userland/Services/WebContent/PageHost.h
index 29f28da8d8..066dd69481 100644
--- a/Userland/Services/WebContent/PageHost.h
+++ b/Userland/Services/WebContent/PageHost.h
@@ -59,6 +59,7 @@ private:
virtual void page_did_request_cursor_change(Gfx::StandardCursor) override;
virtual void page_did_layout() override;
virtual void page_did_change_title(const String&) override;
+ virtual void page_did_request_scroll(int) override;
virtual void page_did_request_scroll_into_view(const Gfx::IntRect&) override;
virtual void page_did_hover_link(const URL&) override;
virtual void page_did_unhover_link() override;
diff --git a/Userland/Services/WebContent/WebContentClient.ipc b/Userland/Services/WebContent/WebContentClient.ipc
index af3e80d18a..6d1b7ebd3a 100644
--- a/Userland/Services/WebContent/WebContentClient.ipc
+++ b/Userland/Services/WebContent/WebContentClient.ipc
@@ -8,6 +8,7 @@ endpoint WebContentClient = 90
DidRequestCursorChange(i32 cursor_type) =|
DidLayout(Gfx::IntSize content_size) =|
DidChangeTitle(String title) =|
+ DidRequestScroll(int wheel_delta) =|
DidRequestScrollIntoView(Gfx::IntRect rect) =|
DidHoverLink(URL url) =|
DidUnhoverLink() =|