mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-07-29 04:09:13 +00:00
LibWeb: Unify scroll handling between viewport and scrollable boxes
This change causes the viewport to be treated as a "scroll frame," similar to how it already works for boxes with "overflow: scroll." This means that, instead of encoding the viewport translation into a display list, the items will be assigned the scroll frame id of the viewport and then shifted by the scroll offset before execution. In the future it will allow us to reuse a display list for repainting if only scroll offset has changed. As a side effect, it also removes the need for special handling of "position: fixed" because compensating for the viewport offset while painting or hit-testing is no longer necessary. Instead, anything contained within a "position: fixed" element is simply not assigned a scroll frame id, which means it is not shifted by the scroll offset.
This commit is contained in:
parent
00eca78d28
commit
dd8c693725
Notes:
github-actions[bot]
2024-08-11 19:07:23 +00:00
Author: https://github.com/kalenikaliaksandr
Commit: dd8c693725
Pull-request: https://github.com/LadybirdBrowser/ladybird/pull/1026
5 changed files with 25 additions and 30 deletions
|
@ -2012,8 +2012,11 @@ void Navigable::perform_scroll_of_viewport(CSSPixelPoint new_position)
|
|||
scroll_offset_did_change();
|
||||
set_needs_display();
|
||||
|
||||
if (auto document = active_document())
|
||||
if (auto document = active_document()) {
|
||||
document->set_needs_to_refresh_scroll_state(true);
|
||||
document->set_needs_to_refresh_clip_state(true);
|
||||
document->inform_all_viewport_clients_about_the_current_viewport_rect();
|
||||
}
|
||||
}
|
||||
|
||||
// Schedule the HTML event loop to ensure that a `resize` event gets fired.
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue