diff --git a/Libraries/LibWeb/OutOfProcessWebView.cpp b/Libraries/LibWeb/OutOfProcessWebView.cpp index 22cdcaf51f..c2ebe32ad3 100644 --- a/Libraries/LibWeb/OutOfProcessWebView.cpp +++ b/Libraries/LibWeb/OutOfProcessWebView.cpp @@ -52,6 +52,12 @@ void OutOfProcessWebView::load(const URL& url) client().post_message(Messages::WebContentServer::LoadURL(url)); } +void OutOfProcessWebView::load_html(const StringView& html, const URL& url) +{ + m_url = url; + client().post_message(Messages::WebContentServer::LoadHTML(html, url)); +} + void OutOfProcessWebView::paint_event(GUI::PaintEvent& event) { GUI::ScrollableWidget::paint_event(event); diff --git a/Libraries/LibWeb/OutOfProcessWebView.h b/Libraries/LibWeb/OutOfProcessWebView.h index 47cf0f497c..56efc3680e 100644 --- a/Libraries/LibWeb/OutOfProcessWebView.h +++ b/Libraries/LibWeb/OutOfProcessWebView.h @@ -46,6 +46,8 @@ public: URL url() const { return m_url; } void load(const URL&); + void load_html(const StringView&, const URL&); + void notify_server_did_layout(Badge, const Gfx::IntSize& content_size); void notify_server_did_paint(Badge, i32 shbuf_id); void notify_server_did_invalidate_content_rect(Badge, const Gfx::IntRect&); diff --git a/Libraries/LibWeb/Page/Page.cpp b/Libraries/LibWeb/Page/Page.cpp index ffab18691a..dfc9ada662 100644 --- a/Libraries/LibWeb/Page/Page.cpp +++ b/Libraries/LibWeb/Page/Page.cpp @@ -62,6 +62,11 @@ void Page::load(const LoadRequest& request) main_frame().loader().load(request, FrameLoader::Type::Navigation); } +void Page::load_html(const StringView& html, const URL& url) +{ + main_frame().loader().load_html(html, url); +} + Gfx::Palette Page::palette() const { return m_client.palette(); diff --git a/Libraries/LibWeb/Page/Page.h b/Libraries/LibWeb/Page/Page.h index a9073b016b..0b9094d7f2 100644 --- a/Libraries/LibWeb/Page/Page.h +++ b/Libraries/LibWeb/Page/Page.h @@ -62,6 +62,8 @@ public: void load(const URL&); void load(const LoadRequest&); + void load_html(const StringView&, const URL&); + bool handle_mouseup(const Gfx::IntPoint&, unsigned button, unsigned modifiers); bool handle_mousedown(const Gfx::IntPoint&, unsigned button, unsigned modifiers); bool handle_mousemove(const Gfx::IntPoint&, unsigned buttons, unsigned modifiers); diff --git a/Services/WebContent/ClientConnection.cpp b/Services/WebContent/ClientConnection.cpp index 496f2fec2f..d7a3b53a1d 100644 --- a/Services/WebContent/ClientConnection.cpp +++ b/Services/WebContent/ClientConnection.cpp @@ -91,6 +91,14 @@ void ClientConnection::handle(const Messages::WebContentServer::LoadURL& message page().load(message.url()); } +void ClientConnection::handle(const Messages::WebContentServer::LoadHTML& message) +{ +#ifdef DEBUG_SPAM + dbg() << "handle: WebContentServer::LoadHTML: html=" << message.html() << ", url=" << message.url(); +#endif + page().load_html(message.html(), message.url()); +} + void ClientConnection::handle(const Messages::WebContentServer::SetViewportRect& message) { #ifdef DEBUG_SPAM diff --git a/Services/WebContent/ClientConnection.h b/Services/WebContent/ClientConnection.h index 78301b5842..42e2ab8313 100644 --- a/Services/WebContent/ClientConnection.h +++ b/Services/WebContent/ClientConnection.h @@ -53,6 +53,7 @@ private: virtual OwnPtr handle(const Messages::WebContentServer::Greet&) override; virtual void handle(const Messages::WebContentServer::UpdateSystemTheme&) 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; virtual void handle(const Messages::WebContentServer::SetViewportRect&) override; virtual void handle(const Messages::WebContentServer::MouseDown&) override; diff --git a/Services/WebContent/WebContentServer.ipc b/Services/WebContent/WebContentServer.ipc index aaef44c2bb..143650dab7 100644 --- a/Services/WebContent/WebContentServer.ipc +++ b/Services/WebContent/WebContentServer.ipc @@ -5,6 +5,7 @@ endpoint WebContentServer = 89 UpdateSystemTheme(i32 shbuf_id) =| LoadURL(URL url) =| + LoadHTML(String html, URL url) =| Paint(Gfx::IntRect content_rect, i32 shbuf_id) =| SetViewportRect(Gfx::IntRect rect) =|