LibWeb: Use padding box for clipping overflow

The padding box should be used otherwise the content can overflow
on to the boxes borders.
This commit is contained in:
MacDue 2022-07-04 20:47:23 +01:00 committed by Andreas Kling
parent 9a97adf121
commit 2ceb143571

View file

@ -245,9 +245,10 @@ BorderRadiiData PaintableBox::normalized_border_radii_data() const
void PaintableBox::before_children_paint(PaintContext& context, PaintPhase) const
{
// FIXME: Support more overflow variations.
auto clip_rect = absolute_padding_box_rect().to_rounded<int>();
if (computed_values().overflow_x() == CSS::Overflow::Hidden && computed_values().overflow_y() == CSS::Overflow::Hidden) {
context.painter().save();
context.painter().add_clip_rect(enclosing_int_rect(absolute_border_box_rect()));
context.painter().add_clip_rect(clip_rect);
}
}