/web-browser-development:browser-rendering-pipelinefrom web-browser-development
Reference for browser rendering internals: HTML parsing, DOM, CSS cascade, layout algorithms (block, flex, grid), compositing, GPU, JavaScript engines (V8, JSC, SpiderMonkey), bindings, and the event loop. Useful when debugging rendering performance or browser behavior.
Ships in web-browser-development. Installing the plugin adds it to Claude Code.
What the skill costs in Claude's context, stage by stage
Name and description: Claude knows it exists.
SKILL.md joins the conversation and stays.
None: SKILL.md is the whole skill.
Part 2 of 5 of the Web Browser Development reference (plugin
web-browser-development), covering §4–§7. Sibling skills:browser-engine-architecture-and-networking(§0–§3),browser-security-and-privacy(§8–§9),browser-extensions-platform-and-standards(§10–§14),browser-development-reference(§15–§20). Section numbers are shared across the set; a reference written as §N →skillpoints into that sibling skill.Currency: Verified August 2026. See §17 →
browser-development-referencefor the currency snapshot and what goes stale first.
How to read this. Reference, not tutorial. Sections are independent. Three markers:
- [DURABLE] — architecture, algorithms, or a constraint every engine has independently arrived at. Does not expire.
- [ENGINE] — specific to Blink/Chromium, Gecko, WebKit, or Servo/Ladybird. Verify against that project's source or docs.
- [CONTESTED] — the vendors genuinely disagree, often because their business models differ. Both cases given, including the commercial motive where it's load-bearing.
⚠️ GOTCHA boxes mark the mistakes that produce security holes, jank, or compatibility breakage that can never be undone.
The two framings that organize everything below:
- A browser is a hostile-input execution environment that must never say no. It runs untrusted code from anyone, on documents that are frequently malformed, and it is not permitted to refuse or crash. Every architectural decision — the multi-process model, the error-tolerant parser, the sandbox — descends from that.
- The web's compatibility constraint is stronger than any other platform's. You cannot break existing sites. Not the well-written ones, not the abandoned ones. This is why the platform accretes and rarely subtracts, and why "just fix it properly" is almost never available.
[DURABLE] The HTML parsing algorithm is fully specified, including error recovery, and you must implement it exactly. This is unusual and important: HTML is not a grammar you can choose how to recover from. The spec defines a tokenizer state machine plus a tree construction stage with ~23 "insertion modes," and it defines the correct output for every malformed input — including the famous "adoption agency algorithm" for mis-nested formatting tags.
Why it's specified this way: before HTML5, every engine recovered differently, so malformed pages (which is most pages) rendered differently everywhere. The spec codified what browsers already did. Deviating from it is a compatibility bug, not a design choice.
Other parser realities:
document.write — can inject content into the token stream mid-parse. It is the
single ugliest constraint on parser architecture and the reason streaming parsers have to
be re-entrant.async and defer change the ordering guarantees.
Getting the ordering exactly right is required for compatibility.A mutable tree with live collections, mutation observers, ranges, and shadow trees. Implementation concerns that dominate:
NodeLists and HTMLCollections — must reflect mutations, which means either
recomputing or maintaining invalidation. A classic performance trap for both engine and
page author.[DURABLE] Style resolution is: for each element, find every declaration that applies, sort by the cascade, and produce a computed value for every property. The cascade order (later wins):
1. origin & importance user-agent < user < author < animations
< author !important < user !important < UA !important
< transitions
2. cascade layers (@layer — later layers win within the same origin)
3. specificity (id, class/attr/pseudo-class, type/pseudo-element)
4. order of appearance
Then inheritance for inherited properties, then computed → used → actual values.
⚠️ Specificity is not a single number. It's a 3-tuple compared lexicographically —
(1,0,0) beats (0,99,99). Implementations that pack it into an integer eventually
overflow on pathological selectors, and real sites contain pathological selectors.
[DURABLE] Match selectors right-to-left. Given div.container > p a, an engine starts
at the candidate a element and walks up, because matching left-to-right would require
descending the entire subtree of every div.container. This single fact explains most of
CSS performance advice.
Optimizations every engine implements: bloom filters for ancestor checks (cheap
"definitely not a match" rejection), rule hashing by rightmost simple selector
(id/class/tag buckets), style sharing caches for elements with identical inputs, and
invalidation sets — precomputed knowledge of which rules could possibly be affected by
a given class/attribute change, so a classList.toggle doesn't restyle the document.
[ENGINE] Servo's Stylo — parallel style resolution in Rust — is the notable architectural departure, and it shipped in Firefox. Style is unusually parallelizable because sibling subtrees are largely independent; layout is much less so.
[DURABLE] Computing style from scratch is easy. Knowing what to recompute when something
changes is where engines live or die. A DOM mutation, a class change, a media-query
flip, a container resize, or a :hover must invalidate the minimum possible set. Getting
this wrong shows up as jank, not as incorrect rendering, which makes it hard to test and
easy to regress.
Container queries and :has() made this dramatically harder — both create
dependencies that flow up or sideways rather than down the tree, breaking the
assumption that style depends only on ancestors.
[ENGINE — Chromium's RenderingNG names the stages; every engine has equivalents]:
ANIMATE mutate computed styles and property trees over time
STYLE apply CSS to the DOM → computed styles
LAYOUT compute size and position → the IMMUTABLE FRAGMENT TREE
PRE-PAINT compute property trees; invalidate display lists and texture tiles
SCROLL update scroll offsets by mutating property trees
PAINT compute a DISPLAY LIST describing how to raster
COMMIT copy property trees and display lists to the compositor
LAYERIZE group display items into composited layers (CompositeAfterPaint)
RASTER display list → GPU texture tiles
ACTIVATE / AGGREGATE / DRAW assemble and execute the compositor frame on the GPU
[DURABLE] The crucial property: stages can be skipped. Animating transform or
opacity, and scrolling, mutate only property trees — so they skip style, layout,
pre-paint, and paint entirely and run on the compositor thread, never touching the main
thread. That is exactly why "animate transform/opacity, not width/height/top/left" is the
universal performance advice, and why an engine's threading architecture is a developer-
facing fact.
You must implement, correctly and interoperably: block and inline formatting contexts (including floats, margin collapsing, and line breaking — the oldest and gnarliest code in any engine), flexbox, grid (and subgrid), tables (an algorithm nobody enjoys and everybody needs), positioned layout, fragmentation (multicol, print, and page breaking), writing modes (vertical text, RTL — and these interact with everything), and text shaping (HarfBuzz-class complexity: ligatures, bidi per UAX #9, grapheme clusters, font fallback).
⚠️ GOTCHA — text is harder than layout. Font fallback, shaping, bidi, line-breaking per UAX #14, and emoji sequences are collectively a larger correctness surface than the box algorithms, and getting them wrong is immediately visible to users in languages the implementers don't read.
[DURABLE] Two threads, and the split is the whole design. The main thread runs JS, style, layout, and paint. The compositor thread handles scroll, composited animations, and frame submission. If the main thread is blocked for 500 ms, scrolling still works — that is the entire justification for the architecture's complexity.
will-change is the author-facing
hint, and it is routinely abused into the second failure mode.V8 (Chromium), SpiderMonkey (Gecko, and Servo), JavaScriptCore (WebKit), LibJS (Ladybird). All modern ones are tiered: interpreter → baseline JIT → optimizing JIT, with type-feedback-driven speculation, guards, and deoptimization back to the interpreter when a guard fails. Hidden classes/shapes plus inline caches are what make dynamic property access fast, and are the biggest single idea in dynamic-language performance.
⚠️ Note the design tension Ladybird surfaces: it has argued for no JIT, on security and complexity grounds — JITs are a huge exploit surface and require W^X gymnastics — at an obvious performance cost. That's a real, live trade-off, not a settled question, and it's the same trade Apple makes by restricting JIT entitlements on iOS.
[DURABLE] The DOM is C++; the DOM is also JavaScript objects. Reconciling those two object models is a large, subtle subsystem. WebIDL defines the interfaces; a code generator produces the glue. The hard parts:
window reference across origins
exposes a tiny allow-list, and every access must be checked.[DURABLE] Exactly one specification governs when things happen, and page-visible behaviour depends on it:
run a task (one macrotask: event, timer, network callback)
→ drain the MICROTASK queue completely (promises, MutationObserver)
⚠️ microtasks that enqueue microtasks can starve the loop forever
→ if it's time to render:
run rAF callbacks
run ResizeObserver / IntersectionObserver
update rendering: style → layout → paint → commit
→ idle callbacks (requestIdleCallback) if time remains
⚠️ Forced synchronous layout ("layout thrashing") — reading a geometry property
(offsetHeight, getBoundingClientRect) after a write forces layout immediately,
mid-task. Interleaving reads and writes in a loop turns one layout into N. This is the
single most common page-performance bug, and the engine's only defence is to expose it in
DevTools.
Scheduling is now a first-class engine concern: task prioritization, scheduler.yield(),
isInputPending, long-task attribution, and — the metric that made all of this visible —
INP (Interaction to Next Paint), which measures the full interaction lifecycle rather
than just input delay.
What SKILL.md sets; muted values are Claude Code's defaults
Three short reads, in order
npx claudepluginhub the-vibey-project/vibey --plugin web-browser-development5 skills in this plugin
/browser-development-referenceUse when reviewing browser or web-platform work for known anti-patterns, weighing contested questions (Manifest V3, how much capability the web should have, the engine monoculture, Site Isolation's cost, JIT or no JIT, fingerprinting strategy, blocking ads by default, living standards vs versioned specs), checking whether an engine, standard, or privacy-policy claim is still current (snapshot verified August 2026), finding the primary sources, books, people, and channels, or needing the numbers, 'why is this page slow' triage order, and browser security review checklist. Companion to the other web-browser-development skills./browser-engine-architecture-and-networkingUse when working on or reasoning about browser architecture: the anatomy of a browser (the router for the whole web-browser-development reference), who actually renders the web (Blink, WebKit, Gecko, Servo, Ladybird) and what it costs to build one, what a browser is besides an engine, why multiple processes, Site Isolation, sandboxing per platform, IPC design, and the networking stack — HTTP/1.1, HTTP/2, HTTP/3 and QUIC, TLS, DNS, and caching.