LibWeb: Skip one single positive linear gradient color stop repeat

We prime `color_stop_list_with_expanded_repeat` with the input
`color_stop_list`, so we don't actually need to copy the stops for the
first iteration. This didn't result in graphical glitches, but these
entries were unnecessary irregardless.
This commit is contained in:
Jelle Raaijmakers 2025-10-21 11:54:28 +02:00 committed by Jelle Raaijmakers
parent c4e56cc845
commit 868c29545a
Notes: github-actions[bot] 2025-10-22 08:59:48 +00:00

View file

@ -311,7 +311,7 @@ static ColorStopList expand_repeat_length(ColorStopList const& color_stop_list,
for (auto repeat_count = 1; repeat_count <= negative_repeat_count; repeat_count++) {
for (auto stop : color_stop_list.in_reverse()) {
stop.position += repeat_length * static_cast<float>(-repeat_count);
stop.position -= repeat_length * static_cast<float>(repeat_count);
if (stop.position < 0) {
stop.color = get_color_between_stops(0.0f, stop, color_stop_list_with_expanded_repeat.first());
color_stop_list_with_expanded_repeat.prepend(stop);
@ -321,7 +321,7 @@ static ColorStopList expand_repeat_length(ColorStopList const& color_stop_list,
}
}
for (auto repeat_count = 0; repeat_count < positive_repeat_count; repeat_count++) {
for (auto repeat_count = 1; repeat_count < positive_repeat_count; repeat_count++) {
for (auto stop : color_stop_list) {
stop.position += repeat_length * static_cast<float>(repeat_count);
if (stop.position > 1) {