mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-12-08 06:09:58 +00:00
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:
parent
c0d08b68af
commit
e4de6c0d05
Notes:
github-actions[bot]
2025-10-27 23:43:42 +00:00
Author: https://github.com/gmta
Commit: e4de6c0d05
Pull-request: https://github.com/LadybirdBrowser/ladybird/pull/6592
1 changed files with 3 additions and 0 deletions
|
|
@ -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) {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue