diff options
author | Timothy Flynn <trflynn89@pm.me> | 2023-05-16 07:56:12 -0400 |
---|---|---|
committer | Andreas Kling <kling@serenityos.org> | 2023-05-16 19:47:18 +0200 |
commit | b0edc7b6e4785f0754560dbcc1f5294bc31654cb (patch) | |
tree | f1ad2b378ad9456e879304f5eed1bece2bbad0fa /Ladybird/WebContentView.cpp | |
parent | 374284d0d8ac81aa1949c4fc5a52854a33f4898b (diff) | |
download | serenity-b0edc7b6e4785f0754560dbcc1f5294bc31654cb.zip |
Ladybird: Add screenshot actions to the page context menu
Browser on Serenity has these actions already.
Diffstat (limited to 'Ladybird/WebContentView.cpp')
-rw-r--r-- | Ladybird/WebContentView.cpp | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/Ladybird/WebContentView.cpp b/Ladybird/WebContentView.cpp index e1470f4205..a09ac93458 100644 --- a/Ladybird/WebContentView.cpp +++ b/Ladybird/WebContentView.cpp @@ -637,6 +637,18 @@ void WebContentView::create_client(WebView::EnableCallgrindProfiling enable_call client().async_connect_to_webdriver(m_webdriver_content_ipc_path); } +Gfx::ShareableBitmap WebContentView::take_screenshot() const +{ + if (auto* bitmap = m_client_state.has_usable_bitmap ? m_client_state.front_bitmap.bitmap.ptr() : m_backup_bitmap.ptr()) + return bitmap->to_shareable_bitmap(); + return {}; +} + +Gfx::ShareableBitmap WebContentView::take_document_screenshot() +{ + return client().take_document_screenshot(); +} + void WebContentView::handle_web_content_process_crash() { dbgln("WebContent process crashed!"); |