Files
ladybird/Libraries/LibWeb/Painting/ScrollState.cpp
Aliaksandr Kalenik af58b00922 LibWeb: Restrict direct access to ScrollFrame's own_offset
Remove the public own_offset() getter from ScrollFrame and the
own_offset_for_frame_with_id() helper from ScrollState. The snapshot
creation in ScrollStateSnapshot now accesses m_own_offset directly
through a friend declaration. This ensures scroll offsets in the
painting pipeline are only read through snapshots.
2026-02-01 16:13:13 +01:00

21 lines
545 B
C++

/*
* Copyright (c) 2025, Aliaksandr Kalenik <kalenik.aliaksandr@gmail.com>
*
* SPDX-License-Identifier: BSD-2-Clause
*/
#include <LibWeb/Painting/ScrollState.h>
namespace Web::Painting {
ScrollStateSnapshot ScrollStateSnapshot::create(Vector<NonnullRefPtr<ScrollFrame>> const& scroll_frames)
{
ScrollStateSnapshot snapshot;
snapshot.own_offsets.ensure_capacity(scroll_frames.size());
for (auto const& scroll_frame : scroll_frames)
snapshot.own_offsets.append({ scroll_frame->m_own_offset });
return snapshot;
}
}