diff --git a/Demos/WebView/WebContentClient.cpp b/Demos/WebView/WebContentClient.cpp index 0594c1cf4e..0906edcaa1 100644 --- a/Demos/WebView/WebContentClient.cpp +++ b/Demos/WebView/WebContentClient.cpp @@ -60,3 +60,9 @@ void WebContentClient::handle(const Messages::WebContentClient::DidInvalidateCon // FIXME: Figure out a way to coalesce these messages to reduce unnecessary painting m_view.notify_server_did_invalidate_content_rect({}, message.content_rect()); } + +void WebContentClient::handle(const Messages::WebContentClient::DidChangeSelection&) +{ + dbg() << "handle: WebContentClient::DidChangeSelection!"; + m_view.notify_server_did_change_selection({}); +} diff --git a/Demos/WebView/WebContentClient.h b/Demos/WebView/WebContentClient.h index 738d3ffa94..2e0e6f5358 100644 --- a/Demos/WebView/WebContentClient.h +++ b/Demos/WebView/WebContentClient.h @@ -47,6 +47,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; + virtual void handle(const Messages::WebContentClient::DidChangeSelection&) override; WebContentView& m_view; }; diff --git a/Demos/WebView/WebContentView.cpp b/Demos/WebView/WebContentView.cpp index 9bd1fc7a77..0ac909865c 100644 --- a/Demos/WebView/WebContentView.cpp +++ b/Demos/WebView/WebContentView.cpp @@ -87,6 +87,16 @@ void WebContentView::notify_server_did_paint(Badge, i32 shbuf_ void WebContentView::notify_server_did_invalidate_content_rect(Badge, const Gfx::IntRect& content_rect) { dbg() << "server did invalidate content_rect: " << content_rect << ", current shbuf_id=" << m_bitmap->shbuf_id(); + request_repaint(); +} + +void WebContentView::notify_server_did_change_selection(Badge) +{ + request_repaint(); +} + +void WebContentView::request_repaint() +{ client().post_message(Messages::WebContentServer::Paint(m_bitmap->rect(), m_bitmap->shbuf_id())); } diff --git a/Demos/WebView/WebContentView.h b/Demos/WebView/WebContentView.h index c354ba7f33..64734e1c4f 100644 --- a/Demos/WebView/WebContentView.h +++ b/Demos/WebView/WebContentView.h @@ -40,6 +40,7 @@ public: void notify_server_did_paint(Badge, i32 shbuf_id); void notify_server_did_invalidate_content_rect(Badge, const Gfx::IntRect&); + void notify_server_did_change_selection(Badge); private: WebContentView(); @@ -50,6 +51,8 @@ private: virtual void mouseup_event(GUI::MouseEvent&) override; virtual void mousemove_event(GUI::MouseEvent&) override; + void request_repaint(); + WebContentClient& client(); RefPtr m_client; diff --git a/Services/WebContent/PageHost.cpp b/Services/WebContent/PageHost.cpp index fb15ae7d69..35cb43b7fd 100644 --- a/Services/WebContent/PageHost.cpp +++ b/Services/WebContent/PageHost.cpp @@ -104,4 +104,9 @@ void PageHost::page_did_invalidate(const Gfx::IntRect& content_rect) m_client.post_message(Messages::WebContentClient::DidInvalidateContentRect(content_rect)); } +void PageHost::page_did_change_selection() +{ + m_client.post_message(Messages::WebContentClient::DidChangeSelection()); +} + } diff --git a/Services/WebContent/PageHost.h b/Services/WebContent/PageHost.h index c46f7a4012..396ef92ce5 100644 --- a/Services/WebContent/PageHost.h +++ b/Services/WebContent/PageHost.h @@ -52,6 +52,7 @@ private: // ^PageHost virtual Gfx::Palette palette() const override; virtual void page_did_invalidate(const Gfx::IntRect&) override; + virtual void page_did_change_selection() override; explicit PageHost(ClientConnection&); diff --git a/Services/WebContent/WebContentClient.ipc b/Services/WebContent/WebContentClient.ipc index cde1a62f5f..a018a5f812 100644 --- a/Services/WebContent/WebContentClient.ipc +++ b/Services/WebContent/WebContentClient.ipc @@ -3,4 +3,5 @@ endpoint WebContentClient = 90 DidFinishLoad(URL url) =| DidPaint(Gfx::IntRect content_rect, i32 shbuf_id) =| DidInvalidateContentRect(Gfx::IntRect content_rect) =| + DidChangeSelection() =| }