1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-31 13:38:11 +00:00

LibWeb: Clip hidden overflow by absolute rect of containing block

Since handling overflow: hidden in PaintableBox::before_children_paint
while following paint traversal order can't result in correctly computed
clip rectangle for elements that create their own stacking context
(because before_children_paint is called only for parent but overflow:
hidden can be set somewhere deeper but not in direct ancestor), here
introduced new function PaintableBox::clip_rect() that computes clip
rectangle by looking into containing block.

should_clip_overflow flag that disables clip for absolutely positioned
elements in before_children_paint and after_children_paint is removed
because after changing clip rectangle to be computed from not parent
but containing block it is not needed anymore (absolutely positioned
item is clipped if it's containing block has hidden overflow)
This commit is contained in:
Aliaksandr Kalenik 2022-11-12 00:07:43 +03:00 committed by Andreas Kling
parent c1401b37c4
commit f3d57e1157
10 changed files with 55 additions and 40 deletions

View file

@ -19,9 +19,9 @@ Layout::SVGGraphicsBox const& SVGGraphicsPaintable::layout_box() const
return static_cast<Layout::SVGGraphicsBox const&>(layout_node());
}
void SVGGraphicsPaintable::before_children_paint(PaintContext& context, PaintPhase phase, ShouldClipOverflow should_clip_overflow) const
void SVGGraphicsPaintable::before_children_paint(PaintContext& context, PaintPhase phase) const
{
SVGPaintable::before_children_paint(context, phase, should_clip_overflow);
SVGPaintable::before_children_paint(context, phase);
if (phase != PaintPhase::Foreground)
return;