No description
Find a file
Tyler Critchlow 16a8640c54
All checks were successful
Rust CI / build_and_test (push) Successful in 9s
ci setup
2025-12-23 23:35:58 -07:00
.forgejo/workflows ci setup 2025-12-23 23:35:58 -07:00
crates ci setup 2025-12-23 23:35:58 -07:00
examples makes sizing rules less “random” and more consistent 2025-12-21 21:33:11 +01:00
src Implement Browser Shell & Tabs combined with some renaming & refactoring 2025-10-30 15:10:42 +01:00
.gitignore collect inline runs and lay them out into line boxes with multiple styled fragments 2025-11-25 21:04:13 +01:00
ARCHITECTURE.md Rect --> Rectangle 2025-12-08 16:21:30 +01:00
Cargo.lock First steps into displaying CSS properties in the Browser 2025-11-21 16:09:09 +01:00
Cargo.toml Speed improvements during build time 2025-10-30 10:51:27 +01:00
README.md Add Next Steps to the readme 2025-12-15 06:38:01 +01:00
ROADMAP.md Ensure HTML elements have the appropriate inline styles attached 2025-12-07 19:59:25 +01:00
rust-toolchain.toml big big refactor yeet 2025-09-22 11:15:47 +02:00
rustfmt.toml ci setup 2025-12-23 23:35:58 -07:00

The Borrowser 🦀🌐

A web browser engine written from scratch in Rust.

Borrowser is a learning-focused project that builds a real browser stack—HTML parsing, CSS cascade, layout, rendering, networking, and desktop UI—from the ground up.
The goal: deeply understand every part of a browser engine, while keeping code clean, modular, and production-quality.


🙋 Why “Borrowser”?

Think Borrow Checker + BrowserBorrowser.
A full browser engine built with Rusts safety and clarity, nothing borrowed from Chromium 😉.


Next steps

  1. HTML Replaced Elements & Form Controls (Phase 1: <img>, <a>, <input type=text>)

  2. Border Support (borders + border-radius basics)

    • inputs/buttons look awful without borders; also helps with debugging layout boxes.
  3. CSS Color Support (to reduce “everything looks wrong” quickly)

  4. CSS Unit Support (em/rem/% etc.)

  5. Inline Formatting Polishing (baseline/vertical-align, better line-height behavior, etc.)


Current Capabilities

Borrowser currently supports:

Browser Shell

  • Native desktop window (via winit)
  • Custom tab strip with navigation (Back / Forward / Refresh / New Tab)
  • Independent per-tab session state and navigation history
  • URL bar with proper navigation handling

Networking

  • Streaming HTML over HTTP
  • Parallel streaming of external CSS files

HTML & CSS

  • HTML tokenizer + DOM tree builder
  • CSS parser: selectors, specificity, inline styles
  • Cascade + computed styles (inheritance + defaults)
  • Incremental DOM/CSS updates via multi-threaded runtimes

Layout & Rendering

  • Styled tree construction
  • Block layout engine (CSS box model, margins, padding)
  • Inline layout engine with:
    • whitespace collapsing
    • word-wrapping
    • line boxes + fragments
  • Painting backgrounds + text via egui + wgpu
  • Scrollable viewport with proper page background selection

Architecture

  • Fully session-aware message bus (CoreCommand / CoreEvent)
  • Separate runtimes for:
    • Networking
    • HTML parsing
    • CSS parsing
  • Thread-safe, highly modular design

🧩 Documentation

Borrowser is built to be understood, not black magic.

  • 📘 Architecture Overview
    Deep dive into every subsystem: DOM, CSS cascade, layout, runtimes, rendering pipeline, message bus, and threading model.

  • 🗺️ Project Roadmap
    The long-term vision, planned features, and sequencing of future work.


🚀 Running Borrowser

Requirements:

  • Latest stable Rust
  • A GPU that supports wgpu (almost all modern machines)

Run in release mode for a smooth experience:

cargo run --release