Commit Graph
216 Commits
Author SHA1 Message Date
ldm0 751bece923 fix(print): skip background-only image requests when backgrounds are disabled
Apply capture background policy before dispatching newly discovered CSS images. Preserve any mask use of the same URL.
2026-11-23 04:12:58 +08:00
ldm0 28632bb4b1 fix(fonts): validate WOFF1 table lengths before decoding
Extract the WOFF1 table-length validation from print font preparation in 95012a2d4d (#1753) to the shared web font decoder. Reject inconsistent stored and reconstructed lengths with the usual decode error.
2026-11-23 02:49:13 +08:00
ldm0 b0c702db06 perf(layout): allocate inline formatting state only for owners
Extract the pass-local storage part of f44a31ff42 from #1753. Allocate an inline formatting context only when a box owns one.

The native release benchmark matched geometry across 135 pairs. CPU time fell in 14 of 15 scenarios, including 8.14% for 4,096 text-free block elements.
2026-11-23 02:26:18 +08:00
ldm0 a890611161 fix(layout): project ResizeObserver padding and device pixels 2026-11-23 00:12:56 +08:00
ldm0 8ff9ff8479 fix(layout): reuse loaded CSS-connected font sources across declarations 2026-11-22 23:28:20 +08:00
ldm0 e1da2765ba refactor(layout): share authored cell inline constraints
Use one first-row slice and parse cell width inputs in one place.
Resolve width limits before borrowing the world for intrinsic layout.
2026-11-22 23:00:39 +08:00
ldm0 de2fad4a0f refactor(layout): place cells by contiguous row group
Derive absolute row positions and the span limit from the same row
groups used for collapsed borders.
2026-11-22 23:00:39 +08:00
ldm0 d49e3affa6 perf(layout): share contiguous column group ranges
Walk each run of column tracks for collapsed borders and geometry.
Project span-only groups once while preserving their authored widths.
2026-11-22 23:00:39 +08:00
ldm0 76eac8bcbe perf(layout): share table structure within each layout pass
Collect cell placement, spans and visual section order once for
collapsed borders, fixed sizing and numerical layout. Keep styles and
measured geometry local to each caller.
2026-11-22 23:00:39 +08:00
ldm0 585b475f00 perf(layout): build anonymous table wrappers in batches
Collect contiguous runs under each anonymous table wrapper and attach
them once. Normalize the contents of an anonymous cell together so
consecutive inline content shares its formatting context.
2026-11-22 23:00:39 +08:00
ldm0 786eecbe32 perf(layout): build numeric table edges directly
Keep the CSS box hierarchy and route table parts to the numerical
owner during layout graph construction. Preserve the adapter's
ordering and run fixed and collapsed preparation only when needed.
2026-11-22 23:00:39 +08:00
ldm0 6f4b776ba9 chore(layout): trace pass-local numeric cache allocations 2026-11-22 06:10:45 +08:00
ldm0 d3e8d3af15 feat(renderer): advance realtime rendering without capture
Drive animation frames, resize and intersection observers, environment changes, scroll events, and font completion through the page owner. Expose the realtime policy in fetch and serve. Dispatch wheel input through the existing action window and keep transient output separate from screen publication.
2026-11-22 03:15:08 +08:00
ldm0 fafd241458 feat(layout): keep realtime screen geometry current
Use the shared one-shot layout pass when geometry, a used CSS value, or coordinate input needs a current screen sample. Track the source and document identity of the published geometry and give screen passes explicit iframe coverage.

Extracted from the Realtime series at 6acae0b9b5.
2026-11-22 03:15:08 +08:00
ldm0 0553725777 fix(devtools,layout): share marker generation rules 2026-11-20 13:54:19 +08:00
ldm0 9fd58e5cb8 perf(layout): reuse a document style resolution pass 2026-11-20 04:20:46 +08:00
ldm0 14274ee14a build: update Rust toolchain to 1.100.0
Use matching Bookworm images for CI and release builds. Address the compiler deprecations and Clippy diagnostics introduced by Rust 1.100.0.
2026-11-19 05:56:01 +08:00
ldm0 690cea9e44 fix(layout): freeze SVG object geometry with its viewport 2026-11-13 17:32:47 +08:00
ldm0 54546adf32 fix(paint): align overflow clips with snapped box edges
Overflow clip geometry retained fractional layout offsets while its box
background used snapped paint geometry. Atomic flow grouping changed which
background and text commands shared a clip layer, exposing different edge
blending in three grid scrollbar reftests (240 pixels, max difference 17).

Snap owned overflow clips in the same pre-transform paint space as box
backgrounds. Preserve CSSOM geometry, property transforms and clip-chain
reuse. Cover block and grid containers with fractional offsets and sizes.
2026-11-13 03:28:46 +08:00
lanyue-llk 8c64bf14ab fix(layout): return border-box content quads 2026-11-13 01:25:08 +08:00
ldm0 0116a9864a test(layout): cover nested positioning and frozen projection contracts 2026-11-12 20:35:12 +08:00
ldm0 7142220841 fix(layout): resolve sticky scroll-space dependencies explicitly 2026-11-12 20:35:12 +08:00
ldm0 a571d4f05b refactor(layout): separate placement rules and space composition 2026-11-12 20:35:12 +08:00
ldm0 0c1b66e048 fix(layout): account for scroll offsets in sticky positioning 2026-11-12 20:35:12 +08:00
ldm0 0a0d0f0d11 refactor(paint): remove rendering work budgets 2026-11-12 20:24:33 +08:00
ldm0 69602b1c63 fix(layout): paint glyphless inline selection ranges 2026-11-12 16:02:40 +08:00
ldm0 cbf4d0149f fix(layout): paint mixed inline carets without glyph runs 2026-11-12 04:42:48 +08:00
ldm0 40ace558e3 fix(layout): retain atomic paint stages and inline interleaving 2026-11-12 04:42:48 +08:00
ldm0 077025be8b fix(layout): share atomic inline paint and hit-test ordering 2026-11-12 04:42:48 +08:00
Eren Küçüker d19796b5d7 fix(layout): paint atomic inlines above their wrapping inline boxes
An in-flow atomic inline painted its background in the block background
phase, before the backgrounds of the inline boxes that wrap it. A wrapping
span's background covered the box, and because hit testing shares the paint
order, points inside the box resolved to the span.

Paint the atomic background inside its formatting context, after the inline
box backgrounds and before the line's text. The owner's text becomes its own
paint event so it can follow them.

Fixes #385
2026-11-12 02:17:28 +08:00
ldm0 13a216cf25 refactor(layout): share table roles and display classification
Table construction and invariant validation maintain duplicate role enums, display mappings and diagnostic names. Use one internal role type and classification while keeping construction-only parent requirements, world validation and invalid-box errors at their existing sites.
2026-11-09 22:11:24 +08:00
ldm0 f54c3fabb9 refactor(layout): reuse rectangle outset calculation
Paint culling repeats the rectangle expansion already owned by overflow geometry. Reuse that existing helper, preserving f32 evaluation order, edge subtraction and zero-clamping of the resulting dimensions.
2026-11-09 18:48:51 +08:00
ldm0 2db52b45ba fix(svg): resolve inherited relative font weights correctly 2026-11-03 11:55:43 +08:00
wslee 46f7e37989 test(svg): cover inherited italic and condensed faces 2026-11-03 11:55:43 +08:00
ldm0 5a4588fbd0 fix(fonts): skip discarded anonymous flex and grid text 2026-10-29 03:49:54 +08:00
ldm0 f5ad0f909f test(layout): verify optical sizing with variable glyph advances 2026-10-28 17:04:36 +08:00
Maxim M 80c7b8e197 fix(layout): apply font-optical-sizing auto as opsz
Chromium sets the opsz axis to the font size in CSS pixels for variable fonts
when font-optical-sizing is auto. moli left opsz at the font default, so
system-ui on macOS (SFNS.ttf, default opsz 28) was shaped with the Display
design and measured 372.41 px instead of 420.95 px for a 16 px sentence.
The family choice and the trak tracking were already right.

An explicit opsz in font-variation-settings still wins. Fonts without an opsz
axis ignore the value.
2026-10-28 17:04:36 +08:00
ldm0 25654131ad refactor(layout): share child box retention with font discovery 2026-10-28 05:55:19 +08:00
ldm0 0874186dc9 refactor(fonts): share completion handling and remove unused state 2026-10-28 05:55:19 +08:00
ldm0 6fdc19ce13 fix(fonts): load used fonts during resource processing
Discover font demand from computed styles without triggering layout.
Honor the FONT policy, recheck fallback demand before readiness, and
invalidate child-document scans for ancestor style and viewport changes.

Share rendered control labels, marker counters and text normalization,
including generated items, inline boundaries, leaf boxes and suppressed
contents. Cover Unicode subsets, readiness and zero layout passes.
2026-10-28 05:55:19 +08:00
ldm0 4fea7994ad fix(paint): align text stroke joins with Chromium
Use explicit miter joins and a shared miter limit of 4 for CPU and PDF
text strokes. Use the same conservative expansion for layout outsets
and native PDF clipping, including synthetic bold stroke widening.

Add deterministic triangle glyphs to cover pointed joins, bevel fallback,
and miter-only ink entering a PDF clip.
2026-10-26 19:26:49 +08:00
ldm0 9b4e94338e fix(layout): include text stroke in paint culling bounds 2026-10-26 19:26:49 +08:00
ldm0 9205de4fe4 fix(layout): preserve text stroke in background clip masks 2026-10-26 19:26:49 +08:00
local-draft 0982ba20c1 feat(paint): support -webkit-text-stroke and paint-order for glyph runs 2026-10-26 19:26:49 +08:00
ldm0 4487138ce7 fix(layout): derive hanging overflow and clip inline boxes 2026-10-25 04:14:30 +08:00
sicko7947 055be4b08f fix(layout): exclude hanging trailing spaces from scrollable overflow
A wrapped line whose trailing spaces hang past the content box made
scrollWidth exceed clientWidth, unlike Chromium. Keep the full line rect
for CSSOM line geometry and use a scrollable rect without the hanging
advance when aggregating inline scrollable overflow.
2026-10-25 04:14:30 +08:00
ldm0 d0c307301d refactor(fonts): name font selection priorities
Font selection stored priority as `(bool, usize)`, so callers had to infer the CSS/manual group and repeat fallback and tie-breaking rules.

Replace the tuple with `WebFontPriority { group, position }` and explicit `Stylesheet`/`Manual` groups. Use a shared order type, centralize registration fallback priorities, and reuse one candidate comparison key. Manual faces still outrank CSS-connected faces, later positions still win, and equal priorities retain the same slot tie-breaker.

Validation: cargo fmt --all; strict all-feature workspace Clippy;
cargo nextest run --no-fail-fast (20683 tests run: 20683 passed (9 slow), 19 skipped).
2026-10-24 06:19:21 +08:00
ldm0 a9e54b4a0a perf(fonts): batch membership retirement and update priorities in place
Clear and CSS manifest replacement rebuilt the physical font collection once per removed face; changing matching order also re-registered every font. Retire each Document membership change in one batch, rebuild at most once for actual removals, and update candidate priorities/caches in place for order or membership-only changes. Byte/descriptor replacements still rebuild to preserve other sources with identical Fontique attributes.

Validation: cargo fmt --all; strict all-feature workspace Clippy;
cargo nextest run --no-fail-fast (20683 tests run: 20683 passed (9 slow), 19 skipped).
2026-10-24 05:03:25 +08:00
ldm0 2593e76394 refactor(fonts): reuse native descriptors for font queries
FontFaceSet.check/load reconstructed matching data from five JS string slots for every face on every query. Read the same immutable native descriptor that constructors and successful setters publish to layout, cache its Chromium-compatible family key, and share computed capability ranges and Unicode coverage.

Validation: cargo fmt --all; strict all-feature workspace Clippy;
cargo nextest run --no-fail-fast (20680 tests run: 20680 passed (9 slow), 19 skipped).
2026-10-24 05:03:25 +08:00
ldm0 bf3c9d1093 fix(fonts): separate declaration identity from shared sources
Independent CSS FontFace wrappers shared mutable descriptors and a registration slot, while a permanent stylesheet flag made detached faces disappear after manual re-addition. Give each native rule and JS face a distinct registration identity, share only source loading/validated data, and track native CSS and FontFaceSet membership in each Document. Native CSS cleanup revokes only its own relation; descriptor changes affect only their owning face. Explicit native layout can map a newly inserted declaration to cached source bytes without mutating the authoritative registrations or borrowing another declaration's descriptor.

Validation: cargo fmt --all; strict all-feature workspace Clippy;
cargo nextest run --no-fail-fast (20680 tests run: 20680 passed (9 slow), 19 skipped).
2026-10-24 05:03:25 +08:00