summaryrefslogtreecommitdiff
path: root/Userland
diff options
context:
space:
mode:
authorAdam Hodgen <ant1441@gmail.com>2021-02-27 21:12:12 +0000
committerAndreas Kling <kling@serenityos.org>2021-02-28 18:19:52 +0100
commitbedcd9cd886af52e943157bda5f33b8e9e782d22 (patch)
tree3453b429de5a731bfbe7d639cf48c06df497b752 /Userland
parentfc9225db332a312aa505c83a9a50a7924710a7f8 (diff)
downloadserenity-bedcd9cd886af52e943157bda5f33b8e9e782d22.zip
LibWeb: Support setting the cursor in OutOfProcessWebView
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/WebContentClient.cpp9
-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
7 files changed, 23 insertions, 0 deletions
diff --git a/Userland/Libraries/LibWeb/OutOfProcessWebView.cpp b/Userland/Libraries/LibWeb/OutOfProcessWebView.cpp
index 477a083d9e..7b34e9f9bb 100644
--- a/Userland/Libraries/LibWeb/OutOfProcessWebView.cpp
+++ b/Userland/Libraries/LibWeb/OutOfProcessWebView.cpp
@@ -229,6 +229,11 @@ void OutOfProcessWebView::notify_server_did_change_selection(Badge<WebContentCli
request_repaint();
}
+void OutOfProcessWebView::notify_server_did_request_cursor_change(Badge<WebContentClient>, Gfx::StandardCursor cursor)
+{
+ set_override_cursor(cursor);
+}
+
void OutOfProcessWebView::notify_server_did_layout(Badge<WebContentClient>, const Gfx::IntSize& content_size)
{
set_content_size(content_size);
diff --git a/Userland/Libraries/LibWeb/OutOfProcessWebView.h b/Userland/Libraries/LibWeb/OutOfProcessWebView.h
index 47b2c49547..82a663ce9c 100644
--- a/Userland/Libraries/LibWeb/OutOfProcessWebView.h
+++ b/Userland/Libraries/LibWeb/OutOfProcessWebView.h
@@ -58,6 +58,7 @@ public:
void notify_server_did_paint(Badge<WebContentClient>, i32 bitmap_id);
void notify_server_did_invalidate_content_rect(Badge<WebContentClient>, const Gfx::IntRect&);
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_into_view(Badge<WebContentClient>, const Gfx::IntRect&);
void notify_server_did_hover_link(Badge<WebContentClient>, const URL&);
diff --git a/Userland/Libraries/LibWeb/WebContentClient.cpp b/Userland/Libraries/LibWeb/WebContentClient.cpp
index 5be96ef663..cc0db47d84 100644
--- a/Userland/Libraries/LibWeb/WebContentClient.cpp
+++ b/Userland/Libraries/LibWeb/WebContentClient.cpp
@@ -74,6 +74,15 @@ void WebContentClient::handle(const Messages::WebContentClient::DidChangeSelecti
m_view.notify_server_did_change_selection({});
}
+void WebContentClient::handle(const Messages::WebContentClient::DidRequestCursorChange& message)
+{
+ if (message.cursor_type() < 0 || message.cursor_type() >= (i32)Gfx::StandardCursor::__Count) {
+ dbgln("DidRequestCursorChange: Bad cursor type");
+ return;
+ }
+ m_view.notify_server_did_request_cursor_change({}, (Gfx::StandardCursor)message.cursor_type());
+}
+
void WebContentClient::handle(const Messages::WebContentClient::DidLayout& message)
{
dbgln_if(SPAM_DEBUG, "handle: WebContentClient::DidLayout! content_size={}", message.content_size());
diff --git a/Userland/Libraries/LibWeb/WebContentClient.h b/Userland/Libraries/LibWeb/WebContentClient.h
index 894e752e44..33e22a9ad6 100644
--- a/Userland/Libraries/LibWeb/WebContentClient.h
+++ b/Userland/Libraries/LibWeb/WebContentClient.h
@@ -54,6 +54,7 @@ private:
virtual void handle(const Messages::WebContentClient::DidFinishLoading&) override;
virtual void handle(const Messages::WebContentClient::DidInvalidateContentRect&) override;
virtual void handle(const Messages::WebContentClient::DidChangeSelection&) override;
+ 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::DidRequestScrollIntoView&) override;
diff --git a/Userland/Services/WebContent/PageHost.cpp b/Userland/Services/WebContent/PageHost.cpp
index b28f98323a..1818313d29 100644
--- a/Userland/Services/WebContent/PageHost.cpp
+++ b/Userland/Services/WebContent/PageHost.cpp
@@ -113,6 +113,11 @@ void PageHost::page_did_change_selection()
m_client.post_message(Messages::WebContentClient::DidChangeSelection());
}
+void PageHost::page_did_request_cursor_change(Gfx::StandardCursor cursor)
+{
+ m_client.post_message(Messages::WebContentClient::DidRequestCursorChange((u32)cursor));
+}
+
void PageHost::page_did_layout()
{
auto* layout_root = this->layout_root();
diff --git a/Userland/Services/WebContent/PageHost.h b/Userland/Services/WebContent/PageHost.h
index 1733d3e992..29f28da8d8 100644
--- a/Userland/Services/WebContent/PageHost.h
+++ b/Userland/Services/WebContent/PageHost.h
@@ -56,6 +56,7 @@ private:
virtual Gfx::Palette palette() const override;
virtual void page_did_invalidate(const Gfx::IntRect&) override;
virtual void page_did_change_selection() override;
+ 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_into_view(const Gfx::IntRect&) override;
diff --git a/Userland/Services/WebContent/WebContentClient.ipc b/Userland/Services/WebContent/WebContentClient.ipc
index adca96055a..af3e80d18a 100644
--- a/Userland/Services/WebContent/WebContentClient.ipc
+++ b/Userland/Services/WebContent/WebContentClient.ipc
@@ -5,6 +5,7 @@ endpoint WebContentClient = 90
DidPaint(Gfx::IntRect content_rect, i32 bitmap_id) =|
DidInvalidateContentRect(Gfx::IntRect content_rect) =|
DidChangeSelection() =|
+ DidRequestCursorChange(i32 cursor_type) =|
DidLayout(Gfx::IntSize content_size) =|
DidChangeTitle(String title) =|
DidRequestScrollIntoView(Gfx::IntRect rect) =|