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

Browser+Ladybird+LibWebView: Move some common functions to LibWebView

The implementations of handle_web_content_process_crash and
take_screenshot are exactly the same across Browser and Ladybird. Let's
reduce some code duplication and move them to LibWebView.
This commit is contained in:
Timothy Flynn 2023-05-17 09:53:13 -04:00 committed by Andreas Kling
parent 5312a140fe
commit d8b14da380
12 changed files with 90 additions and 188 deletions

View file

@ -74,6 +74,12 @@ public:
void toggle_video_loop_state();
void toggle_video_controls_state();
enum class ScreenshotType {
Visible,
Full,
};
ErrorOr<void> take_screenshot(ScreenshotType);
virtual void notify_server_did_layout(Badge<WebContentClient>, Gfx::IntSize content_size) = 0;
virtual void notify_server_did_paint(Badge<WebContentClient>, i32 bitmap_id, Gfx::IntSize) = 0;
virtual void notify_server_did_invalidate_content_rect(Badge<WebContentClient>, Gfx::IntRect const&) = 0;
@ -157,6 +163,8 @@ protected:
ErrorOr<NonnullRefPtr<WebView::WebContentClient>> launch_web_content_process(ReadonlySpan<String> candidate_web_content_paths, EnableCallgrindProfiling = EnableCallgrindProfiling::No, IsLayoutTestMode = IsLayoutTestMode::No);
#endif
void handle_web_content_process_crash();
struct SharedBitmap {
i32 id { -1 };
i32 pending_paints { 0 };