fix(components): resolve default sizes against the node font-size - #263
Merged
LeadcodeDev merged 1 commit intoSep 22, 2026
Merged
Conversation
53 tasks
LeadcodeDev
force-pushed
the
fix/default-size-font-context
branch
2 times, most recently
from
September 22, 2026 08:36
f08bbe7 to
2351a9f
Compare
font_size_px_or goes through Length::px() → px_or_warn, which returns 0.0 for any relative unit; style.rs:1601 asserts this explicitly (assert_eq!(s.font_size_px_or(48.0), 0.0) for "15.6vw"). Five live call sites remain in apply_intrinsic_overrides — List (1498), Callout (1643), Tooltip (1663), PillNav (1688), Marquee (1716) — while every corresponding painter was migrated to the context-aware resolver in the "lot B, wave S" pass (marquee.rs:82 self.style.font_size_px_ctx(&crate::intrinsic::font_size_ctx(...), self.font_size), list.rs:88 the same). So a marquee with "font-size": "2rem" and no explicit style.height gets apply_default_size(css, 800.0, 0.0) → the (false,false) branch writes css.height = Px(0.0) → the node is skipped at paint time and the marquee is invisible; list (1498-1503) collapses to height 0 the same way; callout/tooltip/pill_nav get boxes measured at font- size 0 while the painter draws at the real size, so the ink overflows its own box. intrinsic.rs:27-46 states this wave's goal was to replace font_size_px_or at every site; box_builder was missed, and it is also the one file that does not use the module's own measure_time_font_size_ctx helper (intrinsic.rs:87). Fix: Replace the five font_size_px_or(...) calls in apply_intrinsic_overrides with font_size_px_ctx(&crate::intrinsic::measure_time_font_size_ctx(0.0), ...), the same helper every *Intrinsic in intrinsic.rs already uses. Add a regression test asserting a marquee/list with "font-size": "2rem" and no explicit height lays out with positive height. Refs #220
LeadcodeDev
force-pushed
the
fix/default-size-font-context
branch
from
September 22, 2026 08:46
2351a9f to
067ad3a
Compare
LeadcodeDev
added a commit
that referenced
this pull request
Sep 22, 2026
font_size_px_or goes through Length::px() → px_or_warn, which returns 0.0 for any relative unit; style.rs:1601 asserts this explicitly (assert_eq!(s.font_size_px_or(48.0), 0.0) for "15.6vw"). Five live call sites remain in apply_intrinsic_overrides — List (1498), Callout (1643), Tooltip (1663), PillNav (1688), Marquee (1716) — while every corresponding painter was migrated to the context-aware resolver in the "lot B, wave S" pass (marquee.rs:82 self.style.font_size_px_ctx(&crate::intrinsic::font_size_ctx(...), self.font_size), list.rs:88 the same). So a marquee with "font-size": "2rem" and no explicit style.height gets apply_default_size(css, 800.0, 0.0) → the (false,false) branch writes css.height = Px(0.0) → the node is skipped at paint time and the marquee is invisible; list (1498-1503) collapses to height 0 the same way; callout/tooltip/pill_nav get boxes measured at font- size 0 while the painter draws at the real size, so the ink overflows its own box. intrinsic.rs:27-46 states this wave's goal was to replace font_size_px_or at every site; box_builder was missed, and it is also the one file that does not use the module's own measure_time_font_size_ctx helper (intrinsic.rs:87). Fix: Replace the five font_size_px_or(...) calls in apply_intrinsic_overrides with font_size_px_ctx(&crate::intrinsic::measure_time_font_size_ctx(0.0), ...), the same helper every *Intrinsic in intrinsic.rs already uses. Add a regression test asserting a marquee/list with "font-size": "2rem" and no explicit height lays out with positive height. Refs #220
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Severity Medium, category correctness. Location:
crates/rustmotion-components/src/box_builder.rs:1716Impact
font_size_px_orgoes throughLength::px()→px_or_warn, which returns0.0for any relative unit; style.rs:1601 asserts this explicitly (assert_eq!(s.font_size_px_or(48.0), 0.0)for"15.6vw"). Five live call sites remain inapply_intrinsic_overrides— List (1498), Callout (1643), Tooltip (1663), PillNav (1688), Marquee (1716) — while every corresponding painter was migrated to the context-aware resolver in the "lot B, wave S" pass (marquee.rs:82self.style.font_size_px_ctx(&crate::intrinsic::font_size_ctx(...), self.font_size), list.rs:88 the same). So amarqueewith"font-size": "2rem"and no explicitstyle.heightgetsapply_default_size(css, 800.0, 0.0)→ the(false,false)branch writescss.height = Px(0.0)→ the node is skipped at paint time and the marquee is invisible;list(1498-1503) collapses to height 0 the same way; callout/tooltip/pill_nav get boxes measured at font-size 0 while the painter draws at the real size, so the ink overflows its own box. intrinsic.rs:27-46 states this wave's goal was to replacefont_size_px_orat every site; box_builder was missed, and it is also the one file that does not use the module's ownmeasure_time_font_size_ctxhelper (intrinsic.rs:87).Fix
Replace the five
font_size_px_or(...)calls inapply_intrinsic_overrideswithfont_size_px_ctx(&crate::intrinsic::measure_time_font_size_ctx(0.0), ...), the same helper every*Intrinsicin intrinsic.rs already uses. Add a regression test asserting amarquee/listwith"font-size": "2rem"and no explicit height lays out with positive height.Evidence the audit read
Part of the September 2026 audit remediation chantier. Refs #220 (RM-06).