1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-27 04:47:35 +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

@ -114,8 +114,8 @@ public:
DOM::Document const& document() const { return layout_box().document(); }
DOM::Document& document() { return layout_box().document(); }
virtual void before_children_paint(PaintContext&, PaintPhase) const override;
virtual void after_children_paint(PaintContext&, PaintPhase) const override;
virtual void apply_clip_overflow_rect(PaintContext&, PaintPhase) const override;
virtual void clear_clip_overflow_rect(PaintContext&, PaintPhase) const override;
virtual Optional<HitTestResult> hit_test(CSSPixelPoint, HitTestType) const override;