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

LibWeb: Implement screenshot painting inside Web::WebDriver

This will allow for implementing the screenshot action closer to the
spec, as we can now use HTMLCanvasElement to encode the bitmap, and
capture the screenshot on the animation frame loop.
This commit is contained in:
Timothy Flynn 2022-11-10 14:57:16 -05:00 committed by Linus Groh
parent 6b392cef9c
commit 40b9d248be
3 changed files with 96 additions and 0 deletions

View file

@ -0,0 +1,19 @@
/*
* Copyright (c) 2022, Tim Flynn <trflynn89@serenityos.org>
*
* SPDX-License-Identifier: BSD-2-Clause
*/
#pragma once
#include <AK/Function.h>
#include <LibGfx/Forward.h>
#include <LibWeb/Forward.h>
#include <LibWeb/WebDriver/Response.h>
namespace Web::WebDriver {
using Painter = Function<void(Gfx::IntRect const&, Gfx::Bitmap&)>;
Response capture_element_screenshot(Painter const& painter, Page& page, DOM::Element& element, Gfx::IntRect& rect);
}