Commit Graph
13 Commits
Author SHA1 Message Date
Merge_Conflict - Pasi 04e2584f7a fix: pop drive-letter lookalike segment for non-file schemes (#2794)
rust-url treats a trailing 'C:'/'C|' path segment as a Windows drive
letter when shortening a path with '..', for every scheme. Per the URL
Standard that exemption only applies to file:. Work around it in the
Rust binding (fix pending upstream in servo/rust-url#1138) so that
new URL('..', 'abc://x/y/z/C:/') resolves to 'abc://x/y/z/'.
2026-09-04 18:05:13 +03:00
Karl Seguin 67927b9bde Add PDF support
adds --dump screen.pdf and CDP's Page.printToPDF (along with IO.read and
IO.read). Builds ontop of https://github.com/lightpanda-io/browser/pull/3231

This generates a text-based PDF, not just our PNG placed into a PDF. The biggest
change to the existing (isolated) code was adding href information so that links
are actually clickable.

Like 3231 the hard parts are all Claude but isolated. The one place it diverged
from the plan was NOT using the subsetter rust crate for trimming the size of
the embedded font. It felt that the dependencies were too much (e.g. a second
version of skrifa, ...). One subsetter was removed, the pdf rendering, while
still a blackbox, was moved from Rust to Zig (pdf.zig), which is kind of nice.
2026-08-28 12:53:36 +08:00
Karl Seguin a0e21b9aeb tweak: improve screenshot code
Remove singleton and give each Browser a screenshot.Renderer.

Also, add tests to make sure the Rust and Zig structures/constants match (this
has proven useful with zig-v8-fork).
2026-08-27 19:22:04 +08:00
Karl Seguin 0c24db4a00 mem: try lto=thin
Try lto=thin in rust so that the html5ever code sits together and triggers less
misses which result in more memory being used.
2026-08-25 17:02:56 +08:00
Karl Seguin de422a72f5 Embed DejaVuSansMono-Bold.ttf for bold headings
fix slant direction for italics
2026-08-25 16:02:51 +08:00
Karl Seguin 1c9971252a small tweak to the build
auto-discover .rs files in src/rust for the build (rather than maintaining the
list by hand).
2026-08-20 17:26:23 +08:00
Karl Seguin 49d473d845 cargo fmt 2026-08-19 21:49:02 +08:00
Karl Seguin ed75e929ba improve glyph cache 2026-08-19 21:49:02 +08:00
Karl Seguin 03b05e8ed2 convert rust panics into errors 2026-08-19 21:49:02 +08:00
Karl Seguin e2c16be63a Always honor screenshot clip
Extend the clip if necessary, but never past the content.
2026-08-19 21:49:02 +08:00
Karl Seguin b6960ab5ca Improve screenshot error mapping
Return (height, rc) rather than just height, so that we can correctly detect
a failed raster (which still produced a height). Also add constants for error
codes rather than magic numbers sprinkled here and there.
2026-08-19 21:49:02 +08:00
Karl Seguin 2c7237f259 cap PNG size
The final size is client-driven (for CDP) and a large width/height/scale will
OOM the process.
2026-08-19 21:49:02 +08:00
Karl Seguin ff5b791b7e wip: screenshot 2026-08-19 21:49:02 +08:00