mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-07-29 04:09:13 +00:00
LibWeb: Add "position: sticky" support
Sticky positioning is implemented by modifying the algorithm for assigning and refreshing scroll frames. Now, elements with "position: sticky" are assigned their own scroll frame, and their position is refreshed independently from regular scroll boxes. Refreshing the scroll offsets for sticky boxes does not require display list invalidation. A separate hash map is used for the scroll frames of sticky boxes. This is necessary because a single paintable box can have two scroll frames if it 1) has "position: sticky" and 2) contains scrollable overflow.
This commit is contained in:
parent
866608532a
commit
30b636e90b
Notes:
github-actions[bot]
2024-08-30 17:03:56 +00:00
Author: https://github.com/kalenikaliaksandr
Commit: 30b636e90b
Pull-request: https://github.com/LadybirdBrowser/ladybird/pull/1229
20 changed files with 705 additions and 2 deletions
|
@ -5454,10 +5454,13 @@ RefPtr<Painting::DisplayList> Document::record_display_list(PaintConfig config)
|
|||
display_list->set_device_pixels_per_css_pixel(page().client().device_pixels_per_css_pixel());
|
||||
|
||||
Vector<RefPtr<Painting::ScrollFrame>> scroll_state;
|
||||
scroll_state.resize(viewport_paintable.scroll_state.size());
|
||||
scroll_state.resize(viewport_paintable.scroll_state.size() + viewport_paintable.sticky_state.size());
|
||||
for (auto& [_, scrollable_frame] : viewport_paintable.scroll_state) {
|
||||
scroll_state[scrollable_frame->id] = scrollable_frame;
|
||||
}
|
||||
for (auto& [_, scrollable_frame] : viewport_paintable.sticky_state) {
|
||||
scroll_state[scrollable_frame->id] = scrollable_frame;
|
||||
}
|
||||
|
||||
display_list->set_scroll_state(move(scroll_state));
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue