Files
rust_browser/docs/component-inventory.md
Zachary D. Rowitsch 931f17b70e
All checks were successful
ci / fast (linux) (push) Successful in 6m46s
Add BMAD framework, planning artifacts, and architecture decision document
Install BMAD workflow framework with agent commands and templates.
Create product brief, PRD, project context, and architecture decision
document covering networking/persistence strategy, JS engine evolution
path, threading model, web_api scaling, system integration, and
tab/process model. Add generated project documentation (architecture
overview, component inventory, development guide, source tree analysis).

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-12 15:13:06 -04:00

6.7 KiB

Component Inventory — rust_browser

Generated: 2026-03-05 | Scan Level: Deep

Crate Inventory by Layer

Layer 0: Foundation

Crate Files Key Exports Purpose
shared 3 Point, Size, Rect, Color, NodeId, StyleId, LayoutId, BrowserUrl, EdgeSizes, CornerRadii, FontStyle, FontWeight, ImageId Common types, geometry primitives, ID types, error handling

Layer 1: JavaScript Engine

Crate Files Key Exports Purpose
js_parser 35 JsParser, Tokenizer, Program, Statement, Expression, Token, ParseError JavaScript tokenization and AST parsing
js_vm 48 JsVm, JsValue, Interpreter, Environment, VmConfig, HostEnvironment, JsFunction, RuntimeError, OutputSink JavaScript interpreter/virtual machine
js 1 JsEngine, JsError (+ re-exports from js_parser, js_vm) High-level JS engine facade

Layer 1: Document/Style Pipeline

Crate Files Key Exports Purpose
html 9 HtmlParser (parse, parse_into, parse_fragment, tokenize) HTML5 tokenization and tree building
dom 10 Document, Node, NodeKind, ElementData, Attribute, TreeIterator Arena-based DOM tree representation
css 36 CssParser, CssTokenizer, Stylesheet, CssValue, Declaration, Rule, Selector, Unit, FontFaceRule CSS parsing, tokenization, data structures
selectors 17 SelectorEngine, MatchedRule, Selector, SimpleSelector, Combinator, PseudoClass, PseudoElement, Specificity, AncestorFilter CSS selector matching, specificity, cascade
style 34 StyledDocument, StyleContext, ComputedStyles, Display, Position, Float, Clear, BoxSizing, Overflow, TextAlign, VerticalAlign Style computation: cascade, inheritance, UA defaults

Layer 1: Layout & Rendering

Crate Files Key Exports Purpose
layout 60 LayoutEngine, LayoutNode, TextMeasurer, FixedWidthTextMeasurer, ProportionalTextMeasurer, FontMetrics Layout engine: block, inline, flex, table, positioned
display_list 13 DisplayListBuilder, DisplayItem (SolidRect, Border, Text, Image, BackgroundImage, LinearGradient, BoxShadow, PushClip, PopClip), DisplayList Backend-agnostic painting commands
render 14 Renderer, CpuRasterizer, PixelBuffer CPU rasterization of display lists
graphics 1 GraphicsBackend Graphics backend abstraction (placeholder)

Layer 1: Infrastructure

Crate Files Key Exports Purpose
net 7 NetworkStack, HttpLoader, FileLoader, DataUriLoader, Response, LoadResult, LoadId HTTP/HTTPS, file://, data: URI loading with caching
image 1 ImageStore, ImagePipeline, DecodedImage Image decoding: PNG, JPEG, GIF, WebP, SVG
fonts 5 FontProvider, FontRequest, TextMetrics, ScaledFontMetrics, GlyphMask Font loading, metrics, text measurement, rasterization
storage 1 StorageEngine Persistent storage (placeholder)
platform 4 PlatformContext, EventLoop, Window, WindowConfig, WindowEvent, KeyCode, MouseButton, Modifiers OS window/event loop abstraction (winit + softbuffer)
web_api 14 WebApiFacade, EventTarget, EventListenerRegistry, TaskQueue, MicrotaskQueue, PromiseRegistry, DispatchResult JS↔DOM bridge, events, scheduling, promises

Layer 2: Browser Runtime

Crate Files Key Exports Purpose
browser_runtime 5 BrowserRuntime, BrowsingContext, Navigation, NavigationState, NavigationId Tab management, navigation lifecycle, history

Layer 3: Application Shell

Crate Files Key Exports Purpose
app_browser 31 main(), run_windowed_mode(), run_render_mode() Desktop binary: CLI, pipeline orchestration, browser chrome, hit testing, form handling

Application Shell Components (app_browser)

Module Purpose
main CLI argument parsing, mode selection
app_state Mutable browser state (page, scroll, focus)
chrome Browser UI chrome (URL bar, status)
pipeline HTML → styled DOM → layout → display list → render
event_handler User input dispatch (keyboard, mouse)
render_mode Offline rendering orchestration
net_utils URL loading helpers
hit_test Click target resolution from display list
form Form input state and handling
focus_outline Keyboard focus visualization

Display List Item Types

Item Purpose
SolidRect Colored rectangle fill
Border Border edge rendering (4 sides)
Text Rendered text with font/color/position
Image Raster image content
BackgroundImage Background image with position/repeat/size
LinearGradient CSS linear gradient fill
BoxShadow Drop shadow and inset shadow
PushClip / PopClip Clipping region stack

CSS Property Coverage

The style system handles properties across these categories:

Category Examples
Box Model margin, padding, border, width, height, box-sizing
Display/Flow display, position, float, clear, overflow
Text font-family/size/weight/style, text-align, text-transform, line-height, white-space
Color/Background color, background-color/image/position/repeat/size, opacity
Flexbox flex-direction, justify-content, align-items, flex-grow/shrink/basis
Table table-layout, border-collapse, border-spacing
Visual visibility, z-index, box-shadow, border-radius
CSS Variables Custom properties with var() substitution

See docs/CSS2.1_Implementation_Checklist.md for detailed property-level status.

JavaScript Feature Coverage

The JS engine supports:

Category Features
Values undefined, null, boolean, number, string, object, array, function, symbol (partial)
Operators Arithmetic, comparison, logical, bitwise, assignment, typeof, instanceof
Control Flow if/else, for, while, do-while, switch, for-in, for-of, try/catch/finally
Functions Declarations, expressions, arrow functions, closures, rest/spread, default params
Objects Literals, methods, getters/setters, computed properties, destructuring
Built-ins Math, JSON, Array methods, String methods, Object methods, Date, RegExp, Map, Set
ES6+ let/const, template literals, classes, promises, iterators, generators (partial)

See docs/js_feature_matrix.md for detailed feature-level status.