diff options
author | Linus Groh <mail@linusgroh.de> | 2023-01-12 18:31:14 +0000 |
---|---|---|
committer | Linus Groh <mail@linusgroh.de> | 2023-01-12 18:52:32 +0000 |
commit | 36866730cea7d3868fb49de88ce2d2844beb885a (patch) | |
tree | 890d8f5bd6c6cf783a682090db3fc9e05a9d12dc /Userland/Libraries/LibWebView/OutOfProcessWebView.h | |
parent | 966d808135c03d16b1be65df7ca028ae7813476d (diff) | |
download | serenity-36866730cea7d3868fb49de88ce2d2844beb885a.zip |
Browser: Implement zoom :^)
Largely based on the Ladybird implementation in 0cc151b.
Diffstat (limited to 'Userland/Libraries/LibWebView/OutOfProcessWebView.h')
-rw-r--r-- | Userland/Libraries/LibWebView/OutOfProcessWebView.h | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/Userland/Libraries/LibWebView/OutOfProcessWebView.h b/Userland/Libraries/LibWebView/OutOfProcessWebView.h index 935af25e89..73bc7a66ec 100644 --- a/Userland/Libraries/LibWebView/OutOfProcessWebView.h +++ b/Userland/Libraries/LibWebView/OutOfProcessWebView.h @@ -77,6 +77,10 @@ public: void set_system_visibility_state(bool visible); + void zoom_in(); + void zoom_out(); + void reset_zoom(); + Gfx::ShareableBitmap take_screenshot() const; Gfx::ShareableBitmap take_document_screenshot(); @@ -121,6 +125,10 @@ public: Function<void()> on_forward_button; private: + static constexpr auto ZOOM_MIN_LEVEL = 0.3f; + static constexpr auto ZOOM_MAX_LEVEL = 5.0f; + static constexpr auto ZOOM_STEP = 0.1f; + OutOfProcessWebView(); // ^Widget @@ -197,6 +205,7 @@ private: void request_repaint(); void handle_resize(); + void update_zoom(); void create_client(); WebContentClient& client(); @@ -231,6 +240,9 @@ private: Queue<InputEvent> m_pending_input_events; bool m_content_scales_to_viewport { false }; + + float m_zoom_level { 1.0 }; + float m_device_pixel_ratio { 1.0 }; }; } |