ladybird/Tests/LibWeb/Crash/CSS/background-repeat-gradient.html
sideshowbarker e356fd8188 LibWeb: Paint heavily-tiled non-image backgrounds as a single pattern
Problem: On https://turbovision.in6-addr.net a tiny-background-size +
background-repeat tile over a large painted area crashed WebContent.

Cause: BackgroundPainting was recording one paint command per tile for
any repeating background that’s not a decoded image. A small tile over a
large area could produce literally millions of commands — resulting in a
display list exceeding MAX_MESSAGE_PAYLOAD_SIZE, and tripping an assert.

Fix: When a repeating AbstractImageStyleValue would emit more tiles than
a fixed threshold, record a single tile into a nested display list and,
reusing some existing SVG pattern machinery, fill the coverage rect with
a PatternPaintStyle. We render the tile once, and repeat it with a
tiling shader — so the display list holds a single command regardless of
tile count. Normal backgrounds keep their exact per-tile painting.

Fixes https://github.com/LadybirdBrowser/ladybird/issues/9876
2026-06-06 09:34:09 +01:00

13 lines
746 B
HTML

<!doctype html>
<!-- A small repeating-gradient tile covering a large area must not record one painting command per tile. Doing so
can produce a display list that overflows the IPC message size limit and crashes the WebContent process. This
applies to every non-image background (linear, radial and conic gradients, image-set). See issue #9876. -->
<style>
div { width: 4000px; height: 4000px; }
.linear { background: linear-gradient(45deg, blue 50%, red 50%) 0 0 / 2px 2px; }
.radial { background: radial-gradient(circle, blue 50%, red 50%) 0 0 / 2px 2px; }
.conic { background: conic-gradient(blue 50%, red 50%) 0 0 / 2px 2px; }
</style>
<div class="linear"></div>
<div class="radial"></div>
<div class="conic"></div>