mirror of
https://github.com/RGBCube/serenity
synced 2025-07-25 15:17:36 +00: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
1 changed files with 10 additions and 1 deletions
|
@ -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…
Add table
Add a link
Reference in a new issue