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

Ladybird: Implement zoom :^)

This commit is contained in:
Linus Groh 2023-01-12 14:39:53 +00:00
parent 05ef6c9b64
commit 0cc151bc1c
4 changed files with 82 additions and 0 deletions

View file

@ -113,6 +113,10 @@ public:
void set_color_scheme(ColorScheme);
void zoom_in();
void zoom_out();
void reset_zoom();
virtual void notify_server_did_layout(Badge<WebContentClient>, Gfx::IntSize content_size) override;
virtual void notify_server_did_paint(Badge<WebContentClient>, i32 bitmap_id) override;
virtual void notify_server_did_invalidate_content_rect(Badge<WebContentClient>, Gfx::IntRect const&) override;
@ -184,9 +188,14 @@ signals:
Gfx::IntRect fullscreen_window();
private:
static constexpr auto ZOOM_MIN_LEVEL = 0.3f;
static constexpr auto ZOOM_MAX_LEVEL = 5.0f;
static constexpr auto ZOOM_STEP = 0.1f;
void request_repaint();
void update_viewport_rect();
void handle_resize();
void update_zoom();
void ensure_js_console_widget();
void ensure_inspector_widget();
@ -197,6 +206,7 @@ private:
void close_sub_widgets();
ErrorOr<Ladybird::DOMNodeProperties> inspect_dom_node(i32 node_id, Optional<Web::CSS::Selector::PseudoElement> pseudo_element);
float m_zoom_level { 1.0 };
float m_device_pixel_ratio { 1.0 };
qreal m_inverse_pixel_scaling_ratio { 1.0 };
bool m_should_show_line_box_borders { false };