ladybird/Tests/LibWeb/Ref/overflow-hidden-4.html
Aliaksandr Kalenik 0bf82f748f LibWeb: Move clip rect calculation to happen before painting
With this change, clip rectangles for boxes with hidden overflow or the
clip property are no longer calculated during the recording of painting
commands. Instead, it has moved to the "pre-paint" phase, along with
the assignment of scrolling offsets, and works in the following way:

1. The paintable tree is traversed to collect all paintable boxes that
   have hidden overflow or use the CSS clip property. For each of these
   boxes, the "final" clip rectangle is calculated by intersecting clip
   rectangles in the containing block chain for a box.
2. The paintable tree is traversed another time, and a clip rectangle
   is assigned for each paintable box contained by a node with hidden
   overflow or the clip property.

This way, clipping becomes much easier during the painting commands
recording phase, as it only concerns the use of already assigned clip
rectangles. The same approach is applied to handle scrolling offsets.

Also, clip rectangle calculation is now implemented more correctly, as
we no longer stop at the stacking context boundary while intersecting
clip rectangles in the containing block chain.

Fixes:
https://github.com/SerenityOS/serenity/issues/22932
https://github.com/SerenityOS/serenity/issues/22883
https://github.com/SerenityOS/serenity/issues/22679
https://github.com/SerenityOS/serenity/issues/22534
2024-01-28 08:25:28 +01:00

28 lines
541 B
HTML

<!DOCTYPE html>
<link rel="match" href="reference/overflow-hidden-4-ref.html" />
<style>
* {
outline: black solid 1px;
}
.outer {
background: pink;
width: 100px;
height: 100px;
overflow: hidden;
}
.middle {
transform: perspective(1200px);
background: orange;
}
.inner {
width: 300px;
height: 300px;
background: magenta;
overflow: hidden;
}
.red {
background: red;
width: 300px;
height: 300px;
}
</style><body><div class="outer"><div class="middle"><div class="inner"><div class="red">