LibWeb: Ignore document's box during overflow clip rect calculation

Reduction of bug:
```html
<!DOCTYPE html><style>
html {
    overflow-x: hidden;
    overflow-y: scroll;
}
div {
    background: orange;
    height: 1000px;
    width: 500px;
}
</style><body><div>
```

Fixes https://github.com/SerenityOS/serenity/issues/21690 and painting
on many other websites (null.com, servo.org).
This commit is contained in:
Aliaksandr Kalenik 2023-11-08 15:04:58 +01:00 committed by Andreas Kling
parent a098b6e371
commit fd3411c868
Notes: sideshowbarker 2024-07-17 17:38:29 +09:00

View File

@ -406,6 +406,10 @@ BorderRadiiData PaintableBox::normalized_border_radii_data(ShrinkRadiiForBorders
Optional<CSSPixelRect> PaintableBox::calculate_overflow_clipped_rect() const
{
if (layout_node().is_viewport()) {
return {};
}
if (!m_clip_rect.has_value()) {
// NOTE: stacking context should not be crossed while aggregating rectangle to
// clip `overflow: hidden` because intersecting rectangles with different