Commit Graph
10074 Commits
Author SHA1 Message Date
Muki Kiboigo e46575d751 add more sqlite pragmas 2026-11-18 08:42:00 -08:00
Karl Seguin e02c3f83f9 Merge pull request #4687 from lightpanda-io/chrome-tests
adjust tests for newest chrome release
2026-11-18 09:29:28 +08:00
Karl Seguin f81d3ac8d5 revert the chrome change
This was based on chrome running with different settings:
https://github.com/lightpanda-io/demo/pull/317
2026-11-18 09:10:14 +08:00
Karl Seguin 0faee800de Merge pull request #4677 from lightpanda-io/mcp-reap-default-session
mcp: close the idle default session's pages
2026-11-18 08:53:13 +08:00
Karl Seguin f2dc8ceeb4 adjust tests for newest chrome release 2026-11-18 08:48:42 +08:00
Karl Seguin 0e1d8d01ff Merge pull request #4676 from gmit3/fix/349-infallible-nodelist-access
collections: return NodeList length and getAtIndex without an error union
2026-11-18 08:45:41 +08:00
Karl Seguin 2e311f196c Merge pull request #4675 from gmit3/fix/349-identity-lookup-before-type-walk
js: look up a returned object's identity before walking its type chain
2026-11-18 08:45:22 +08:00
Karl Seguin b62323225c remove unneeded error union return from more types 2026-11-18 08:04:25 +08:00
Karl Seguin a1b4f14af1 add more comptime checks 2026-11-18 07:49:29 +08:00
Karl Seguin b4d0a529a5 Merge pull request #4673 from lightpanda-io/grider-layout
Grider Layout
2026-11-18 07:12:57 +08:00
Karl Seguin f160d38c26 Merge pull request #4661 from lightpanda-io/v8-initial-heap
perf: Adds a new flag, --v8-gc-floor-mb and change the default
2026-11-18 07:12:39 +08:00
Karl Seguin b0b248bf36 Merge pull request #4670 from lightpanda-io/crash-resume-aborted-transfer
crash: fix a crash on RI to an aborted transfer
2026-11-18 07:12:20 +08:00
Adrià Arrufat 16e4b567f9 mcp: trim comments 2026-11-17 15:49:57 +01:00
Adrià Arrufat 65b590fec8 mcp: drop the timeout alias and a redundant test step 2026-11-17 15:44:47 +01:00
Adrià Arrufat 9c49272a25 mcp: close the idle default session's pages
The default HTTP session is exempt from --http-session-timeout, and its
page keeps being pumped while idle. A script-heavy page left there holds a
core for as long as the process runs.

When the default session has been idle for the timeout, close its pages
and trim. The session stays, with its cookies: reaping it would have a
fresh one overwrite the --cookie-jar file on exit.

HttpServer.init takes the timeout as a parameter, since the default
worker now reads it from its first iteration.
2026-11-17 15:13:52 +01:00
Goran Mitrovic 1b711d480b collections: return NodeList length and getAtIndex without an error union
None of the NodeList variants can fail, but length returned !u32 and
getAtIndex !?*Node. An error union comes back through memory as two
stores read by one wider load, which can't be store-forwarded. u32 and
?*Node come back in a register.

Drops the unused error union from ChildNodes, RadioNodeList,
selector.List and HTMLFormControlsCollection.iterator too, and the try
at each caller.

Refs #349
2026-11-17 13:56:29 +01:00
Goran Mitrovic c01ca3c9e9 js: look up a returned object's identity before walking its type chain
The identity key is the start of the chain allocation, which most levels
of the chain compute the same as the leaf. Look the instance up at the
first such level, so a hit skips the walk down to the most specific type.

A type that a direct subtype embeds by value as its _proto (EventTarget
inside Node) doesn't sit at the start of the allocation; keyIsChainRoot
detects that at compile time and the lookup moves one level down. In
debug builds wrapLeaf asserts that the slot found higher up is its own.

Refs #349
2026-11-17 13:56:29 +01:00
Felix Piasta b725f520c1 Merge remote-tracking branch 'origin/main' into fix-trim-resources-after-worker-finished 2026-11-17 12:10:13 +01:00
Karl Seguin caf5763e7b rename flags:
--v8-gc-floor-mb -> --v8-gc-auto-min-mb
--v8-gc-hint-floor-mb -> --v8-gc-request-min-mb

Keep --v8-gc-hint-floor-mb alive for backwards compatibility
2026-11-17 16:56:46 +08:00
Karl Seguin 44ac5c7bb0 Grider Layout
Adds better "display: grid" support, including some basic support for various
grid-related styles.

Also improve text wrapping to use the computed width, not just an explicit width
attribute.

Comes with a new grid-specific perf scenario (merged): https://github.com/lightpanda-io/demo/pull/316

While this adds a handful of grid-specific optimization, but it's the more
general improvements in 1.0.4 and #4651 which make this faster:

```
scenario    bin           work Mins       Δ%   task ms  wall ms        Δ%   rss MB      Δ%  reqs
style       1.0.3             290.6   +0.00%        61      340     +0.0%     36.2   +0.0%     4
style       dev               268.8   -7.50%        64      343     +0.9%     42.3  +16.9%     4
layout      1.0.3           12303.1   +0.00%       562      760     +0.0%     39.6   +0.0%     4
layout      dev              1816.0  -85.24%       126      323    -57.5%     45.3  +14.3%     4
hittest     1.0.3            2212.1   +0.00%       154      170     +0.0%     36.1   +0.0%     4
hittest     dev              2138.0   -3.35%       161      183     +7.9%     43.3  +20.1%     4
gbcr        1.0.3           12952.1   +0.00%       681      658     +0.0%     59.2   +0.0%     4
gbcr        dev              1013.6  -92.17%       112       89    -86.5%     59.4   +0.2%     4
grid        1.0.3           20076.0   +0.00%      1125     1102     +0.0%     60.0   +0.0%     4
grid        dev              1305.5  -93.50%       130      108    -90.2%     57.1   -4.9%     4
render      1.0.3             710.7   +0.00%       145      575     +0.0%     39.3   +0.0%     4
render      dev               699.6   -1.56%       145      571     -0.7%     46.3  +18.0%     4
```
2026-11-17 16:15:27 +08:00
Karl Seguin 4decec7379 crash: fix a crash on RI to an aborted transfer
Issue reportd / worked around here:  https://github.com/fastcrw/crw/pull/749

When RI loads the transfer (to continue / fulfill / fail), we need to make sure
the transfer isn't in an aborted state.
2026-11-17 15:18:03 +08:00
Karl Seguin 3b4b12d6b4 perf: Adds a new flag, --v8-gc-floor-mb and change the default
This adds a --v8-gc-floor-mb flag and sets it to 32MiB. The old behavior, v8
default, is that it starts at 32MiB (same) but after each full GC, it lowers
the limit to at least what survived + 8MiB.

This is essentially a mem vs cpu flag similar to `--v8-gc-hint-floor-mb` (PR
`Isolate::MemoryPressureNotification`. This new flag is v8's own floor, under
which it does not start a full GC by itself.

The frames scenario with `--v8-gc-floor-mb 32` (new default) vs
`--v8-gc-floor-mb 0` (old default) shows the new default requiring ~28% fewer
instructions (because it runs fewer GCs)
2026-11-17 06:49:40 +08:00
Karl Seguin 88fb36db0a Merge pull request #4651 from lightpanda-io/faster-layout
Faster layout
2026-11-17 06:38:34 +08:00
Karl Seguin 26ac81d15e Merge pull request #4650 from lightpanda-io/better-layout
Better layout
2026-11-17 06:38:18 +08:00
Karl Seguin c2454cb3b6 fix chrome failure 2026-11-16 23:15:53 +08:00
Karl Seguin 71a1093023 http: preload stylesheets
When --load-resources stylesheet this commit now hooks into the existing preload
to eagerly begin downloading external stylesheets.

This is meant as a replacement for #4565. It's a simpler implementation that
also provides the parallel benefit in more cases.

waiting for the download to complete. So, given:

```html
<link href="blah1.css">
<div></div>
<script>...</script>
<link href="blah2.css">
```

This commit is starts both blah1 and blah2 early, where 4565 processes one
at a time.
2026-11-16 22:36:45 +08:00
Felix Piasta da17f8392d fix: trim malloc arenas after MCP HTTP session ends to release memory held at idle 2026-11-16 13:54:56 +01:00
Karl Seguin 30c4e7c0aa perf: Add a STyleManager hitFacts
Returns everything the hit test needs from an element in a single call, avoiding
the overhead from collecting this over multiple calls.
2026-11-16 16:17:56 +08:00
Karl Seguin 67d7f788a0 perf: horizontalPosition can now resume from previous sibling work 2026-11-16 16:17:56 +08:00
Karl Seguin daf0eaa8ea perf: flowRole helper
Add a single flow role helper that can answer display none, out of flow, block,
or on the line. This removes some overhead of getting each property one at a
time.

Also, viewport change now bumps the layout memo, which makes checking for a
viewport change cheaper.
2026-11-16 16:17:55 +08:00
Karl Seguin 34f6ec31fd perf: StyleManager now optimizes parser appends
A parser append use to be treated as a full style wipe (largely, to keep parser
appends fast). Some parser appends now go through the same flow as a appendChild
and selectively clear cached results
2026-11-16 16:17:55 +08:00
Karl Seguin b73179b12f perf: stylemanager is child-selector aware
We now store a 64 bit hash of the parent, which can be used as a quick check
when a rule doesn't match.
2026-11-16 16:17:55 +08:00
Karl Seguin 591e368be6 perf: stylemanager now keeps an nth-child cache
class reach is now narrowed by the rule's subject.
2026-11-16 16:17:55 +08:00
Karl Seguin 09b5026070 nth-child and similar are now keyed by the compound
Something like li:nth-child(2) no longer matters to a list of div.rows. Similar
behavior for a ~ b which now keys off the `a`.
2026-11-16 16:17:55 +08:00
Karl Seguin fce7e28647 flex row changes only drops the widths memo 2026-11-16 16:17:55 +08:00
Karl Seguin 51ec172a6b perf: Store the vertical band (incl subtree) of elements
Using a side record, store the full vertical band, including the subtree, of
an element. This allows the hit test to skip full trees, where the element's
record vertical band doesn't contain y. This restores _some_ of the hit test
optimization that was possible with the naive l
2026-11-16 16:17:55 +08:00
Karl Seguin 8d1d75d87a perf: stylemanager focus-awareness
The StyleManager now tracks what, if anything, a focus change should invalidate.
2026-11-16 16:17:55 +08:00
Karl Seguin d79679e7db perf: Document.hitTest now keeps a running total
hitTest now keeps a running total so that each child only has to add its own
width to the total added to the parent's left edge.
2026-11-16 16:17:55 +08:00
Karl Seguin 464085204c perf: layout memo tracking
change expands that to be more selective about the layout memo.

Style memo was largely about how a change to el can reach its tree. Layout
memo is more about knowing what up from el needs to be changed (e.g. a child
gets wider).
2026-11-16 16:17:55 +08:00
Karl Seguin 1b4cd86887 perf: boxOffset can now resume from its sibling
On a cache miss, boxOffset now walks backwards to the nearest sibling that has
a cached value instead of walking forward from the parent's first child.

Improves https://github.com/lightpanda-io/browser/issues/4576

The gbcr scenario was +139% work compared to 1.0.4 before this change and is now
at -41.14%.
2026-11-16 16:17:55 +08:00
jaeminbird 2069f1cd78 http: fail a framed response whose connection is lost before its end
A RecvError after the headers was taken as a normal end of body whenever
the response had no Connection header (or Connection: close). That is
right for a close-delimited body, where a TLS peer closing without
close_notify ends it, but a body framed by Content-Length or chunked
encoding has its own end: losing the connection before it means the
response was truncated. fetch() and XHR resolved such responses as
complete, with whatever part had arrived, and a malformed chunked body
loaded as an empty 200.
2026-11-16 12:56:02 +08:00
Karl Seguin 05992d2d3f Merge pull request #4243 from lightpanda-io/navigate-intercept
`intercept` on `NavigateEvent`
2026-11-16 11:24:53 +08:00
Karl Seguin eebbda4718 Merge pull request #4662 from JulienLeal/fix/readable-stream-tee
streams: implement ReadableStream.tee() and values()
2026-11-16 11:24:39 +08:00
Karl Seguin 1cab19b44a contentWidth now counts text, and inline siblings are offset by their earlier siblings + the text before them 2026-11-16 09:52:55 +08:00
Karl Seguin 537866c5aa Better table support
tr	/display:table-row now stack like blocks while td/th/display:table-cell
sit next to each other

width/height on table elements are used.
2026-11-16 09:52:55 +08:00
Karl Seguin 4a2565f237 height fallback for text-containing blocks 2026-11-16 09:52:55 +08:00
Karl Seguin 1dafff2399 layout: absolute and relative position boxes
Stacked on https://github.com/lightpanda-io/browser/pull/4549

Where 4549 was part performance part feature, this closes the feature gap by
adding support for absolute and relative position boxes. Unfortunately, it makes
performance worse: hit testing no longer has an early exit since nodes can now
be positioned anywhere (with the simple layout, once el.y > target_y, we could
exit the loop, now a later element can appear above or at the target).
2026-11-16 09:52:55 +08:00
Karl Seguin 90c99043f9 layout: better height/top and cached offsets
Giving a more accurate top/height is easy. What isn't easy is making it fast.
We cache a lot, and a lot of code busts the cache. This is particularly true
for height/top, where just looking at the site is almost enough to invalidate
every cached layout/computed value.

https://github.com/lightpanda-io/browser/pull/4445 was the first commit to try
to add more narrow invalidation.

But height/top are _so_ sensitive that virtually any change, that height/top
specific optimizations are needed. The short version is that: without better
targeting, changes to an element invalidates every following element (in tree
order).

```
<div id=a>a</div>
<div id=b>b</div>

---
|a|
---
|b|
---
```

change the height of #a, and the top of b, all its children and anything in
tree order after it has a new top. And if #a changes height, maybe its parent
also changes height...and before long, the entire layout cache is trashed.

This commit adds the first specialized invalidation protection for explicit
height changes. The main change is that, rather than caching the absolute top
(which, as explained above, is constantly broken by changes), we cache the
offset relative to the parent. Relative offsets to parents are far more stable.
The only things that become invalid are essentially the elements next siblings.
Top becomes more expensive (adding all ancestor offsets), but that's a small
price to pay.

WIP: because there are other common patterns that still trash the cache. And
those need to be addressed, at least to some degree, before the better top/
height can be used.

This commit adds very specific selective invalidation protection for explicitly
setting a height (e.g. el.style.height = '...') which is relative common and
extremely destructive to the cache without optimization.
2026-11-16 09:52:47 +08:00
Karl Seguin 84e935220c Merge pull request #4637 from lightpanda-io/cdp-default-context-playwright
cdp: let Playwright use the default context before any page
2026-11-16 08:00:49 +08:00
Julien Breno Leal Ambrosio Ximenes 8eab4c4891 streams: implement ReadableStream.tee() and values()
Next.js App Router with `cacheComponents: true` tees the Flight stream
during hydration. Without tee() the page throws `I.tee is not a function`
and React never mounts (#4654).

tee() follows ReadableStreamDefaultTee: it locks the source and each
branch pulls one chunk at a time, so the source isn't drained ahead of
the branches. Both branches get the same chunk (no clone). Cancelling one
branch leaves the other flowing; the source is cancelled once both are,
with [reason1, reason2]. Only a locked stream throws; a closed or errored
source yields closed or errored branches.

values() returns the existing async iterator, which now also returns
itself from [Symbol.asyncIterator] so `for await (... of s.values())`
works.
2026-11-15 20:33:09 -03:00