mirror of
https://github.com/RGBCube/serenity
synced 2025-07-27 07:47: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
|
@ -51,3 +51,11 @@ void WebContentClient::handle(const Messages::WebContentClient::DidFinishLoad& m
|
|||
{
|
||||
dbg() << "handle: WebContentClient::DidFinishLoad! url=" << message.url();
|
||||
}
|
||||
|
||||
void WebContentClient::handle(const Messages::WebContentClient::DidInvalidateContentRect& message)
|
||||
{
|
||||
dbg() << "handle: WebContentClient::DidInvalidateContentRect! content_rect=" << message.content_rect();
|
||||
|
||||
// FIXME: Figure out a way to coalesce these messages to reduce unnecessary painting
|
||||
m_view.notify_server_did_invalidate_content_rect({}, message.content_rect());
|
||||
}
|
||||
|
|
|
@ -46,6 +46,7 @@ private:
|
|||
|
||||
virtual void handle(const Messages::WebContentClient::DidPaint&) override;
|
||||
virtual void handle(const Messages::WebContentClient::DidFinishLoad&) override;
|
||||
virtual void handle(const Messages::WebContentClient::DidInvalidateContentRect&) override;
|
||||
|
||||
WebContentView& m_view;
|
||||
};
|
||||
|
|
|
@ -69,6 +69,12 @@ void WebContentView::notify_server_did_paint(Badge<WebContentClient>, i32 shbuf_
|
|||
update();
|
||||
}
|
||||
|
||||
void WebContentView::notify_server_did_invalidate_content_rect(Badge<WebContentClient>, const Gfx::IntRect& content_rect)
|
||||
{
|
||||
dbg() << "server did invalidate content_rect: " << content_rect << ", current shbuf_id=" << m_bitmap->shbuf_id();
|
||||
client().post_message(Messages::WebContentServer::Paint(m_bitmap->rect(), m_bitmap->shbuf_id()));
|
||||
}
|
||||
|
||||
WebContentClient& WebContentView::client()
|
||||
{
|
||||
return *m_client;
|
||||
|
|
|
@ -39,6 +39,7 @@ public:
|
|||
void load(const URL&);
|
||||
|
||||
void notify_server_did_paint(Badge<WebContentClient>, i32 shbuf_id);
|
||||
void notify_server_did_invalidate_content_rect(Badge<WebContentClient>, const Gfx::IntRect&);
|
||||
|
||||
private:
|
||||
WebContentView();
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue