1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-27 12:57:35 +00:00

Ladybird+LibWebView: Migrate layout notification to LibWebView callbacks

This commit is contained in:
Timothy Flynn 2023-08-23 10:33:26 -04:00 committed by Tim Flynn
parent 682a5f9b70
commit bf464665a7
10 changed files with 19 additions and 34 deletions

View file

@ -29,6 +29,10 @@ OutOfProcessWebView::OutOfProcessWebView()
create_client();
on_did_layout = [this](auto content_size) {
set_content_size(content_size);
};
on_ready_to_paint = [this]() {
update();
};
@ -184,11 +188,6 @@ void OutOfProcessWebView::notify_server_did_request_cursor_change(Badge<WebConte
set_override_cursor(cursor);
}
void OutOfProcessWebView::notify_server_did_layout(Badge<WebContentClient>, Gfx::IntSize content_size)
{
set_content_size(content_size);
}
void OutOfProcessWebView::notify_server_did_request_scroll(Badge<WebContentClient>, i32 x_delta, i32 y_delta)
{
horizontal_scrollbar().increase_slider_by(x_delta);

View file

@ -82,7 +82,6 @@ private:
// ^WebView::ViewImplementation
virtual void create_client(EnableCallgrindProfiling = EnableCallgrindProfiling::No) override;
virtual void update_zoom() override;
virtual void notify_server_did_layout(Badge<WebContentClient>, Gfx::IntSize content_size) override;
virtual void notify_server_did_request_cursor_change(Badge<WebContentClient>, Gfx::StandardCursor cursor) override;
virtual void notify_server_did_request_scroll(Badge<WebContentClient>, i32, i32) override;
virtual void notify_server_did_request_scroll_to(Badge<WebContentClient>, Gfx::IntPoint) override;

View file

@ -94,6 +94,7 @@ public:
};
ErrorOr<void> take_screenshot(ScreenshotType);
Function<void(Gfx::IntSize)> on_did_layout;
Function<void()> on_ready_to_paint;
Function<String(Web::HTML::ActivateTab)> on_new_tab;
Function<void()> on_activate_tab;
@ -139,7 +140,6 @@ public:
Function<Gfx::IntRect()> on_minimize_window;
Function<Gfx::IntRect()> on_fullscreen_window;
virtual void notify_server_did_layout(Badge<WebContentClient>, Gfx::IntSize content_size) = 0;
virtual void notify_server_did_request_cursor_change(Badge<WebContentClient>, Gfx::StandardCursor cursor) = 0;
virtual void notify_server_did_request_scroll(Badge<WebContentClient>, i32, i32) = 0;
virtual void notify_server_did_request_scroll_to(Badge<WebContentClient>, Gfx::IntPoint) = 0;

View file

@ -88,7 +88,8 @@ void WebContentClient::did_request_cursor_change(i32 cursor_type)
void WebContentClient::did_layout(Gfx::IntSize content_size)
{
dbgln_if(SPAM_DEBUG, "handle: WebContentClient::DidLayout! content_size={}", content_size);
m_view.notify_server_did_layout({}, content_size);
if (m_view.on_did_layout)
m_view.on_did_layout(content_size);
}
void WebContentClient::did_change_title(DeprecatedString const& title)