LibWeb: Return early if scroll offset is zero

No need to calculate scroll offsets and translate update list commands
if the cumulative offset was zero to begin with.
This commit is contained in:
Jelle Raaijmakers 2025-10-26 10:45:55 +01:00 committed by Jelle Raaijmakers
parent c0d08b68af
commit e4de6c0d05
Notes: github-actions[bot] 2025-10-27 23:43:42 +00:00

View file

@ -127,6 +127,9 @@ void DisplayListPlayer::execute_impl(DisplayList& display_list, ScrollStateSnaps
auto translate_command_by_scroll = [&](auto& command, int scroll_frame_id) {
auto cumulative_offset = scroll_state.cumulative_offset_for_frame_with_id(scroll_frame_id);
if (cumulative_offset.is_zero())
return;
auto scroll_offset = cumulative_offset.to_type<double>().scaled(device_pixels_per_css_pixel).to_type<int>();
command.visit(
[scroll_offset](auto& command) {