Files
ladybird/Tests/LibWeb/Text/input/display_list/z-index-change-no-double-paint.html
Aliaksandr Kalenik 94d7c76226 LibWeb: Add test for z-index change causing double paint in display list
When z-index changes from 0 to a positive value on a positioned element,
the stacking context tree is not rebuilt, causing the element to be
painted twice. This test captures the current (incorrect) behavior.
2026-02-17 20:44:46 +01:00

31 lines
957 B
HTML

<!doctype html>
<script src="../include.js"></script>
<style>
.container { position: relative; width: 200px; height: 200px; }
.target {
position: absolute;
z-index: 0;
width: 50px;
height: 50px;
background: blue;
}
</style>
<div class="container">
<div class="target" id="target"></div>
</div>
<script>
test(() => {
// NOTE: Display lists are captured first and printed later because println() modifies
// the DOM tree, causing layout updates that invalidate the accumulated visual context
// tree, which would affect the captured display lists.
const dlBefore = internals.dumpDisplayList();
document.getElementById("target").style.zIndex = "10";
const dlAfter = internals.dumpDisplayList();
println("Before z-index change:");
println(dlBefore);
println("After z-index change:");
println(dlAfter);
});
</script>