<!-- mobian-agent-page publisher="dailydev" canonical="https://daily.dev/posts/implementing-compositing-in-lbse-9g7trd74b" -->

---
title: Implementing compositing in LBSE | daily.dev
description: A deep technical walkthrough of solving paint-order correctness in WebKit's new layer-based SVG engine (LBSE). When conditional layer creation gives composited...
canonical: https://daily.dev/posts/implementing-compositing-in-lbse-9g7trd74b
twitter:card: summary_large_image
twitter:site: @dailydotdev
og:type: website
og:site_name: daily.dev
og:title: Implementing compositing in LBSE | daily.dev
og:description: A deep technical walkthrough of solving paint-order correctness in WebKit's new layer-based SVG engine (LBSE). When conditional layer creation gives composited...
og:url: https://daily.dev/posts/implementing-compositing-in-lbse-9g7trd74b
og:image: https://api.daily.dev/og/posts/9G7tRd74B.png
og:image:alt: Implementing compositing in LBSE
og:image:width: 1200
og:image:height: 630
og:locale: en
---

> ## Documentation Index
> Fetch the complete documentation index at: https://daily.dev/llms.txt
> Use this file to discover all available pages before exploring further.

# Implementing compositing in LBSE

**[Planet Igalia](https://daily.dev/sources/planet-igalia)** · 12 min read · 0 upvotes · 0 comments

## Summary

A deep technical walkthrough of solving paint-order correctness in WebKit's new layer-based SVG engine (LBSE). When conditional layer creation gives composited elements (like those with accelerated CSS transform animations) their own GraphicsLayer while plain siblings share a backing store, document-order paint order can break. The first fix attempted, 'sandwich promotion,' forced RenderLayers onto every sibling following a composited one, undermining the project's performance goals, and was scrapped. The adopted solution, 'paint order segments,' splits the flat child list into segments at each composited sibling, giving each run of plain content after a composited element its own overlay GraphicsLayer computed only after compositing decisions are made, keeping the common (non-composited) case free of extra layers. The change landed upstream in WebKit, along with related fixes for transform-triggered layer changes and new tests.

## Full article

daily.dev links to this article rather than hosting it. Read it at the original source: <https://blogs.igalia.com/nzimmermann/posts/2026-07-22-lbse-paint-order-segments>

## Questions this post answers

### How does WebKit's layer-based SVG engine (LBSE) keep SVG paint order correct when only some siblings are composited?

It splits the flat child list into paint order segments at every composited sibling, computed after compositing decisions are made. Content before the first composited sibling paints into the enclosing layer's backing store, each composited sibling gets its own GraphicsLayer, and every run of plain children after a composited sibling gets an overlay GraphicsLayer painting just that slice, restoring document order without forcing RenderLayers onto uncomposited content.

_Engineers tracking browser rendering internals can follow WebKit compositing changes like this via daily.dev._

### Why was the sandwich promotion approach to SVG compositing order abandoned in WebKit's LBSE?

Sandwich promotion forced a RenderLayer onto every sibling following an intrinsically layered element at style time, before any compositing decision existed, so a single opacity change on an early child could give RenderLayers to shapes that never ended up composited. It also required rescanning children on every insert, removal, or style change and walking the tree twice during compositing, creating performance cliffs, so it was scrapped in favor of paint order segments.

_Teams weighing rendering engine architecture trade-offs can track this kind of WebKit design debate on daily.dev._

### When does an SVG element need its own RenderLayer in WebKit's LBSE engine?

A leaf shape carrying only a 2D transform stays layer-free since it has no descendants that could be composited, but any container carrying a transform, even a plain 2D one, needs its own RenderLayer so composited descendants below it compute the correct transformation matrix. Layers otherwise appear only for filters, clips, masks, transformed containers, and genuine compositing.

_Developers debugging SVG rendering performance can follow WebKit's layer-allocation rules on daily.dev._

## Similar posts on daily.dev

- [Making LBSE performant](https://daily.dev/posts/making-lbse-performant-mevbdpbfw) · Planet Igalia · 0 upvotes · 0 comments
- [From Code to Pixels: The Rendering Pipeline](https://daily.dev/posts/from-code-to-pixels-the-rendering-pipeline-4m5zvntkn) · JavaScript in Plain English · 5 upvotes · 0 comments
- [WebKit Igalia Periodical \#81](https://daily.dev/posts/webkit-igalia-periodical-81-wjbyd72xr) · Planet Igalia · 0 upvotes · 0 comments
- [Playing with CSS Layers](https://daily.dev/posts/playing-with-css-layers-tvo9nlhms) · Kitty says hi. · 19 upvotes · 2 comments
- [WebGL for Designers: Creating Interactive, Shader-Driven Graphics Directly in the Browser](https://daily.dev/posts/webgl-for-designers-creating-interactive-shader-driven-graphics-directly-in-the-browser-tynmq00fd) · Codrops · 4 upvotes · 0 comments

---

Tags: [#css](https://daily.dev/tags/css), [#svg](https://daily.dev/tags/svg), [#safari](https://daily.dev/tags/safari)

[View this post on daily.dev](https://daily.dev/posts/implementing-compositing-in-lbse-9g7trd74b)

```json
{"@context":"https://schema.org","@graph":[{"@type":"Organization","@id":"https://daily.dev/#organization","name":"daily.dev","url":"https://daily.dev","logo":{"@type":"ImageObject","url":"https://daily.dev/apple-touch-icon.png","width":180,"height":180},"sameAs":["https://twitter.com/dailydotdev","https://github.com/dailydotdev","https://www.linkedin.com/company/daily-dev-ltd"]},{"@type":"WebSite","@id":"https://daily.dev/#website","url":"https://daily.dev","name":"daily.dev","publisher":{"@id":"https://daily.dev/#organization"},"potentialAction":{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https://daily.dev/search?q={search_term_string}"},"query-input":"required name=search_term_string"}}]}
{"@context":"https://schema.org","@type":"TechArticle","headline":"Implementing compositing in LBSE","url":"https://daily.dev/posts/implementing-compositing-in-lbse-9g7trd74b","mainEntityOfPage":{"@type":"WebPage","@id":"https://daily.dev/posts/implementing-compositing-in-lbse-9g7trd74b"},"datePublished":"2026-09-20T07:44:34.652Z","dateModified":"2026-09-20T07:50:35.468Z","description":"A deep technical walkthrough of solving paint-order correctness in WebKit's new layer-based SVG engine (LBSE). When conditional layer creation gives composited...","image":"https://media.daily.dev/image/upload/s--2-1xRawN--/f_auto/v1722860399/public/Placeholder%2011","thumbnailUrl":"https://media.daily.dev/image/upload/s--2-1xRawN--/f_auto/v1722860399/public/Placeholder%2011","isAccessibleForFree":true,"articleSection":"Planet Igalia","inLanguage":"en","publisher":{"@type":"Organization","name":"daily.dev","url":"https://daily.dev","logo":{"@type":"ImageObject","url":"https://daily.dev/apple-touch-icon.png","width":180,"height":180}},"author":{"@type":"Organization","name":"Planet Igalia","logo":"https://media.daily.dev/image/upload/s--84VSWNwZ--/f_auto,q_auto/v1789890204/logos/planet-igalia?_a=BAMAMicg0","url":"https://daily.dev/sources/planet-igalia"},"commentCount":0,"discussionUrl":"https://daily.dev/posts/implementing-compositing-in-lbse-9g7trd74b","interactionStatistic":[{"@type":"InteractionCounter","interactionType":{"@type":"LikeAction"},"userInteractionCount":0},{"@type":"InteractionCounter","interactionType":{"@type":"CommentAction"},"userInteractionCount":0}],"keywords":"css,svg,safari","timeRequired":"PT12M"}
{"@context":"https://schema.org","@type":"BreadcrumbList","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https://daily.dev"},{"@type":"ListItem","position":2,"name":"Planet Igalia","item":"https://daily.dev/sources/planet-igalia"},{"@type":"ListItem","position":3,"name":"Implementing compositing in LBSE"}]}
{"@context":"https://schema.org","@type":"FAQPage","@id":"https://daily.dev/posts/implementing-compositing-in-lbse-9g7trd74b#faq","mainEntity":[{"@type":"Question","name":"How does WebKit's layer-based SVG engine (LBSE) keep SVG paint order correct when only some siblings are composited?","acceptedAnswer":{"@type":"Answer","text":"It splits the flat child list into paint order segments at every composited sibling, computed after compositing decisions are made. Content before the first composited sibling paints into the enclosing layer's backing store, each composited sibling gets its own GraphicsLayer, and every run of plain children after a composited sibling gets an overlay GraphicsLayer painting just that slice, restoring document order without forcing RenderLayers onto uncomposited content. Engineers tracking browser rendering internals can follow WebKit compositing changes like this via daily.dev."}},{"@type":"Question","name":"Why was the sandwich promotion approach to SVG compositing order abandoned in WebKit's LBSE?","acceptedAnswer":{"@type":"Answer","text":"Sandwich promotion forced a RenderLayer onto every sibling following an intrinsically layered element at style time, before any compositing decision existed, so a single opacity change on an early child could give RenderLayers to shapes that never ended up composited. It also required rescanning children on every insert, removal, or style change and walking the tree twice during compositing, creating performance cliffs, so it was scrapped in favor of paint order segments. Teams weighing rendering engine architecture trade-offs can track this kind of WebKit design debate on daily.dev."}},{"@type":"Question","name":"When does an SVG element need its own RenderLayer in WebKit's LBSE engine?","acceptedAnswer":{"@type":"Answer","text":"A leaf shape carrying only a 2D transform stays layer-free since it has no descendants that could be composited, but any container carrying a transform, even a plain 2D one, needs its own RenderLayer so composited descendants below it compute the correct transformation matrix. Layers otherwise appear only for filters, clips, masks, transformed containers, and genuine compositing. Developers debugging SVG rendering performance can follow WebKit's layer-allocation rules on daily.dev."}}]}
```

