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:
Timothy Flynn 2023-11-24 12:17:16 -05:00 committed by Tim Flynn
commit aa4dcda5dc
Notes: sideshowbarker 2024-07-17 02:37:08 +09:00
5 changed files with 11 additions and 5 deletions

View file

@ -1669,8 +1669,7 @@ static ErrorOr<void> scroll_an_element_into_view(DOM::Element& target, Bindings:
// AD-HOC:
auto* page = document.navigable()->traversable_navigable()->page();
auto scale = page->client().device_pixels_per_css_pixel();
page->client().page_did_request_scroll_to({ position.left() * scale, position.top() * scale });
page->client().page_did_request_scroll_to(position.location());
}
// If scrolling box is associated with an element
else {