mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-08-22 02:09:24 +00:00
headless-browser: Store the viewport size as DevicePixelSize
This will just avoid a bunch of needless conversion to/from IntSize in and upcoming commit.
This commit is contained in:
parent
77a46ab1b8
commit
71ccaeda16
Notes:
github-actions[bot]
2024-11-13 10:02:13 +00:00
Author: https://github.com/trflynn89
Commit: 71ccaeda16
Pull-request: https://github.com/LadybirdBrowser/ladybird/pull/2303
7 changed files with 13 additions and 14 deletions
|
@ -12,7 +12,6 @@
|
|||
#include <LibCore/Forward.h>
|
||||
#include <LibCore/Promise.h>
|
||||
#include <LibGfx/Forward.h>
|
||||
#include <LibGfx/Size.h>
|
||||
#include <LibWeb/Page/Page.h>
|
||||
#include <LibWeb/PixelUnits.h>
|
||||
#include <LibWebView/ViewImplementation.h>
|
||||
|
@ -22,7 +21,7 @@ namespace Ladybird {
|
|||
|
||||
class HeadlessWebView final : public WebView::ViewImplementation {
|
||||
public:
|
||||
static NonnullOwnPtr<HeadlessWebView> create(Core::AnonymousBuffer theme, Gfx::IntSize window_size);
|
||||
static NonnullOwnPtr<HeadlessWebView> create(Core::AnonymousBuffer theme, Web::DevicePixelSize window_size);
|
||||
static NonnullOwnPtr<HeadlessWebView> create_child(HeadlessWebView const&, u64 page_index);
|
||||
|
||||
void clear_content_filters();
|
||||
|
@ -35,19 +34,19 @@ public:
|
|||
Function<void()> on_web_content_crashed;
|
||||
|
||||
private:
|
||||
HeadlessWebView(Core::AnonymousBuffer theme, Gfx::IntSize viewport_size);
|
||||
HeadlessWebView(Core::AnonymousBuffer theme, Web::DevicePixelSize viewport_size);
|
||||
|
||||
void update_zoom() override { }
|
||||
void initialize_client(CreateNewClient) override;
|
||||
|
||||
virtual Web::DevicePixelSize viewport_size() const override { return m_viewport_size.to_type<Web::DevicePixels>(); }
|
||||
virtual Web::DevicePixelSize viewport_size() const override { return m_viewport_size; }
|
||||
virtual Gfx::IntPoint to_content_position(Gfx::IntPoint widget_position) const override { return widget_position; }
|
||||
virtual Gfx::IntPoint to_widget_position(Gfx::IntPoint content_position) const override { return content_position; }
|
||||
|
||||
virtual void did_receive_screenshot(Badge<WebView::WebContentClient>, Gfx::ShareableBitmap const& screenshot) override;
|
||||
|
||||
Core::AnonymousBuffer m_theme;
|
||||
Gfx::IntSize m_viewport_size;
|
||||
Web::DevicePixelSize m_viewport_size;
|
||||
|
||||
RefPtr<Core::Promise<RefPtr<Gfx::Bitmap>>> m_pending_screenshot;
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue