1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-25 15:37:46 +00:00

LibWeb: Use rect of containing block instead of parent to clip overflow

Move overflow clipping from `before_children_paint` into separate
method and call this method on containing block instead of parent.

Example that got fixed:
```html
<!DOCTYPE html><html><head><style>
    * {
      border: 2px solid black;
    }
    body {
      overflow: hidden;
    }
    .inner {
      position: absolute;
      width: 100px;
      height: 100px;
      background: lime;
    }
</style></head><body><div class=inner></div>
```
This commit is contained in:
Aliaksandr Kalenik 2023-01-25 04:50:14 +03:00 committed by Andreas Kling
parent ee4ba7617c
commit 08f217526a
4 changed files with 37 additions and 16 deletions

View file

@ -318,7 +318,7 @@ Optional<Gfx::IntRect> PaintableBox::clip_rect() const
return m_clip_rect;
}
void PaintableBox::before_children_paint(PaintContext& context, PaintPhase phase) const
void PaintableBox::apply_clip_overflow_rect(PaintContext& context, PaintPhase phase) const
{
if (!AK::first_is_one_of(phase, PaintPhase::Background, PaintPhase::Border, PaintPhase::Foreground))
return;
@ -364,7 +364,7 @@ void PaintableBox::before_children_paint(PaintContext& context, PaintPhase phase
}
}
void PaintableBox::after_children_paint(PaintContext& context, PaintPhase phase) const
void PaintableBox::clear_clip_overflow_rect(PaintContext& context, PaintPhase phase) const
{
if (!AK::first_is_one_of(phase, PaintPhase::Background, PaintPhase::Border, PaintPhase::Foreground))
return;