mirror of
https://github.com/RGBCube/serenity
synced 2025-07-27 21:57:35 +00:00
WebContent: Allow the WebContent process to trigger repaints
After layout, we may want to repaint the page, so we now listen for the PageClient::page_did_invalidate() notification and use it to drive a client-side repaint. Note that an invalidation request from LibWeb makes a full roundtrip to the WebContent client and back since the client drives painting.
This commit is contained in:
parent
c45c5ded34
commit
0bac2ad3b3
8 changed files with 36 additions and 6 deletions
|
@ -38,7 +38,7 @@ static HashMap<int, RefPtr<ClientConnection>> s_connections;
|
|||
|
||||
ClientConnection::ClientConnection(Core::LocalSocket& socket, int client_id)
|
||||
: IPC::ClientConnection<WebContentServerEndpoint>(*this, socket, client_id)
|
||||
, m_page_host(PageHost::create())
|
||||
, m_page_host(PageHost::create(*this))
|
||||
{
|
||||
s_connections.set(client_id, *this);
|
||||
}
|
||||
|
|
|
@ -25,16 +25,19 @@
|
|||
*/
|
||||
|
||||
#include "PageHost.h"
|
||||
#include "ClientConnection.h"
|
||||
#include <AK/SharedBuffer.h>
|
||||
#include <LibGfx/Painter.h>
|
||||
#include <LibGfx/SystemTheme.h>
|
||||
#include <LibWeb/Frame/Frame.h>
|
||||
#include <LibWeb/Layout/LayoutDocument.h>
|
||||
#include <WebContent/WebContentClientEndpoint.h>
|
||||
|
||||
namespace WebContent {
|
||||
|
||||
PageHost::PageHost()
|
||||
: m_page(make<Web::Page>(*this))
|
||||
PageHost::PageHost(ClientConnection& client)
|
||||
: m_client(client)
|
||||
, m_page(make<Web::Page>(*this))
|
||||
{
|
||||
setup_palette();
|
||||
}
|
||||
|
@ -96,4 +99,9 @@ void PageHost::set_viewport_rect(const Gfx::IntRect& rect)
|
|||
page().main_frame().set_viewport_rect(rect);
|
||||
}
|
||||
|
||||
void PageHost::page_did_invalidate(const Gfx::IntRect& content_rect)
|
||||
{
|
||||
m_client.post_message(Messages::WebContentClient::DidInvalidateContentRect(content_rect));
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -30,12 +30,14 @@
|
|||
|
||||
namespace WebContent {
|
||||
|
||||
class ClientConnection;
|
||||
|
||||
class PageHost : public Web::PageClient {
|
||||
AK_MAKE_NONCOPYABLE(PageHost);
|
||||
AK_MAKE_NONMOVABLE(PageHost);
|
||||
|
||||
public:
|
||||
static NonnullOwnPtr<PageHost> create() { return adopt_own(*new PageHost); }
|
||||
static NonnullOwnPtr<PageHost> create(ClientConnection& client) { return adopt_own(*new PageHost(client)); }
|
||||
virtual ~PageHost();
|
||||
|
||||
Web::Page& page() { return *m_page; }
|
||||
|
@ -47,11 +49,15 @@ public:
|
|||
void set_viewport_rect(const Gfx::IntRect&);
|
||||
|
||||
private:
|
||||
PageHost();
|
||||
// ^PageHost
|
||||
virtual void page_did_invalidate(const Gfx::IntRect&) override;
|
||||
|
||||
explicit PageHost(ClientConnection&);
|
||||
|
||||
Gfx::Palette palette() const;
|
||||
void setup_palette();
|
||||
|
||||
ClientConnection& m_client;
|
||||
NonnullOwnPtr<Web::Page> m_page;
|
||||
RefPtr<Gfx::PaletteImpl> m_palette_impl;
|
||||
};
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
endpoint WebContentClient = 90
|
||||
{
|
||||
DidFinishLoad(URL url) =|
|
||||
|
||||
DidPaint(Gfx::IntRect content_rect, i32 shbuf_id) =|
|
||||
DidInvalidateContentRect(Gfx::IntRect content_rect) =|
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue