mirror of
https://github.com/RGBCube/serenity
synced 2025-05-31 11:28:12 +00:00
LibWeb+LibWebView+Ladybird: Scale scroll-to CSS positions in PageHost
The `page_did_request_scroll_to` API takes a CSS position, and thus callers should not scale to device pixels before invoking it. Instead, align this API with (most) other PageHost APIs which scale to device pixels before sending the corresponding IPC message. In the AppKit chrome, convert the provided device pixel position to a widget position.
This commit is contained in:
parent
778f10fb26
commit
aa4dcda5dc
5 changed files with 11 additions and 5 deletions
|
@ -38,7 +38,7 @@ WebViewBridge::WebViewBridge(Vector<Gfx::IntRect> screen_rects, float device_pix
|
|||
create_client(WebView::EnableCallgrindProfiling::No);
|
||||
|
||||
on_scroll_by_delta = [this](auto x_delta, auto y_delta) {
|
||||
auto position = to_widget_position(m_viewport_rect.location());
|
||||
auto position = m_viewport_rect.location();
|
||||
position.set_x(position.x() + x_delta);
|
||||
position.set_y(position.y() + y_delta);
|
||||
|
||||
|
@ -63,6 +63,11 @@ WebViewBridge::WebViewBridge(Vector<Gfx::IntRect> screen_rects, float device_pix
|
|||
if (on_scroll_to_point)
|
||||
on_scroll_to_point(position);
|
||||
};
|
||||
|
||||
on_scroll_to_point = [this](auto position) {
|
||||
if (on_scroll)
|
||||
on_scroll(to_widget_position(position));
|
||||
};
|
||||
}
|
||||
|
||||
WebViewBridge::~WebViewBridge() = default;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue