feat: initial implementation of a browser application using egui and wgpu

- Added Cargo.toml with dependencies for egui, wgpu, and other libraries.
- Implemented main application logic in src/app.rs, including window management, rendering, and tab handling.
- Created a new module src/servo_host.rs to manage interactions with the Servo engine and webview.
- Established event handling for user inputs, including keyboard and mouse events.
- Integrated a basic UI layout with a tab strip, toolbar, and status bar.
- Implemented functionality for navigating URLs and managing multiple tabs.
This commit is contained in:
2026-08-21 15:29:21 -05:00
parent 3ccb31cfd1
commit 9446a7d0ab
7 changed files with 11860 additions and 1 deletions
+76 -1
View File
@@ -1,2 +1,77 @@
# browser
idk
A minimal Firefox-style web browser built on [Servo](https://servo.org), the Rust web engine — **the newest actively maintained browser built on Servo**, written against the [`servo` crate](https://crates.io/crates/servo) embedding API (v0.1+, released April 2026).
> **Context:** [Verso](https://github.com/versotile-org/verso), the pioneering third-party Servo browser, was archived in October 2025 and is no longer maintained. Servo's own servoshell remains a demo mini-browser for testing the engine. This project picks up the embedder-side baton on the new public `servo` crates.io API — no engine fork required.
## What works
- Tab strip with create/close/switch
- Back / forward / reload navigation with real history state
- URL bar with address parsing and DuckDuckGo search fallback (`localhost` handled too)
- Pages render via Servo into offscreen surfaces and composite under the native chrome
- Mouse, scroll wheel, and keyboard input forwarded to the page
- Live page titles, loading spinners, and hover status bar
- `window.open()` / target=_blank opens a new tab
## Architecture
```
┌──────────────────────────────────────────┐
│ Chrome UI: egui 0.36 + wgpu │ tabs · toolbar · status bar
├──────────────────────────────────────────┤
│ Frame bridge │ WebView::paint() → read_to_image()
├──────────────────────────────────────────┤
│ Engine: servo 0.5 crate │ Stylo · SpiderMonkey · WebRender
│ one WebView per tab, each with its own │
│ OffscreenRenderingContext │
└──────────────────────────────────────────┘
windowing: winit · rendering: wgpu (Metal/Vulkan/DX12)
```
The embedder owns everything above the engine: windowing, chrome, input routing,
and history UI. Servo owns layout, JS, networking, and painting. The two talk through
`WebView::notify_input_event` (down) and a `WebViewDelegate` message queue (up).
## Building
Requires a stable Rust toolchain (1.85+ recommended):
```sh
cargo build --release
cargo run --release
```
First build takes a while — the servo crate compiles SpiderMonkey (C++) and the full
WebRender pipeline. Incremental rebuilds after that are fast.
Tested on macOS (Apple Silicon). Windows and Linux should work in principle since all
dependencies are cross-platform, but they haven't been exercised yet.
## Known limitations
This is an early-days project on top of an engine that is itself pre-1.0:
- No DRM video (Widevine), and some sites will simply not render correctly yet —
that's Servo's web-compat surface area, not something the embedder can fix
- Frames are composited through CPU readback, so heavy pages cost more than a
zero-copy GPU path would (fine for basic browsing)
- No bookmarks/history persistence, downloads, devtools, or preferences UI yet
## Roadmap
- [ ] Zero-copy frame path (share GL textures instead of readback)
- [ ] Bookmarks and browsing history
- [ ] Page context menus
- [ ] Dark mode following system theme
- [ ] Linux CI builds
## Credits
Built on the shoulders of the [Servo project](https://servo.org) (Linux Foundation Europe),
with the chrome rendered by [egui](https://github.com/emilk/egui). Design cues from Firefox.
See also [Verso](https://github.com/versotile-org/verso) (archived) — the pioneering Servo embedder whose contributions live on upstream.
## License
See [LICENSE](LICENSE).