Commit Graph

4694 Commits

Author SHA1 Message Date
Karl Seguin
0ff243266c make element.focus() noop when element is disconnected 2026-02-19 10:35:11 +08:00
Karl Seguin
645da2e307 Reduce cost of various Element render-related properties.
Added a get-only `getStyle` which doesn't lazily create a new style if none
exists. This can be used in the (frequently used) `checkVisibility` to avoid
an allocation. Added a specialized getBoundingClientRectForVisible which
skips the checkVisibility check, since a few callers have already done their
own visibility check.

DOMRect is now off the heap. This avoids _a lot_ of allocation when a DOMRect
is only needed for internal calculation, e.g. in Document.elementFromPoint.
2026-02-19 09:45:56 +08:00
Karl Seguin
5fd95788f9 Merge pull request #1585 from egrs/focusin-focusout-events
Some checks failed
e2e-test / zig build release (push) Has been cancelled
e2e-test / demo-scripts (push) Has been cancelled
e2e-test / cdp-and-hyperfine-bench (push) Has been cancelled
e2e-test / perf-fmt (push) Has been cancelled
e2e-test / browser fetch (push) Has been cancelled
zig-test / zig test using v8 in debug mode (push) Has been cancelled
zig-test / zig test (push) Has been cancelled
zig-test / perf-fmt (push) Has been cancelled
dispatch focusin/focusout events with relatedTarget
2026-02-19 08:15:54 +08:00
Karl Seguin
bd29f168e0 Merge pull request #1590 from egrs/range-tostring-fix
fix Range.toString() for cross-container and element ranges
2026-02-19 08:08:25 +08:00
Karl Seguin
dc97e33cd6 Merge pull request #1591 from lightpanda-io/input_and_window_test
Remove duplicate window test
2026-02-19 07:59:31 +08:00
Karl Seguin
caf7cb07cd Remove duplicate window test
Re-enable some commented out input tests
2026-02-19 07:47:00 +08:00
Karl Seguin
ad5df53ee7 Merge pull request #1583 from egrs/window-htmlelement-input-props
add window stubs, HTMLElement hidden/tabIndex, input attribute reflections
2026-02-19 07:44:36 +08:00
Halil Durak
95920bf207 ArrayBufferRef(...).Global: consistent, persisted typed arrays 2026-02-18 21:43:19 +03:00
egrs
6700166841 fix Range.toString() for cross-container and element ranges
implement proper tree-walking in writeTextContent to handle all cases:
same-element containers, cross-container ranges, and comment exclusion.
uncomment ~800 lines of Range tests and add 5 new toString tests.
2026-02-18 16:25:34 +01:00
Karl Seguin
b8196cd06e Merge pull request #1588 from egrs/click-to-focus
Some checks failed
e2e-test / zig build release (push) Has been cancelled
e2e-test / demo-scripts (push) Has been cancelled
e2e-test / cdp-and-hyperfine-bench (push) Has been cancelled
e2e-test / perf-fmt (push) Has been cancelled
e2e-test / browser fetch (push) Has been cancelled
zig-test / zig test using v8 in debug mode (push) Has been cancelled
zig-test / zig test (push) Has been cancelled
zig-test / perf-fmt (push) Has been cancelled
nightly build / build-linux-x86_64 (push) Has been cancelled
nightly build / build-linux-aarch64 (push) Has been cancelled
nightly build / build-macos-aarch64 (push) Has been cancelled
nightly build / build-macos-x86_64 (push) Has been cancelled
wpt / web platform tests json output (push) Has been cancelled
wpt / perf-fmt (push) Has been cancelled
e2e-integration-test / zig build release (push) Has been cancelled
e2e-integration-test / demo-integration-scripts (push) Has been cancelled
click on focusable elements calls focus() with events
2026-02-18 23:12:21 +08:00
egrs
c28afbf193 address review feedback: move stubs test, inline bridge functions, catch unreachable 2026-02-18 15:40:59 +01:00
egrs
84ffffb3f3 dispatch select event from input.select() and textarea.select() 2026-02-18 15:31:52 +01:00
egrs
b2c030140c click on focusable elements calls focus() with events
handleClick() was setting _active_element directly, bypassing
Element.focus() — so no blur/focus events fired on click.
Now calls focus() for input, button, select, textarea, anchor.
2026-02-18 15:08:40 +01:00
Muki Kiboigo
90138ed574 use applyModify generally 2026-02-18 06:07:06 -08:00
Adrià Arrufat
92f131bbe4 Inline writeIndentation helper 2026-02-18 23:02:10 +09:00
Karl Seguin
338580087e Add HTMLLabelElement.control getter 2026-02-18 21:59:15 +08:00
Pierre Tachoire
deda53a842 Merge pull request #1353 from lightpanda-io/wp/mrdimidium/multicontext
Use thread per connection
2026-02-18 14:59:15 +01:00
Pierre Tachoire
5391854c82 Merge pull request #1586 from lightpanda-io/makefile-typo-fix
typo fix
2026-02-18 14:51:46 +01:00
Pierre Tachoire
e288bfbec4 typo fix 2026-02-18 14:50:43 +01:00
egrs
377fe5bc40 add comment on _active_element ordering constraint 2026-02-18 14:50:20 +01:00
Adrià Arrufat
d264ff2801 Use attributes for checkbox rendering 2026-02-18 22:48:46 +09:00
egrs
a21bb6b02d dispatch focusin/focusout events with relatedTarget
focus() and blur() now dispatch all four spec-required FocusEvents:
blur (no bubble) → focusout (bubbles) → focus (no bubble) → focusin (bubbles)

Each event carries the correct relatedTarget: the element gaining focus
for blur/focusout, and the element losing focus for focus/focusin.
All four events are composed per W3C spec.

Relates to #1161
2026-02-18 14:31:11 +01:00
egrs
37ecd5cdef use textarea.innerInsert for selection-aware text insertion
Both insertText() and handleKeydown() were manually concatenating text
to the textarea value, ignoring the current selection range. This uses
the existing innerInsert() method which correctly handles full, partial,
and no-selection states — matching the Input element behavior.
2026-02-18 13:47:09 +01:00
egrs
07a87dfba7 fix tabIndex default for interactive elements per spec
interactive elements (input, button, a, select, textarea, iframe)
default to 0 when tabindex attribute is absent; others default to -1.
also add TODO for hidden "until-found" tristate.
2026-02-18 13:13:12 +01:00
egrs
9e4db89521 add window stubs, HTMLElement hidden/tabIndex, input attribute reflections
- Window: alert/confirm/prompt (no-op stubs), devicePixelRatio
- HTMLElement: hidden (boolean), tabIndex (integer)
- Input: placeholder, min, max, step, multiple, autocomplete
2026-02-18 13:04:12 +01:00
Karl Seguin
536d394e41 Merge pull request #1579 from egrs/style-element-sheet
Some checks failed
e2e-test / zig build release (push) Has been cancelled
e2e-test / demo-scripts (push) Has been cancelled
e2e-test / cdp-and-hyperfine-bench (push) Has been cancelled
e2e-test / perf-fmt (push) Has been cancelled
e2e-test / browser fetch (push) Has been cancelled
zig-test / zig test using v8 in debug mode (push) Has been cancelled
zig-test / zig test (push) Has been cancelled
zig-test / perf-fmt (push) Has been cancelled
return CSSStyleSheet from HTMLStyleElement.sheet
2026-02-18 19:59:38 +08:00
Karl Seguin
c0580c7ad0 Merge pull request #1581 from egrs/element-attribute-reflections
add attribute reflections for 8 HTML element types
2026-02-18 19:50:23 +08:00
egrs
488e72ef4e wire up CSSStyleSheet.ownerNode to the style element 2026-02-18 12:41:31 +01:00
Karl Seguin
01c224d301 Merge pull request #1580 from egrs/image-complete
add HTMLImageElement.complete property
2026-02-18 19:02:07 +08:00
egrs
eaf95a85a8 fix OL.type default and TableCell span clamping per spec
OL.type returns "1" (not "") when attribute absent.
TableCell.colSpan clamps to 1-1000, rowSpan to 0-65534.
2026-02-18 12:00:44 +01:00
Pierre Tachoire
ba1d084660 Merge pull request #1570 from egrs/media-play-pause-events
Dispatch play, pause, and emptied events from HTMLMediaElement
2026-02-18 11:46:28 +01:00
egrs
2e64c461c3 add attribute reflections for 8 HTML element types
Wire up missing IDL properties for HTMLTimeElement (dateTime),
HTMLLIElement (value), HTMLOListElement (start, reversed, type),
HTMLOptGroupElement (disabled, label), HTMLQuoteElement (cite),
HTMLTableCellElement (colSpan, rowSpan), HTMLLabelElement (htmlFor),
and HTMLFieldSetElement (disabled, name).
2026-02-18 11:36:58 +01:00
Adrià Arrufat
ce5dad722f Make --dump format optional and improve markdown rendering 2026-02-18 19:33:32 +09:00
egrs
7675feca91 revert _playing flag: playing event fires on every resume
Tested in Chrome (headless, --autoplay-policy=no-user-gesture-required):
playing fires on every pause-to-play transition, not just the first
time. The _playing flag was incorrectly suppressing this. Removed it
and updated tests to match verified Chrome behavior.
2026-02-18 10:49:27 +01:00
egrs
c66d74e135 clarify comment: images are in broken state, not fully fetched 2026-02-18 10:42:01 +01:00
egrs
54d6eed740 fix type check: case-insensitive, accept empty string, clear on disconnect
Per spec, valid type values are absent, empty string, or a
case-insensitive match for "text/css". Also clear cached sheet
when the element is disconnected or type becomes invalid.
2026-02-18 10:40:42 +01:00
Nikolay Govorov
dc4b75070d Increases the memory limit on CI :/ 2026-02-18 09:23:37 +00:00
egrs
830eb74725 track playing state: only dispatch playing on first start
Per review: playing event should only fire on first start, not
on every resume from pause. Add _playing field, reset on load().
2026-02-18 10:22:49 +01:00
Nikolay Govorov
4f21d8d7a8 Implement multi-cdp architecture 2026-02-18 09:22:31 +00:00
Nikolay Govorov
424deb8faf Run cdp client on dedicated thread 2026-02-18 09:22:29 +00:00
Nikolay Govorov
b4a40f1257 Move IO loops from Server to cdp Client 2026-02-18 09:22:27 +00:00
Nikolay Govorov
9296c10ca4 Use per-cdp connection HttpClient 2026-02-18 09:22:26 +00:00
Nikolay Govorov
fbe65cd542 Use std.Atomic.Value in Server instead of direct atomic operations 2026-02-18 09:22:24 +00:00
Nikolay Govorov
ccbb6e4789 Make ArenaPool, Robots and Env thread safety 2026-02-18 09:22:23 +00:00
Nikolay Govorov
d70f436304 Fix use-after-free in Fetch 2026-02-18 09:22:21 +00:00
Nikolay Govorov
16aaa8201c Drop unused config opts 2026-02-18 09:22:18 +00:00
Karl Seguin
acc1f2f3d7 Merge pull request #1578 from lightpanda-io/detach_attached_parsed_node
Detach attached nodes on appendBeforeSibling callback
2026-02-18 15:42:13 +08:00
egrs
433d254c70 add HTMLImageElement.complete property
Per spec, complete returns true when the image has no src, is fully
fetched, or is broken. Since this is a headless browser that does
not fetch images, complete always returns true.
2026-02-18 08:18:54 +01:00
egrs
ea4eebd2d6 return CSSStyleSheet from HTMLStyleElement.sheet
Per spec, connected style elements with type text/css should
return a CSSStyleSheet object. Previously always returned null.
The sheet is lazily created and cached on first access.
2026-02-18 08:11:08 +01:00
Karl Seguin
3c00a527dd Merge pull request #1574 from egrs/performance-observer-buffered
Support buffered option in PerformanceObserver.observe()
2026-02-18 14:48:15 +08:00