diff --git a/Ladybird/WebContentView.cpp b/Ladybird/WebContentView.cpp index 1368343ef5..b761e1af87 100644 --- a/Ladybird/WebContentView.cpp +++ b/Ladybird/WebContentView.cpp @@ -680,11 +680,12 @@ void WebContentView::handle_web_content_process_crash() load_html(builder.to_deprecated_string(), m_url); } -void WebContentView::notify_server_did_paint(Badge, i32 bitmap_id) +void WebContentView::notify_server_did_paint(Badge, i32 bitmap_id, Gfx::IntSize size) { if (m_client_state.back_bitmap.id == bitmap_id) { m_client_state.has_usable_bitmap = true; m_client_state.back_bitmap.pending_paints--; + m_client_state.back_bitmap.last_painted_size = size; swap(m_client_state.back_bitmap, m_client_state.front_bitmap); // We don't need the backup bitmap anymore, so drop it. m_backup_bitmap = nullptr; diff --git a/Ladybird/WebContentView.h b/Ladybird/WebContentView.h index d318372090..ab3e064fae 100644 --- a/Ladybird/WebContentView.h +++ b/Ladybird/WebContentView.h @@ -119,7 +119,7 @@ public: void update_palette(PaletteMode = PaletteMode::Default); virtual void notify_server_did_layout(Badge, Gfx::IntSize content_size) override; - virtual void notify_server_did_paint(Badge, i32 bitmap_id) override; + virtual void notify_server_did_paint(Badge, i32 bitmap_id, Gfx::IntSize) override; virtual void notify_server_did_invalidate_content_rect(Badge, Gfx::IntRect const&) override; virtual void notify_server_did_change_selection(Badge) override; virtual void notify_server_did_request_cursor_change(Badge, Gfx::StandardCursor cursor) override; diff --git a/Userland/Libraries/LibWebView/OutOfProcessWebView.cpp b/Userland/Libraries/LibWebView/OutOfProcessWebView.cpp index b976135a50..d503adf621 100644 --- a/Userland/Libraries/LibWebView/OutOfProcessWebView.cpp +++ b/Userland/Libraries/LibWebView/OutOfProcessWebView.cpp @@ -205,11 +205,12 @@ void OutOfProcessWebView::screen_rects_change_event(GUI::ScreenRectsChangeEvent& client().async_update_screen_rects(event.rects(), event.main_screen_index()); } -void OutOfProcessWebView::notify_server_did_paint(Badge, i32 bitmap_id) +void OutOfProcessWebView::notify_server_did_paint(Badge, i32 bitmap_id, Gfx::IntSize size) { if (m_client_state.back_bitmap.id == bitmap_id) { m_client_state.has_usable_bitmap = true; m_client_state.back_bitmap.pending_paints--; + m_client_state.back_bitmap.last_painted_size = size; swap(m_client_state.back_bitmap, m_client_state.front_bitmap); // We don't need the backup bitmap anymore, so drop it. m_backup_bitmap = nullptr; diff --git a/Userland/Libraries/LibWebView/OutOfProcessWebView.h b/Userland/Libraries/LibWebView/OutOfProcessWebView.h index 1f3dd23676..ca4baa89b7 100644 --- a/Userland/Libraries/LibWebView/OutOfProcessWebView.h +++ b/Userland/Libraries/LibWebView/OutOfProcessWebView.h @@ -126,7 +126,7 @@ private: virtual void create_client(EnableCallgrindProfiling = EnableCallgrindProfiling::No) override; virtual void update_zoom() override; virtual void notify_server_did_layout(Badge, Gfx::IntSize content_size) override; - virtual void notify_server_did_paint(Badge, i32 bitmap_id) override; + virtual void notify_server_did_paint(Badge, i32 bitmap_id, Gfx::IntSize) override; virtual void notify_server_did_invalidate_content_rect(Badge, Gfx::IntRect const&) override; virtual void notify_server_did_change_selection(Badge) override; virtual void notify_server_did_request_cursor_change(Badge, Gfx::StandardCursor cursor) override; diff --git a/Userland/Libraries/LibWebView/ViewImplementation.h b/Userland/Libraries/LibWebView/ViewImplementation.h index 872bf77eb1..9efe4d1ffb 100644 --- a/Userland/Libraries/LibWebView/ViewImplementation.h +++ b/Userland/Libraries/LibWebView/ViewImplementation.h @@ -71,7 +71,7 @@ public: void run_javascript(StringView); virtual void notify_server_did_layout(Badge, Gfx::IntSize content_size) = 0; - virtual void notify_server_did_paint(Badge, i32 bitmap_id) = 0; + virtual void notify_server_did_paint(Badge, i32 bitmap_id, Gfx::IntSize) = 0; virtual void notify_server_did_invalidate_content_rect(Badge, Gfx::IntRect const&) = 0; virtual void notify_server_did_change_selection(Badge) = 0; virtual void notify_server_did_request_cursor_change(Badge, Gfx::StandardCursor cursor) = 0; @@ -142,6 +142,7 @@ protected: struct SharedBitmap { i32 id { -1 }; i32 pending_paints { 0 }; + Gfx::IntSize last_painted_size; RefPtr bitmap; }; diff --git a/Userland/Libraries/LibWebView/WebContentClient.cpp b/Userland/Libraries/LibWebView/WebContentClient.cpp index 5e53927197..01238a2357 100644 --- a/Userland/Libraries/LibWebView/WebContentClient.cpp +++ b/Userland/Libraries/LibWebView/WebContentClient.cpp @@ -23,9 +23,9 @@ void WebContentClient::die() on_web_content_process_crash(); } -void WebContentClient::did_paint(Gfx::IntRect const&, i32 bitmap_id) +void WebContentClient::did_paint(Gfx::IntRect const& rect, i32 bitmap_id) { - m_view.notify_server_did_paint({}, bitmap_id); + m_view.notify_server_did_paint({}, bitmap_id, rect.size()); } void WebContentClient::did_finish_loading(AK::URL const& url) diff --git a/Userland/Utilities/headless-browser.cpp b/Userland/Utilities/headless-browser.cpp index e83f5de5f2..31c6b138c5 100644 --- a/Userland/Utilities/headless-browser.cpp +++ b/Userland/Utilities/headless-browser.cpp @@ -84,7 +84,7 @@ private: HeadlessWebContentView() = default; void notify_server_did_layout(Badge, Gfx::IntSize) override { } - void notify_server_did_paint(Badge, i32) override { } + void notify_server_did_paint(Badge, i32, Gfx::IntSize) override { } void notify_server_did_invalidate_content_rect(Badge, Gfx::IntRect const&) override { } void notify_server_did_change_selection(Badge) override { } void notify_server_did_request_cursor_change(Badge, Gfx::StandardCursor) override { }