LibWeb: Draw a scrollbar gutter when the scrollbar is enlarged

This commit is contained in:
Timothy Flynn 2025-04-21 09:10:55 -04:00 committed by Tim Flynn
commit 66e422b4f1
Notes: github-actions[bot] 2025-04-22 15:30:14 +00:00
7 changed files with 53 additions and 35 deletions

View file

@ -993,16 +993,23 @@ void DisplayListPlayerSkia::paint_nested_display_list(PaintNestedDisplayList con
void DisplayListPlayerSkia::paint_scrollbar(PaintScrollBar const& command)
{
auto rect = to_skia_rect(command.rect);
auto radius = rect.width() / 2;
auto rrect = SkRRect::MakeRectXY(rect, radius, radius);
auto gutter_rect = to_skia_rect(command.gutter_rect);
auto thumb_rect = to_skia_rect(command.thumb_rect);
auto radius = thumb_rect.width() / 2;
auto thumb_rrect = SkRRect::MakeRectXY(thumb_rect, radius, radius);
auto& canvas = surface().canvas();
auto fill_color = Color(Color::NamedColor::DarkGray).with_alpha(128);
SkPaint fill_paint;
fill_paint.setColor(to_skia_color(fill_color));
canvas.drawRRect(rrect, fill_paint);
auto gutter_fill_color = Color(Color::NamedColor::WarmGray).with_alpha(192);
SkPaint gutter_fill_paint;
gutter_fill_paint.setColor(to_skia_color(gutter_fill_color));
canvas.drawRect(gutter_rect, gutter_fill_paint);
auto thumb_fill_color = Color(Color::NamedColor::DarkGray).with_alpha(gutter_rect.isEmpty() ? 128 : 192);
SkPaint thumb_fill_paint;
thumb_fill_paint.setColor(to_skia_color(thumb_fill_color));
canvas.drawRRect(thumb_rrect, thumb_fill_paint);
auto stroke_color = Color(Color::NamedColor::LightGray).with_alpha(128);
SkPaint stroke_paint;
@ -1010,7 +1017,7 @@ void DisplayListPlayerSkia::paint_scrollbar(PaintScrollBar const& command)
stroke_paint.setStrokeWidth(1);
stroke_paint.setAntiAlias(true);
stroke_paint.setColor(to_skia_color(stroke_color));
canvas.drawRRect(rrect, stroke_paint);
canvas.drawRRect(thumb_rrect, stroke_paint);
}
void DisplayListPlayerSkia::apply_opacity(ApplyOpacity const& command)