From 9e5af374d073842709bf873c9de19c88c24724d4 Mon Sep 17 00:00:00 2001 From: DexesTTP Date: Mon, 18 Jul 2022 18:44:22 +0200 Subject: [PATCH] headless-browser: Split the setters for the screen and the viewport rect These two represent different things, and should be handled by different methods. --- Userland/Utilities/headless-browser.cpp | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/Userland/Utilities/headless-browser.cpp b/Userland/Utilities/headless-browser.cpp index 21f6e834a2..49e2b7b8a4 100644 --- a/Userland/Utilities/headless-browser.cpp +++ b/Userland/Utilities/headless-browser.cpp @@ -94,10 +94,14 @@ public: m_palette_impl = Gfx::PaletteImpl::create_with_anonymous_buffer(theme_buffer); } + void set_viewport_rect(Gfx::IntRect viewport_rect) + { + page().top_level_browsing_context().set_viewport_rect(viewport_rect); + } + void set_screen_rect(Gfx::IntRect screen_rect) { m_screen_rect = screen_rect; - page().top_level_browsing_context().set_viewport_rect(screen_rect); } // ^Web::PageClient @@ -705,6 +709,7 @@ ErrorOr serenity_main(Main::Arguments arguments) page_client->load(AK::URL(url)); // FIXME: Allow passing these values as arguments + page_client->set_viewport_rect({ 0, 0, 800, 600 }); page_client->set_screen_rect({ 0, 0, 800, 600 }); dbgln("Taking screenshot after {} seconds !", take_screenshot_after);