summaryrefslogtreecommitdiff
path: root/Userland/Services
diff options
context:
space:
mode:
authorLinus Groh <mail@linusgroh.de>2021-04-04 00:12:37 +0200
committerAndreas Kling <kling@serenityos.org>2021-04-04 00:37:54 +0200
commite8739ddab76478b245b6c5c604988364a9191bd0 (patch)
tree5d9af0ab2b59df88fddd5b742e5475e0a78148f9 /Userland/Services
parent96b26ec125340b7a0b29754215dc24f372b6d737 (diff)
downloadserenity-e8739ddab76478b245b6c5c604988364a9191bd0.zip
LibWeb+WebContent: Keep track of screen rect
It is now possible to get the up-to-date screen rect from a Web::Page.
Diffstat (limited to 'Userland/Services')
-rw-r--r--Userland/Services/WebContent/ClientConnection.cpp5
-rw-r--r--Userland/Services/WebContent/ClientConnection.h1
-rw-r--r--Userland/Services/WebContent/PageHost.h4
-rw-r--r--Userland/Services/WebContent/WebContentServer.ipc1
4 files changed, 11 insertions, 0 deletions
diff --git a/Userland/Services/WebContent/ClientConnection.cpp b/Userland/Services/WebContent/ClientConnection.cpp
index 22e08f3e9b..142e62f690 100644
--- a/Userland/Services/WebContent/ClientConnection.cpp
+++ b/Userland/Services/WebContent/ClientConnection.cpp
@@ -89,6 +89,11 @@ void ClientConnection::handle(const Messages::WebContentServer::UpdateSystemThem
m_page_host->set_palette_impl(*impl);
}
+void ClientConnection::handle(const Messages::WebContentServer::UpdateScreenRect& message)
+{
+ m_page_host->set_screen_rect(message.rect());
+}
+
void ClientConnection::handle(const Messages::WebContentServer::LoadURL& message)
{
dbgln_if(SPAM_DEBUG, "handle: WebContentServer::LoadURL: url={}", message.url());
diff --git a/Userland/Services/WebContent/ClientConnection.h b/Userland/Services/WebContent/ClientConnection.h
index c782b62dd2..3fd0a3c662 100644
--- a/Userland/Services/WebContent/ClientConnection.h
+++ b/Userland/Services/WebContent/ClientConnection.h
@@ -54,6 +54,7 @@ private:
virtual OwnPtr<Messages::WebContentServer::GreetResponse> handle(const Messages::WebContentServer::Greet&) override;
virtual void handle(const Messages::WebContentServer::UpdateSystemTheme&) override;
+ virtual void handle(const Messages::WebContentServer::UpdateScreenRect&) override;
virtual void handle(const Messages::WebContentServer::LoadURL&) override;
virtual void handle(const Messages::WebContentServer::LoadHTML&) override;
virtual void handle(const Messages::WebContentServer::Paint&) override;
diff --git a/Userland/Services/WebContent/PageHost.h b/Userland/Services/WebContent/PageHost.h
index 44aee5ffbd..315b3bc34c 100644
--- a/Userland/Services/WebContent/PageHost.h
+++ b/Userland/Services/WebContent/PageHost.h
@@ -26,6 +26,7 @@
#pragma once
+#include <LibGfx/Rect.h>
#include <LibWeb/Page/Page.h>
namespace WebContent {
@@ -47,6 +48,7 @@ public:
void set_palette_impl(const Gfx::PaletteImpl&);
void set_viewport_rect(const Gfx::IntRect&);
+ void set_screen_rect(const Gfx::IntRect& rect) { m_screen_rect = rect; };
void set_should_show_line_box_borders(bool b) { m_should_show_line_box_borders = b; }
@@ -54,6 +56,7 @@ private:
// ^PageClient
virtual bool is_multi_process() const override { return true; }
virtual Gfx::Palette palette() const override;
+ virtual Gfx::IntRect screen_rect() const override { return m_screen_rect; }
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;
@@ -84,6 +87,7 @@ private:
ClientConnection& m_client;
NonnullOwnPtr<Web::Page> m_page;
RefPtr<Gfx::PaletteImpl> m_palette_impl;
+ Gfx::IntRect m_screen_rect;
bool m_should_show_line_box_borders { false };
};
diff --git a/Userland/Services/WebContent/WebContentServer.ipc b/Userland/Services/WebContent/WebContentServer.ipc
index cf0dd86171..1b429c5579 100644
--- a/Userland/Services/WebContent/WebContentServer.ipc
+++ b/Userland/Services/WebContent/WebContentServer.ipc
@@ -3,6 +3,7 @@ endpoint WebContentServer = 89
Greet() => ()
UpdateSystemTheme(Core::AnonymousBuffer theme_buffer) =|
+ UpdateScreenRect(Gfx::IntRect rect) =|
LoadURL(URL url) =|
LoadHTML(String html, URL url) =|