mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-08-21 18:00:16 +00:00
Ladybird: Implement zoom :^)
This commit is contained in:
parent
05ef6c9b64
commit
0cc151bc1c
Notes:
sideshowbarker
2024-07-17 10:05:47 +09:00
Author: https://github.com/linusg
Commit: 0cc151bc1c
Pull-request: https://github.com/SerenityOS/serenity/pull/16973
Reviewed-by: https://github.com/AtkinsSJ ✅
4 changed files with 82 additions and 0 deletions
|
@ -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 };
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue