1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-27 21:37:35 +00:00

Browser+Ladybird+LibWebView: Virtualize computing content/widget points

This will allow moving some copy-pasted functionality from web view
implementations to the base LibWebView class.
This commit is contained in:
Timothy Flynn 2023-05-17 10:12:13 -04:00 committed by Andreas Kling
parent 31d7565cf3
commit 2d51b8c286
6 changed files with 37 additions and 22 deletions

View file

@ -90,6 +90,16 @@ Gfx::IntRect OutOfProcessWebView::viewport_rect() const
return visible_content_rect();
}
Gfx::IntPoint OutOfProcessWebView::to_content_position(Gfx::IntPoint widget_position) const
{
return GUI::AbstractScrollableWidget::to_content_position(widget_position);
}
Gfx::IntPoint OutOfProcessWebView::to_widget_position(Gfx::IntPoint content_position) const
{
return GUI::AbstractScrollableWidget::to_widget_position(content_position);
}
void OutOfProcessWebView::update_zoom()
{
client().async_set_device_pixels_per_css_pixel(m_device_pixel_ratio * m_zoom_level);

View file

@ -179,6 +179,8 @@ private:
virtual void notify_server_did_finish_handling_input_event(bool event_was_accepted) override;
virtual Gfx::IntRect viewport_rect() const override;
virtual Gfx::IntPoint to_content_position(Gfx::IntPoint widget_position) const override;
virtual Gfx::IntPoint to_widget_position(Gfx::IntPoint content_position) const override;
using InputEvent = Variant<GUI::KeyEvent, GUI::MouseEvent>;
void enqueue_input_event(InputEvent const&);

View file

@ -136,6 +136,8 @@ public:
virtual void notify_server_did_finish_handling_input_event(bool event_was_accepted) = 0;
virtual Gfx::IntRect viewport_rect() const = 0;
virtual Gfx::IntPoint to_content_position(Gfx::IntPoint widget_position) const = 0;
virtual Gfx::IntPoint to_widget_position(Gfx::IntPoint content_position) const = 0;
protected:
static constexpr auto ZOOM_MIN_LEVEL = 0.3f;