Skip to content

LibWeb: Reuse block-independent intrinsic widths - #11210

Merged
awesomekling merged 1 commit into
LadybirdBrowser:masterfrom
awesomekling:sp3-inline
Aug 19, 2026
Merged

LibWeb: Reuse block-independent intrinsic widths#11210
awesomekling merged 1 commit into
LadybirdBrowser:masterfrom
awesomekling:sp3-inline

Conversation

@awesomekling

Copy link
Copy Markdown
Member

Canonicalize intrinsic inline-size cache keys across assigned block sizes when a horizontal subtree has no cross-axis dependency. Preserve separate entries for orthogonal flows, aspect-ratio transfers, and wrapping column flex containers.

Cache the subtree dependency under the existing intrinsic-size epoch so mutations invalidate it without repeated scans. This avoids thousands of repeated measurement layouts in text-heavy flex content.

Benchmark     Old Score     New Score       Score Improvement  Old Total Time (ms)    New Total Time (ms)      Speedup
------------  ------------  ------------  -------------------  ---------------------  ---------------------  ---------
Speedometer2  77.25 ± 0.57  76.69 ± 0.83                0.993  6.42 ± 0.58            6.43 ± 0.63                0.998
Speedometer3  4.29 ± 0.75   4.38 ± 0.46                 1.021  6.26 ± 1.52            6.07 ± 0.41                1.032
StyleBench    61.69 ± 3.58  61.84 ± 5.18                1.002  4.13 ± 0.28            4.12 ± 0.31                1.003

Canonicalize intrinsic inline-size cache keys across assigned block
sizes when a horizontal subtree has no cross-axis dependency. Preserve
separate entries for orthogonal flows, aspect-ratio transfers, and
wrapping column flex containers.

Cache the subtree dependency under the existing intrinsic-size epoch so
mutations invalidate it without repeated scans. This avoids thousands
of repeated measurement layouts in text-heavy flex content.

Cover a column flex item whose intrinsic width changes after its parent
resolves the item's block size.
@coderabbitai

coderabbitai Bot commented Aug 19, 2026

Copy link
Copy Markdown

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro Plus

Run ID: 6a621450-80ef-418b-97ea-0850f2e73d2f

📥 Commits

Reviewing files that changed from the base of the PR and between d84b1ff and f1fb04c.

📒 Files selected for processing (4)
  • Libraries/LibWeb/Rust/src/layout/layout_node_arena.rs
  • Libraries/LibWeb/Rust/src/layout/sizing_context.rs
  • Tests/LibWeb/Text/expected/Layout/wrapping-column-flex-intrinsic-width.txt
  • Tests/LibWeb/Text/input/Layout/wrapping-column-flex-intrinsic-width.html

Included review availability: Your plan provides up to 10 included reviews per hour; 9 remain after this review.


📝 Walkthrough

Walkthrough

The layout node arena now caches whether inline size depends on block size. The cache uses node generation and intrinsic cache epoch validation. SizingContext detects cross-axis dependencies and conditionally includes block size in min-content, paired max-content, and intrinsic measurement cache keys. A new wrapping column flex layout test verifies an intrinsic width of 90.

Sequence Diagram(s)

sequenceDiagram
  participant LayoutTest
  participant SizingContext
  participant LayoutNodeArena
  participant IntrinsicCache
  LayoutTest->>SizingContext: request intrinsic inline measurement
  SizingContext->>LayoutNodeArena: determine block-size dependency
  LayoutNodeArena->>IntrinsicCache: read or compute dependency fact
  IntrinsicCache-->>LayoutNodeArena: dependency result
  LayoutNodeArena-->>SizingContext: normalized cache key
  SizingContext->>IntrinsicCache: lookup or create measurement
  IntrinsicCache-->>LayoutTest: computed intrinsic width
Loading

Possibly related PRs

Suggested reviewers: kalenikaliaksandr

Merge Risk: ⚪ Minimal · up to f1fb0

The change is merge-ready after normal checks and review; no actionable merge-blocking risk remains.

🚥 Pre-merge checks | ✅ 3
✅ Passed checks (3 passed)
Check name Status Explanation
Description check ✅ Passed The description accurately covers intrinsic inline-size cache-key canonicalization, dependency caching, invalidation, preserved dependency cases, and regression coverage.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@awesomekling
awesomekling merged commit 75fcdc0 into LadybirdBrowser:master Aug 19, 2026
15 checks passed
@awesomekling
awesomekling deleted the sp3-inline branch August 19, 2026 11:52
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant