Commit Graph

4291 Commits

Author SHA1 Message Date
Karl Seguin
c823b8d7ae Add more cookie tests
Fix trimming and incorrect early loop termination when  expiring cookies.
2026-02-20 20:03:18 +08:00
Karl Seguin
279f2dd633 Merge pull request #1599 from lightpanda-io/input_sanitize_ownership
Improve and fix sanitized value ownership.
2026-02-20 18:40:51 +08:00
Karl Seguin
dec051a6e0 Merge pull request #1603 from egrs/wpt-spec-guards
spec compliance: missing validation guards
2026-02-20 15:33:06 +08:00
Karl Seguin
790fdd320c Merge pull request #1610 from lightpanda-io/add_js_nullablestring
Add js.NullableString
2026-02-20 15:30:15 +08:00
Karl Seguin
feb4a364a7 Merge pull request #1608 from egrs/null-domstring-constants
add DOMException legacy error code constants
2026-02-20 15:30:01 +08:00
egrs
1140149e1e add dom_exception flag to Element.replaceChildren 2026-02-20 08:22:29 +01:00
egrs
2ee9599b6e add DOMException legacy error code constants
Add all 25 legacy constants (INDEX_SIZE_ERR through DATA_CLONE_ERR)
to DOMException on both constructor and prototype, enabling WPT
assert_throws_dom checks that reference e.code.
2026-02-20 08:13:23 +01:00
Karl Seguin
7c4c2f7860 Merge pull request #1605 from egrs/wpt-chardata-utf16
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
fix CharacterData methods to use UTF-16 code unit offsets
2026-02-20 09:35:26 +08:00
Karl Seguin
90b7f2ff3b Improve and fix sanitized value ownership.
1 - Fix an issue where build would persist a value in the call_arena
2 - Remove double allocation (call_arena -> page_arena)
3 - Improve ergonomics of sanitizeValue with a comptime value indicating whether
    or not to always dupe the value.
2026-02-20 09:30:44 +08:00
Karl Seguin
d3f0041e93 Merge pull request #1607 from arrufat/markdown-anchors
markdown: handle block-level and standalone anchors
2026-02-20 08:59:41 +08:00
Karl Seguin
9d60142828 Add js.NullableString
When a WebAPI takes `[]const u8`, we coerce values to strings. But when it
takes a `?[]const u8` how should we handle `null`?  Some APIs might want to know
that it was null, others might just want `"null``.

Currently when `null` is passed to `?[]const u8`, we'll get null.

This adds a discriminator type, js.NullableString. When `null` is passed to it
it'll be converted to `"null"`.
2026-02-20 07:24:43 +08:00
Adrià Arrufat
68d5edca60 markdown: use node.is() for type checking and casting 2026-02-20 08:14:15 +09:00
Karl Seguin
1b369489df Merge pull request #1602 from lightpanda-io/css-delcaration
parse style attribute on CSSStyleDeclaration init
2026-02-20 06:57:58 +08:00
Karl Seguin
600ddfbf2d Merge pull request #1587 from lightpanda-io/label_control
Add HTMLLabelElement.control getter
2026-02-20 06:56:37 +08:00
Karl Seguin
415d4dde2a Merge pull request #1606 from lightpanda-io/form_selectors
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
More pseudo-seletors
2026-02-19 23:49:35 +08:00
Pierre Tachoire
1867245ed3 Merge pull request #1598 from egrs/input-value-sanitization
input value sanitization per WHATWG spec
2026-02-19 16:48:56 +01:00
egrs
3673956c1c add pure zig tests for utf16Len and utf16OffsetToUtf8 2026-02-19 16:29:49 +01:00
egrs
bdd3c274ed address review: arena param + pure zig tests
- sanitizeDatetimeLocal takes arena: Allocator instead of *Page
- add unit tests for isValidFloatingPoint, isValidDate, isValidMonth,
  isValidWeek, isValidTime, sanitizeDatetimeLocal, parseAllDigits,
  daysInMonth, maxWeeksInYear
2026-02-19 16:22:13 +01:00
Adrià Arrufat
423034d5c4 markdown: handle block-level and standalone anchors in
Adds logic to detect if an anchor contains block descendants or is a
standalone element within a layout block. These are now rendered with
appropriate spacing and link formatting. Also adds `.main` to the list
of block elements.
2026-02-20 00:11:38 +09:00
Pierre Tachoire
19fd2b12c0 Update src/browser/webapi/css/CSSStyleDeclaration.zig
Co-authored-by: Karl Seguin <karlseguin@users.noreply.github.com>
2026-02-19 15:29:36 +01:00
Karl Seguin
21cd17873f More pseudo-seletors
:invalid, :valid and :indeterminate implementation

Fix Element.closest with :scope pseudo-selector.
2026-02-19 22:28:14 +08:00
egrs
9870fa9e34 fix CharacterData methods to use UTF-16 code unit offsets
The DOM spec requires CharacterData offset/length to count UTF-16 code
units, not UTF-8 bytes or Unicode codepoints. Multi-byte characters
(CJK = 3 bytes UTF-8 / 1 code unit, emoji = 4 bytes / 2 code units)
were getting mangled.

- Add utf16Len/utf16OffsetToUtf8 helpers for UTF-8 ↔ UTF-16 conversion
- Fix .length to count UTF-16 code units instead of codepoints
- Fix substringData, deleteData, insertData, replaceData, splitText
- Fix data setter: null → "" (LegacyNullToEmptyString), undefined → "undefined"

Flips 6 WPT files (+134 subtests), 0 regressions.
2026-02-19 15:18:28 +01:00
Karl Seguin
938cd5e136 Merge pull request #1582 from lightpanda-io/cdp_per_page_frame_id
Rework CDP frameIds (and loaderIds and requestIds and interceptorIds)
2026-02-19 22:16:52 +08:00
Karl Seguin
e8025ad4b3 Merge pull request #1592 from lightpanda-io/element_render_property_optimization
Reduce cost of various Element render-related properties.
2026-02-19 22:16:17 +08:00
Karl Seguin
07fa141aaa Merge pull request #1593 from lightpanda-io/focus_noop_disconnected
make element.focus()  noop when element is disconnected
2026-02-19 22:16:04 +08:00
Pierre Tachoire
18bdf1e8b3 Merge pull request #1594 from lightpanda-io/fix_flaky_scroll_test
Fix flaky window.scrollTo test
2026-02-19 14:58:28 +01:00
Pierre Tachoire
5be977005e avoid useless priority parsing in CSSStyleDeclaration 2026-02-19 14:49:49 +01:00
Karl Seguin
282b64278e Merge pull request #1601 from lightpanda-io/animation-cancel
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
implement Animation.cancel()
2026-02-19 21:37:08 +08:00
Pierre Tachoire
7263d484de Update src/browser/webapi/css/CSSStyleDeclaration.zig
Co-authored-by: Karl Seguin <karlseguin@users.noreply.github.com>
2026-02-19 14:36:02 +01:00
egrs
bdb059b6c9 spec compliance: missing validation guards
- Event.preventDefault() and returnValue respect cancelable=false
- MutationObserver.observe() validates options per spec
- detached checkbox/radio click suppresses input/change events
- doctype insertion into non-document throws HierarchyRequestError
- error.TypeError maps to JS TypeError (not generic Error)
- enable dom_exception on Element/DocumentFragment mutation methods
2026-02-19 14:23:11 +01:00
Pierre Tachoire
de3f5011bc parse style attribute on CSSStyleDeclaration init
To reflect the current style attribute, CSSStyleDeclaration now parses
it on init.

Moreover, this PR synchronizes the element's style attribute with the
dynamic changes.
2026-02-19 12:26:04 +01:00
Pierre Tachoire
de9faffa33 implement Animation.cancel() 2026-02-19 12:12:59 +01:00
egrs
dd19e880c5 merge main, resolve comment conflicts in Input.zig 2026-02-19 10:16:34 +00:00
egrs
b5e8fa007c input value sanitization per WHATWG spec
- number: validate against spec grammar (reject "+1", "1.", "Infinity",
  "NaN", overflow values like "2e308")
- date: validate YYYY-MM-DD with day-of-month and leap year checks
- time: validate HH:MM[:SS[.sss]]
- month: validate YYYY-MM
- week: validate YYYY-Www with ISO 8601 week count
- datetime-local: validate and normalize (T separator, shortest time)
- color: normalize hex to lowercase per spec
- checkbox/radio: return "on" as default value
- sanitize initial value from HTML attributes in created()
2026-02-19 11:02:03 +01:00
Karl Seguin
c3555bfcab Merge pull request #1596 from lightpanda-io/animation-improve
Improve Animation support: async update from idle => running => finished
2026-02-19 18:01:17 +08:00
Karl Seguin
0383db8788 Merge pull request #1595 from egrs/wpt-value-fixes
fix input value defaults, color normalization, and event propagation resets
2026-02-19 17:56:18 +08:00
Karl Seguin
d7af122c18 Merge pull request #1564 from lightpanda-io/nikneym/create-image-data
Add `createImageData` and `putImageData` to `CanvasRenderingContext2D`
2026-02-19 17:56:02 +08:00
Pierre Tachoire
e15b8145b1 create Animation in the pool arena 2026-02-19 10:50:12 +01:00
Pierre Tachoire
d75f5f9231 don't play animation when startTime is set to null 2026-02-19 10:41:07 +01:00
Pierre Tachoire
9939797792 fix comment 2026-02-19 10:36:29 +01:00
Pierre Tachoire
5248b9fc6f Update src/browser/webapi/animation/Animation.zig
Co-authored-by: Karl Seguin <karlseguin@users.noreply.github.com>
2026-02-19 10:35:46 +01:00
Pierre Tachoire
e15295bdac Merge pull request #1560 from arrufat/dump-markdown
Add support for dumping output to markdown
v0.2.4
2026-02-19 10:32:57 +01:00
Karl Seguin
4e1f96e09c Merge pull request #1597 from lightpanda-io/CSSStyleProperties_setNamed
add CSSStyleProperties array set support
2026-02-19 17:30:54 +08:00
Halil Durak
96cfdebced ImageData#constructor: check bounds of dimensions + don't overflow size
Also adds a related `too-large` test.
2026-02-19 12:09:24 +03:00
Halil Durak
944f34b833 createImageData: remove unnecessary unreachable 2026-02-19 12:09:24 +03:00
Halil Durak
1023b2ca9c test blocks need at least a single assertion 2026-02-19 12:09:24 +03:00
Halil Durak
16318bb9f6 add tests 2026-02-19 12:09:24 +03:00
Halil Durak
350586335d add createImageData and putImageData to CanvasReneringContext2D 2026-02-19 12:09:23 +03:00
egrs
9d809499a5 fix input value defaults, color normalization, and event propagation resets
- checkbox/radio getValue() returns "on" when no value attribute set
- color input sanitization normalizes hex to lowercase per spec
- initial input value is sanitized per input type during element creation
- initEvent resets both stop_propagation and stop_immediate_propagation
- dispatchNode resets propagation flags after dispatch per DOM spec step 12
2026-02-19 09:53:13 +01:00
Pierre Tachoire
fdd52c17d7 add CSSStyleProperties array set support 2026-02-19 09:52:27 +01:00