Commit Graph
80 Commits
Author SHA1 Message Date
ldm0 830dbac358 fix(dom): compare foreign node trees in their own arenas 2026-11-01 18:27:24 +08:00
ldm0 15812c1d21 feat(dom): retain delivered meta referrer policy on each Document
Retain valid delivered meta referrer policies on their native owner Document. Preserve delivery ordering and independent cloned Document state.

Validation (32 build jobs / test threads, zero retries):

- `cargo fmt --all`
- `cargo clippy --workspace --all-targets --all-features -- -D warnings`
- `cargo nextest run --no-fail-fast`: Summary [ 133.798s] 21996 tests run: 21996 passed (9 slow), 19 skipped
2026-10-31 18:55:48 +08:00
ldm0 31e00c3feb fix(dom): record same-value namespace attribute writes
Queue observer records for every same-value attribute write, including setAttributeNS and dataset. Keep meta declaration processing independent so it does not queue a duplicate record.
2026-10-29 15:39:43 +08:00
ldm0 8cdb89fc14 fix(html): use actual attribute identities for meta refresh
Report the matched Attr local name and namespace from ordinary and namespace-aware writes, then match refresh attributes exactly. Cover unrelated uppercase/namespaced mutations and ordinary HTML case folding in both main and child Documents.
2026-10-29 15:39:43 +08:00
ldm0 7f08c25f08 fix(dom): preserve template document identity and adoption lifecycles
Share a lazy inert owner across each document's template contents and keep
HTML/XML semantics, interface identity, and template-owner state separate.
Cloning preserves interfaces while creating independent owner state.

Separate portable Document metadata from arena-local relationships. Use
one metadata-copy boundary for Document cloning and main-document
replacement, clearing template-owner and CSS-target handles while keeping
whole-DOM snapshots and copy-on-write storage relationships intact. Metadata
copies also discard base-element href/target caches while retaining about
base URLs and explicit overrides; only DOM node cloning freezes computed
base URLs. Detached Document URL readers use native metadata without JS
URL/documentURI/baseURI shadow state, including selector and bridge readers.

Apply the DOM-specific document cloning rules separately: freeze the source
computed base URL as an override, separately retain the inherited about
base URL, and rebuild base-element caches from the cloned tree. Preserve
main-document replacement metadata semantics.

Establish exact HTML template identity and associated fragment allocation
in one native entry shared by DOM and parser creation. Clone actual native
contents rather than guessing from names, preserving foreign and mixed-case
elements through serialization, deep cloning, import and adoption. Keep HTML
createElement normalization at its binding boundary; namespace-aware creation
and wrapper selection preserve the exact local name, including registry paths.

Plan per-node adoption targets across ordinary children, shadow roots and
template contents. Retarget custom-element registries and callbacks with
the actual destination documents, and clear cross-document shadow sheets
while retaining sheets within a document and its own template owner.
Avoid preparing unused inert style sources.

Cover cross-arena ID collisions, metadata preservation, snapshot isolation,
nested templates, deep adoption, iframe/detached documents, cloned
interfaces, retained sheet arrays, registry associations and URL behavior.
2026-10-29 02:54:08 +08:00
ldm0 5ea0c64479 fix(dom): expose inert template documents through Document
Track the inert template-document role separately from HTML/XML semantics.
Choose the Document wrapper for that role while preserving the source kind
for HTML name normalization and XML element creation.

Cover parser/createElement/innerHTML paths in main and child documents,
DOMParser and createHTMLDocument sources, and XHTML contents. Ordinary
Document interfaces retain their existing identity.

Validation: cargo fmt --all; strict workspace/all-targets/all-features
Clippy; 86 template-related tests across three stress iterations; full
Nextest 21,167 passed, 19 skipped, without retries.
2026-10-28 15:07:56 +08:00
ldm0 93aa0dba93 fix(dom): retain lossless DocumentType strings in native copies
Extracted from wpt-misc-fix (4ecc927d5c).

Validation: cargo fmt --all; cargo clippy --workspace --all-targets --all-features -- -D warnings; cargo nextest run --no-fail-fast (32 build jobs / test threads).
Summary [ 130.006s] 20886 tests run: 20886 passed (9 slow), 19 skipped
2026-10-26 18:02:49 +08:00
ldm0 b2fc3dd65c fix(html): preserve child meta refresh with shared scheduling
Process parser and script-created refresh declarations in order and retain them
on their owning Document across load callbacks and adoption. Share candidate
priority and deadline state between main and child documents, and arm child
timers after owner load completes.

Consume queued work by exact Document identity and revision, classify navigation
when it fires, and keep the registered target URL. Reprocess same-value meta
attributes using the matched Attr identity so XML case, namespaces, observer
records, and refresh deadlines remain correct.

Cover competing declarations, stale tasks, independent frames, load/adoption
boundaries, sandbox/shadow handling, saved targets, and fragment navigation.
2026-10-26 03:17:22 +08:00
ldm0 4b6a02470c fix(dom): preserve native Element identities when copying between documents 2026-10-25 03:40:03 +08:00
ldm0 29393a6cfb fix(dom): retain encodings in native Document state 2026-10-21 16:41:12 +08:00
ldm0 4ee081b81b fix(dom): retain default mute state until an explicit preference 2026-10-18 05:18:47 +08:00
ldm0 e0df01a2cd fix(dom): retarget adopted shadow trees before reinsertion
Retarget ShadowRoot ownership and descendants along with the adopted host,
and collect stylesheet owners from nested shadow trees. Cover closed and
nested roots, inactive documents, and deep iterative adoption.
2026-10-17 20:09:30 +08:00
ldm0 5be5f7c50d feat(pdf): preserve clickable links and internal destinations 2026-10-13 00:34:09 +08:00
ldm0 68408732cb fix(input): align mouse click targeting with Chromium
Keep press and current mouse targets in host-owned state so synchronous
DOM removals invalidate or retarget them before click dispatch. Resolve
click and auxclick targets through the flat tree, preserve captured click
targets, and dispatch mouseup before lostpointercapture.

Cover sibling targets, Shadow DOM, slots, removal and reinsertion, and
pointer capture with deterministic input regressions.
2026-10-12 18:58:56 +08:00
ldm0 e3538c8999 fix(stylesheets): honor quirks mode MIME compatibility 2026-10-12 17:17:55 +08:00
ldm0 b1d06cde76 fix(domparser): retain HTML document parse modes 2026-10-12 17:08:29 +08:00
ldm0 6e70b3f1cf perf(accessibility): keep uncommon AX fields out of line
Group ignored reasons, values and nonempty properties behind one optional box. Use nonzero backend IDs and serialize fixed role/name kinds on demand, reducing the common AX node from 296 to 96 bytes while preserving payload shape and field order.

Add reproducible CLI and native construction benchmarks. Generated 40000-row text dumps use 382.6 to 341.5 MiB peak RSS; 200000-row text dumps use 1753.5 to 1612.8 MiB. Record the roughly 5.5 percent native construction cost for dense ignored nodes alongside the memory gains.

Validation: cargo fmt --all; workspace clippy with all targets/features and warnings denied; cargo nextest run --no-fail-fast (19890 passed, 17 skipped). All 188 formal benchmark samples match their corresponding before/after outputs.
2026-10-11 17:37:40 +08:00
ldm0 1404fa344b perf(accessibility): avoid JSON intermediates in semantic dumps
Large semantic dumps retain a JSON object graph with allocated field names
and string node references for every AX node before formatting the output.

Build compact typed nodes with numeric references and pass them directly
from the renderer to the CLI. Keep one AX traversal for both typed nodes
and CDP payloads, converting protocol nodes individually as they are built.
Preserve omitted/empty fields, field insertion order, list markers, and
frame-root attachment order. Render text iteratively and trim in place.

Add compatibility coverage and a standalone benchmark that stages both
executables on the same filesystem, alternates runs, records peak RSS and
wall time, and rejects changes to dump output bytes.

Against main at 5f5e1fff3 on a generated 40,000-row list (three interleaved
runs, medians):
- semantic_tree_text: 718.42 -> 390.96 MiB; 2.919 -> 2.204 s.
- semantic_tree: 815.71 -> 483.81 MiB; 2.484 -> 2.369 s.
- markdown control: 95.52 -> 95.59 MiB; 0.895 -> 0.913 s.

A generated 200,000-row list also completes with identical bytes (one run):
- semantic_tree_text: 3473.02 -> 1775.07 MiB; 13.245 -> 10.015 s.
- semantic_tree: 3803.45 -> 2137.26 MiB; 12.626 -> 10.397 s.

JSON/text comparisons also match the baseline on a mixed fixture containing
hidden/ignored nodes, form values, list markers, shadow DOM, and child frames.
These generated fixtures are independent of the external MOL-269 evidence.

Validation:
- cargo fmt --all
- cargo clippy --workspace --all-targets --all-features -- -D warnings
- cargo nextest run --no-fail-fast (19,885 passed, 17 skipped)
- cargo build --release -p moli

Refs: MOL-269
2026-10-11 17:37:40 +08:00
ldm0 fd2ed360cc fix(accessibility): preserve NBSP in accessible names 2026-10-11 17:34:34 +08:00
ldm0 9b726d5821 fix(accessibility): use descendant text alternatives in control names 2026-10-11 01:35:41 +08:00
ldm0 b4aa3aaea6 feat(forms): distinguish button Auto state in the core 2026-10-10 18:36:22 +08:00
ldm0 f9fd34422a feat(dom): add lossless native DOM string values
Add the native DOMString value representation that preserves unpaired UTF-16 code units and exposes a scalar projection for native consumers. Equality and hashing retain original units; parser scalar appends preserve allocation capacity. Unit coverage includes surrogate identity and append boundaries. This PR provides the native value API; migrating all DOM producers is separate work.
2026-10-10 18:30:37 +08:00
ldm0 ae20434893 perf(accessibility): build request projections on demand 2026-10-10 11:53:21 +08:00
ldm0 4997e6d0d3 fix(accessibility): project computed visibility and composed names 2026-10-10 11:53:21 +08:00
ldm0 37e8bf746c fix(accessibility): include shadow controls in AX snapshots 2026-10-10 11:53:21 +08:00
ldm0 111afae3bb feat(svg): expose native value and element interfaces
Completes native SVG value and element interface exposure in one independently mergeable PR against main, refreshing the former SVG constructor PR. Animated scalar values, angles, preserve-aspect-ratio values and live point/string/number/length/transform lists provide the shared native DOM foundation for the added elements.

Adds the remaining component-transfer, flood, image, merge, merge-node and tile filter interfaces; SVGSwitchElement and SVGMPathElement; and the animation, animate, set, animate-motion and animate-transform interfaces. Native factories, inheritance, SVGTests lists, attribute reflection, receiver validation and animation event handlers use native objects and the existing DOM backend.

Tests cover main/iframe realms, live and windowless documents, native identity, value/list mutation, units, Trusted Types, animation target resolution, handlers and timing argument validation. All internal SVG dependencies are included here, with no external PR merge order.

Filter raster rendering and SMIL scheduling remain unimplemented. Timing controls reject NotSupportedError, getStartTime reports no interval, and getCurrentTime remains zero. The separate SVG path parser changes and animated-string UTF-16 storage migration are excluded. The retained length synchronization is included; a separate ignored regression records the lone-surrogate limitation in the current DOM attribute storage.

SVG event-handler properties reuse main's existing shared event backend. Tests verify replacement, clearing, canonical event types, cancellation and realm/receiver identity; complete handler/listener registration-order semantics remain part of the separate event-handler backend migration.
2026-10-09 14:54:14 +08:00
ldm0 8bb9c18f22 fix(forms): finalize clean input values after parser attributes 2026-10-07 14:11:22 +08:00
ldm0 30e36e64a3 fix(cdp): preserve auxiliary Page ownership through document navigation
Create script auxiliary Pages synchronously and let their CDP targets adopt
those exact Pages. Preserve Page and WindowProxy identity through document
navigation, sharing browsing-context names, opener references, message endpoints
and close state with related windows.

Commit browser responses into the existing Page with exact document admission,
cancellation and failure disposition. Capture accepted navigation origin, base,
policy, storage and referrer, preserve auxiliary history and restore related
browsing-context groups without issuing duplicate popup requests.

Reuse the initial same-origin Window while replacing its Document, and centralize
Document owner transitions, descendant retirement and Inspector publication.
Give related Pages independent Inspector routes and shared per-Page startup
pause state, route isolate foreground work through surviving Pages, and cache
cross-origin Window functions in each accessing realm with receiver-aware access.

Cover actual popup state, navigation and parser rebinding, accepted environments,
history, cross-origin access, multiple frontends, cancellation and task retirement.

Validation: cargo fmt --all; cargo clippy --workspace --all-targets --all-features -- -D warnings; cargo nextest run --no-fail-fast.
2026-10-06 01:01:03 +08:00
ldm0 19667e531a perf(dom): better inline script performance 2026-10-05 20:48:11 +08:00
ldm0 ca0a4c81a2 feat(webmcp): add native form schemas, fill intents, and activity states
Introduce moli-webmcp for native form schema synthesis, complete input validation,
numeric conversion, and JSON-LD results. Preserve requested selection values in
fill intents so the renderer can apply them to current controls after author
input events.

Add native tool activity states, selector support, control helpers, and
a namespace-aware form index that includes open and closed shadow trees.
Pin the Stylo revision providing the activity pseudo-classes.

Validation on this commit tree: cargo fmt --all;
cargo clippy --workspace --all-targets --all-features -- -D warnings;
cargo nextest run --no-fail-fast.
Summary [  98.804s] 19248 tests run: 19248 passed, 16 skipped
2026-10-05 15:25:06 +08:00
ldm0 bc116c16dc fix(dom): match class-name collections using document quirks mode 2026-10-03 17:40:52 +08:00
ldm0 0a6a6e3fa0 fix(dom): mask AX password values per UTF-16 code unit
Count UTF-16 code units when masking password values to match Chromium.
Cover initial and live values across ASCII, BMP, supplementary characters,
combining sequences, ZWJ emoji, and empty passwords, verified against
Chromium 145 in 14 cases.
2026-10-03 13:35:10 +08:00
Maxim M 8c3cc22e87 fix(dom): expose password inputs as textbox with a masked AX value
Fixes #1082.
2026-10-03 13:35:10 +08:00
ldm0 4b71c1628a feat(svg): expose native switch and mpath interface objects 2026-10-03 04:04:27 +08:00
ldm0 0b7081a51a feat(svg): expose native animation element interface objects 2026-10-03 03:00:13 +08:00
ldm0 90ffad4035 feat(svg): expose remaining filter element interfaces 2026-10-03 02:58:43 +08:00
ldm0 bda82c8123 fix(forms): wrap textarea submission values 2026-10-02 02:22:02 +08:00
ldm0 9a81b5695f fix(forms): honor range input constraints 2026-10-02 02:13:13 +08:00
ldm0 2b5657d6e6 perf(dom): bound indexed queries by the subtree size 2026-09-30 17:32:09 +08:00
ldm0 0f7fddbeb2 fix(dom): retain inherited base URLs across history updates 2026-09-30 10:53:38 +08:00
ldm0 daf6edd4e3 fix(dom): preserve fragment insertion mutation boundaries 2026-09-30 10:37:18 +08:00
ldm0 c12e9f8416 perf(forms): resolve named items from indexed candidates 2026-09-29 15:23:17 +08:00
lanyue-llk 468729e7de fix(forms): preserve live and detached named property semantics 2026-09-29 07:54:26 +08:00
ldm0 981f9b15dd fix(dom): share host-including ancestry checks 2026-09-28 17:43:20 +08:00
ldm0 fa1bf1d3be fix(selection): validate range membership with native DOM ownership 2026-09-28 10:22:57 +08:00
ldm0 0d3d81829c fix(selectors): honor native document design mode 2026-09-27 18:38:08 +08:00
ldm0 c2c5ce0da0 fix(forms): sanitize multiple and IDN email values 2026-09-27 05:50:50 +08:00
ldm0 511c8a2341 refactor(parser): centralize element construction lifecycles
Separate parser provenance from active child construction. Share one
construction session across HTML/XML parsers and runtime adapters, with
completion ownership, normal-EOF checks, and cancellation that does not
publish incomplete styles.

Use ordinary creation for generated document shells and remove obsolete
per-element completion forwarding. Cover parser ownership, adoption,
duplicate completion, missing callbacks, and cancellation in tests.
2026-09-26 07:01:12 +08:00
ldm0 83e0afd1a1 fix(css): avoid reparsing incomplete inline styles
Process parser-created style sources after their closing tag or EOF, and
prepare later source changes through the stylesheet owner lifecycle.
Keep synchronization and CSSOM reads on prepared sources so CSSOM edits
survive reads and document initialization.

Complete styles in inert XML parsing and build the XML viewer through
ordinary DOM creation. Cover streaming, EOF, child documents, fragments,
and XML stylesheet behavior in regression tests.
2026-09-26 07:01:12 +08:00
Donough Liu 747559e0a1 fix(dom): synchronize element reflection targets (#764) 2026-09-23 04:44:00 +08:00