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

LibWeb+WebContent+WebWorker: Add an option to skip painting the overlay

This will allow the Inspector to take a screenshot of a DOM node without
the overlay which renders the inspected node outline / box data.
This commit is contained in:
Timothy Flynn 2023-12-06 11:49:45 -05:00 committed by Andreas Kling
parent bea11f6d99
commit a7b98a9761
8 changed files with 26 additions and 8 deletions

View file

@ -140,7 +140,7 @@ Gfx::Color PageClient::background_color() const
return document->background_color();
}
void PageClient::paint(Web::DevicePixelRect const& content_rect, Gfx::Bitmap& target)
void PageClient::paint(Web::DevicePixelRect const& content_rect, Gfx::Bitmap& target, Web::PaintOptions paint_options)
{
Gfx::IntRect bitmap_rect { {}, content_rect.size().to_type<int>() };
@ -162,6 +162,7 @@ void PageClient::paint(Web::DevicePixelRect const& content_rect, Gfx::Bitmap& ta
return;
context.set_should_show_line_box_borders(m_should_show_line_box_borders);
context.set_should_paint_overlay(paint_options.paint_overlay == Web::PaintOptions::PaintOverlay::Yes);
context.set_device_viewport_rect(content_rect);
context.set_has_focus(m_has_focus);
document->paintable()->paint_all_phases(context);

View file

@ -29,7 +29,7 @@ public:
ErrorOr<void> connect_to_webdriver(DeprecatedString const& webdriver_ipc_path);
virtual void paint(Web::DevicePixelRect const& content_rect, Gfx::Bitmap&) override;
virtual void paint(Web::DevicePixelRect const& content_rect, Gfx::Bitmap&, Web::PaintOptions = {}) override;
void set_palette_impl(Gfx::PaletteImpl&);
void set_viewport_rect(Web::DevicePixelRect const&);