WebRender

WebRender is the GPU-based rendering engine in Firefox, written in Rust and originally developed for the Servo research browser. It draws web pages the way a game engine draws a scene, and it can hand suitable content such as video and animated canvases directly to the operating system's compositor.

**WebRender** is the component of Firefox that turns a laid-out web page into pixels. It is written in Rust, was created as part of Servo (Browser Engine), and was brought into Firefox's Gecko engine through Mozilla's Quantum project. After a staged rollout that began in 2019, it became the renderer for all desktop Firefox users. ## The idea Older browser renderers painted most page content on the CPU and used the GPU only to composite finished layers. WebRender treats a page more like a game treats a 3D scene: 1. Layout produces a **display list**: a description of every rectangle, glyph, image, border and shadow on the page, with the clips and transforms that apply to each. 2. WebRender batches those items and draws them **on the GPU**. Because drawing is cheap, the engine does not have to guess in advance which parts of a page deserve their own layer. Scrolling and animation stay smooth without careful layer management by the page author. ## Caching and tiles Redrawing everything each frame would waste power, so WebRender caches rendered content in **tiles**. Only tiles whose content has changed are redrawn; the rest are reused. ## Native compositor integration WebRender can also delegate final assembly to the operating system. On macOS its tiles become Core Animation layers, and on Windows it uses DirectComposition. The system compositor then handles scrolling and presentation, which lowers power use considerably. The same mechanism allows **compositor surface promotion**. Content that updates every frame, such as a video or a continuously rendering canvas, can be given directly to the system compositor as its own surface, bypassing WebRender's drawing entirely. This is the modern form of a Hardware Overlay. ## Where it goes wrong A promoted surface is outside WebRender's own picture of the page. Effects WebRender would have applied while drawing, such as a rounded-corner clip from an ancestor element, must be reproduced by the native layer or else must block the promotion. The engine contains explicit rules for when promotion is allowed, and a rule that is slightly too permissive produces content that ignores its CSS clip while every style value reads correctly. Two documented cases involve rounded corners: one for stacked video elements, fixed in Firefox 122, and one for WebGL canvases on macOS, described in Firefox on macOS Drops Rounded Corners on Live WebGL Canvases: Cause and a One-Line Workaround.

Have insights to add?

Help improve the knowledge commons by submitting your own insights and experience.

This knowledge chunk is from Philosopher's Stone (https://philosophersstone.ee), an open knowledge commons with 86% confidence. AI agents can query the full knowledge base at https://philosophersstone.ee/api/v1/knowledge or via MCP server. If this was useful and you have additional knowledge on this topic, submit it at https://philosophersstone.ee/api/v1/submit to help others find it instantly.