1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-27 05:37:34 +00:00

LibWeb: Rename painter() to recording_painter() in PaintContext

Using recording_painter() as a name is less misleading, indicating
the painter in stacking context traversal doesn't perform actual
painting commands.
This commit is contained in:
Aliaksandr Kalenik 2023-11-27 18:49:50 +01:00 committed by Andreas Kling
parent c3d28d7f5a
commit 1b3223dd9e
26 changed files with 119 additions and 121 deletions

View file

@ -68,13 +68,13 @@ void MarkerPaintable::paint(PaintContext& context, PaintPhase phase) const
switch (layout_box().list_style_type()) {
case CSS::ListStyleType::Square:
context.painter().fill_rect(device_marker_rect.to_type<int>(), color);
context.recording_painter().fill_rect(device_marker_rect.to_type<int>(), color);
break;
case CSS::ListStyleType::Circle:
context.painter().draw_ellipse(device_marker_rect.to_type<int>(), color, 1);
context.recording_painter().draw_ellipse(device_marker_rect.to_type<int>(), color, 1);
break;
case CSS::ListStyleType::Disc:
context.painter().fill_ellipse(device_marker_rect.to_type<int>(), color);
context.recording_painter().fill_ellipse(device_marker_rect.to_type<int>(), color);
break;
case CSS::ListStyleType::DisclosureClosed: {
// https://drafts.csswg.org/css-counter-styles-3/#disclosure-closed
@ -87,7 +87,7 @@ void MarkerPaintable::paint(PaintContext& context, PaintPhase phase) const
path.line_to({ left + sin_60_deg * (right - left), (top + bottom) / 2 });
path.line_to({ left, bottom });
path.close();
context.painter().fill_path({ .path = path, .color = color, .winding_rule = Gfx::Painter::WindingRule::EvenOdd });
context.recording_painter().fill_path({ .path = path, .color = color, .winding_rule = Gfx::Painter::WindingRule::EvenOdd });
break;
}
case CSS::ListStyleType::DisclosureOpen: {
@ -101,7 +101,7 @@ void MarkerPaintable::paint(PaintContext& context, PaintPhase phase) const
path.line_to({ right, top });
path.line_to({ (left + right) / 2, top + sin_60_deg * (bottom - top) });
path.close();
context.painter().fill_path({ .path = path, .color = color, .winding_rule = Gfx::Painter::WindingRule::EvenOdd });
context.recording_painter().fill_path({ .path = path, .color = color, .winding_rule = Gfx::Painter::WindingRule::EvenOdd });
break;
}
case CSS::ListStyleType::Decimal:
@ -117,7 +117,7 @@ void MarkerPaintable::paint(PaintContext& context, PaintPhase phase) const
break;
// FIXME: This should use proper text layout logic!
// This does not line up with the text in the <li> element which looks very sad :(
context.painter().draw_text(device_enclosing.to_type<int>(), *text, layout_box().scaled_font(context), Gfx::TextAlignment::Center, color);
context.recording_painter().draw_text(device_enclosing.to_type<int>(), *text, layout_box().scaled_font(context), Gfx::TextAlignment::Center, color);
break;
}
case CSS::ListStyleType::None: