mirror of
https://github.com/RGBCube/serenity
synced 2025-07-25 14:47:44 +00:00
LibWeb: Clip descendants of boxes with overflow:hidden
This is a very limited implementation of overflow:hidden, but since it's easy to cover this common scenario, let's do it.
This commit is contained in:
parent
df3cd2fd56
commit
ec49c8fefd
2 changed files with 21 additions and 0 deletions
|
@ -234,4 +234,22 @@ StackingContext* Box::enclosing_stacking_context()
|
|||
VERIFY_NOT_REACHED();
|
||||
}
|
||||
|
||||
void Box::before_children_paint(PaintContext& context, PaintPhase phase)
|
||||
{
|
||||
NodeWithStyleAndBoxModelMetrics::before_children_paint(context, phase);
|
||||
// FIXME: Support more overflow variations.
|
||||
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(bordered_rect()));
|
||||
}
|
||||
}
|
||||
|
||||
void Box::after_children_paint(PaintContext& context, PaintPhase phase)
|
||||
{
|
||||
NodeWithStyleAndBoxModelMetrics::after_children_paint(context, phase);
|
||||
// FIXME: Support more overflow variations.
|
||||
if (computed_values().overflow_x() == CSS::Overflow::Hidden && computed_values().overflow_y() == CSS::Overflow::Hidden)
|
||||
context.painter().restore();
|
||||
}
|
||||
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue