diff options
author | Andreas Kling <kling@serenityos.org> | 2020-07-05 15:43:43 +0200 |
---|---|---|
committer | Andreas Kling <kling@serenityos.org> | 2020-07-05 15:57:07 +0200 |
commit | 131bc8fd31a43c385e04d4d634e1dda180bbff24 (patch) | |
tree | 116c64b3a2638c617e7f92159636ea099f4a14b8 /Demos/WebView | |
parent | 56d14d57013af3d1f7efbf957b2632b0390d2e0f (diff) | |
download | serenity-131bc8fd31a43c385e04d4d634e1dda180bbff24.zip |
WebContent: Plumb scroll-into-view requests from server to client
The WebContentView widget will now be able to react to scroll-into-view
requests from the WebContent process.
Diffstat (limited to 'Demos/WebView')
-rw-r--r-- | Demos/WebView/WebContentClient.cpp | 8 | ||||
-rw-r--r-- | Demos/WebView/WebContentClient.h | 1 | ||||
-rw-r--r-- | Demos/WebView/WebContentView.cpp | 5 | ||||
-rw-r--r-- | Demos/WebView/WebContentView.h | 1 |
4 files changed, 15 insertions, 0 deletions
diff --git a/Demos/WebView/WebContentClient.cpp b/Demos/WebView/WebContentClient.cpp index e39df2c24a..7d799c9c2c 100644 --- a/Demos/WebView/WebContentClient.cpp +++ b/Demos/WebView/WebContentClient.cpp @@ -90,3 +90,11 @@ void WebContentClient::handle(const Messages::WebContentClient::DidChangeTitle& #endif m_view.notify_server_did_change_title({}, message.title()); } + +void WebContentClient::handle(const Messages::WebContentClient::DidRequestScrollIntoView& message) +{ +#ifdef DEBUG_SPAM + dbg() << "handle: WebContentClient::DidRequestScrollIntoView! rect=" << message.rect(); +#endif + m_view.notify_server_did_request_scroll_into_view({}, message.rect()); +} diff --git a/Demos/WebView/WebContentClient.h b/Demos/WebView/WebContentClient.h index e0c6948a0b..f7aaa6ddf5 100644 --- a/Demos/WebView/WebContentClient.h +++ b/Demos/WebView/WebContentClient.h @@ -50,6 +50,7 @@ private: virtual void handle(const Messages::WebContentClient::DidChangeSelection&) override; virtual void handle(const Messages::WebContentClient::DidLayout&) override; virtual void handle(const Messages::WebContentClient::DidChangeTitle&) override; + virtual void handle(const Messages::WebContentClient::DidRequestScrollIntoView&) override; WebContentView& m_view; }; diff --git a/Demos/WebView/WebContentView.cpp b/Demos/WebView/WebContentView.cpp index 47d226d585..97e5ddf0e8 100644 --- a/Demos/WebView/WebContentView.cpp +++ b/Demos/WebView/WebContentView.cpp @@ -115,6 +115,11 @@ void WebContentView::notify_server_did_change_title(Badge<WebContentClient>, con on_title_change(title); } +void WebContentView::notify_server_did_request_scroll_into_view(Badge<WebContentClient>, const Gfx::IntRect& rect) +{ + scroll_into_view(rect, true, true); +} + void WebContentView::did_scroll() { client().post_message(Messages::WebContentServer::SetViewportRect(visible_content_rect())); diff --git a/Demos/WebView/WebContentView.h b/Demos/WebView/WebContentView.h index 3fc7745984..4805bf6654 100644 --- a/Demos/WebView/WebContentView.h +++ b/Demos/WebView/WebContentView.h @@ -46,6 +46,7 @@ public: void notify_server_did_invalidate_content_rect(Badge<WebContentClient>, const Gfx::IntRect&); void notify_server_did_change_selection(Badge<WebContentClient>); void notify_server_did_change_title(Badge<WebContentClient>, const String&); + void notify_server_did_request_scroll_into_view(Badge<WebContentClient>, const Gfx::IntRect&); private: WebContentView(); |