mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-01-04 01:05:58 +03:00
WebContent: Capture horizontal overflow in full document screenshots
The full-page screenshot was missing horizontal overflow content on most web pages. Change the dimensions of the captured screenshot to match the actual content size.
This commit is contained in:
parent
2f5ceeac62
commit
cfa5e03108
Notes:
sideshowbarker
2024-07-17 04:46:16 +09:00
Author: https://github.com/trflynn89 Commit: https://github.com/SerenityOS/serenity/commit/cfa5e03108 Pull-request: https://github.com/SerenityOS/serenity/pull/15939 Reviewed-by: https://github.com/linusg
@ -714,7 +714,16 @@ Messages::WebContentServer::TakeDocumentScreenshotResponse ConnectionFromClient:
|
||||
if (!document || !document->document_element())
|
||||
return { {} };
|
||||
|
||||
auto rect = calculate_absolute_rect_of_element(page(), *document->document_element());
|
||||
auto bounding_rect = document->document_element()->get_bounding_client_rect();
|
||||
auto position = calculate_absolute_position_of_element(page(), bounding_rect);
|
||||
auto const& content_size = m_page_host->content_size();
|
||||
|
||||
Gfx::IntRect rect {
|
||||
position.x(),
|
||||
position.y(),
|
||||
content_size.width() - position.x(),
|
||||
content_size.height() - position.y(),
|
||||
};
|
||||
|
||||
auto bitmap = Gfx::Bitmap::try_create(Gfx::BitmapFormat::BGRA8888, rect.size()).release_value_but_fixme_should_propagate_errors();
|
||||
m_page_host->paint(rect, *bitmap);
|
||||
|
Loading…
Reference in New Issue
Block a user