LibWeb: Assign "own scroll frame" to a viewport

This commit is contained in:
Aliaksandr Kalenik 2024-08-17 18:57:17 +02:00 committed by Andreas Kling
parent 4833ba06ea
commit a59a839df8
Notes: github-actions[bot] 2024-08-19 16:58:32 +00:00

View file

@ -66,13 +66,9 @@ void ViewportPaintable::paint_all_phases(PaintContext& context)
void ViewportPaintable::assign_scroll_frames() void ViewportPaintable::assign_scroll_frames()
{ {
auto viewport_scroll_frame = adopt_ref(*new ScrollFrame()); int next_id = 0;
viewport_scroll_frame->id = 0; for_each_in_inclusive_subtree_of_type<PaintableBox>([&](auto& paintable_box) {
scroll_state.set(this, move(viewport_scroll_frame)); if (paintable_box.has_scrollable_overflow() || is<ViewportPaintable>(paintable_box)) {
int next_id = 1;
for_each_in_subtree_of_type<PaintableBox>([&](auto& paintable_box) {
if (paintable_box.has_scrollable_overflow()) {
auto scroll_frame = adopt_ref(*new ScrollFrame()); auto scroll_frame = adopt_ref(*new ScrollFrame());
scroll_frame->id = next_id++; scroll_frame->id = next_id++;
paintable_box.set_own_scroll_frame(scroll_frame); paintable_box.set_own_scroll_frame(scroll_frame);