mirror of
https://github.com/RGBCube/serenity
synced 2025-07-25 05:37:43 +00:00
LibWeb: Remove direct calls of page_did_request_scroll_to()
By replacing the `page_did_request_scroll_to()` calls with a request to perform scrolling in the corresponding navigable, we ensure that the scrolling of iframes will scroll within them instead of triggering scroll of top level document.
This commit is contained in:
parent
607e4cab0a
commit
bf14de4118
7 changed files with 49 additions and 25 deletions
|
@ -1711,11 +1711,10 @@ static ErrorOr<void> scroll_an_element_into_view(DOM::Element& target, Bindings:
|
|||
(void)behavior;
|
||||
|
||||
// AD-HOC:
|
||||
auto& page = document.navigable()->traversable_navigable()->page();
|
||||
// NOTE: Since calculated position is relative to the viewport, we need to add the viewport's position to it
|
||||
// before passing to page_did_request_scroll_to() that expects a position relative to the page.
|
||||
// before passing to perform_scroll_of_viewport() that expects a position relative to the page.
|
||||
position.set_y(position.y() + scrolling_box.y());
|
||||
page.client().page_did_request_scroll_to(position);
|
||||
document.navigable()->perform_scroll_of_viewport(position);
|
||||
}
|
||||
// If scrolling box is associated with an element
|
||||
else {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue