fix(geometry): measure text overflow against the content box - #230
Merged
LeadcodeDev merged 1 commit intoSep 22, 2026
Merged
Conversation
LeadcodeDev
force-pushed
the
fix/validate-relative-paths
branch
from
September 21, 2026 23:39
95e7b59 to
1ac44d6
Compare
LeadcodeDev
force-pushed
the
fix/geometry-text-overflow-box
branch
from
September 21, 2026 23:39
25b96c4 to
b142b14
Compare
53 tasks
LeadcodeDev
force-pushed
the
fix/validate-relative-paths
branch
from
September 22, 2026 06:09
bef57d4 to
b62a1cc
Compare
LeadcodeDev
force-pushed
the
fix/geometry-text-overflow-box
branch
from
September 22, 2026 06:09
53cb999 to
da0db80
Compare
LeadcodeDev
force-pushed
the
fix/validate-relative-paths
branch
from
September 22, 2026 08:33
b62a1cc to
d585af3
Compare
LeadcodeDev
force-pushed
the
fix/geometry-text-overflow-box
branch
from
September 22, 2026 08:33
da0db80 to
82dafe2
Compare
LeadcodeDev
force-pushed
the
fix/validate-relative-paths
branch
from
September 22, 2026 08:43
d585af3 to
4984fbc
Compare
LeadcodeDev
force-pushed
the
fix/geometry-text-overflow-box
branch
from
September 22, 2026 08:43
82dafe2 to
931a445
Compare
LeadcodeDev
changed the base branch from
fix/validate-relative-paths
to
chantier/audit-2026-09
September 22, 2026 08:52
LeadcodeDev
force-pushed
the
fix/geometry-text-overflow-box
branch
from
September 22, 2026 08:58
931a445 to
aa62b65
Compare
`bbox` here is `raw_bbox = bbox_of(layout)` (geometry.rs:272, 376-383), i.e. `layout.width` — the BORDER box. But `LegacyPaintDispatcher::dispatch` (crates/rustmotion-components/src/legacy_dispatch.rs) hands every non-codeblock painter a synthetic `BoxLayout { width: cw, height: ch, border/padding: zero }` taken from `layout.content_box()` and translates the canvas to the content-box origin. So `Text::paint` wraps and draws inside `cw`, not `layout.width`. A `white-space: nowrap` text with `style.padding: "0 24px"` in a 300px box has `cw = 252`; a natural line width of 280px paints 28px past the box's right edge, yet `280 > 300` is false and nothing is reported. The sibling check `check_content_overflows_box` (geometry.rs:848) does this correctly via `layout.content_box()` — the two checks disagree about which box text lives in, and the flagship `unwrappable_text_overflow` is the one that is wrong. The gap equals `padding.left + padding.right + border.left + border.right`.
Refs #220
LeadcodeDev
force-pushed
the
fix/geometry-text-overflow-box
branch
from
September 22, 2026 09:04
aa62b65 to
a252cd5
Compare
LeadcodeDev
added a commit
that referenced
this pull request
Sep 22, 2026
`bbox` here is `raw_bbox = bbox_of(layout)` (geometry.rs:272, 376-383), i.e. `layout.width` — the BORDER box. But `LegacyPaintDispatcher::dispatch` (crates/rustmotion-components/src/legacy_dispatch.rs) hands every non-codeblock painter a synthetic `BoxLayout { width: cw, height: ch, border/padding: zero }` taken from `layout.content_box()` and translates the canvas to the content-box origin. So `Text::paint` wraps and draws inside `cw`, not `layout.width`. A `white-space: nowrap` text with `style.padding: "0 24px"` in a 300px box has `cw = 252`; a natural line width of 280px paints 28px past the box's right edge, yet `280 > 300` is false and nothing is reported. The sibling check `check_content_overflows_box` (geometry.rs:848) does this correctly via `layout.content_box()` — the two checks disagree about which box text lives in, and the flagship `unwrappable_text_overflow` is the one that is wrong. The gap equals `padding.left + padding.right + border.left + border.right`.
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 Low, category correctness. Location:
crates/rustmotion/src/cli/commands/geometry.rs:785Impact
bboxhere israw_bbox = bbox_of(layout)(geometry.rs:272, 376-383), i.e.layout.width— the BORDER box. ButLegacyPaintDispatcher::dispatch(crates/rustmotion-components/src/legacy_dispatch.rs) hands every non-codeblock painter a syntheticBoxLayout { width: cw, height: ch, border/padding: zero }taken fromlayout.content_box()and translates the canvas to the content-box origin. SoText::paintwraps and draws insidecw, notlayout.width. Awhite-space: nowraptext withstyle.padding: "0 24px"in a 300px box hascw = 252; a natural line width of 280px paints 28px past the box's right edge, yet280 > 300is false and nothing is reported. The sibling checkcheck_content_overflows_box(geometry.rs:848) does this correctly vialayout.content_box()— the two checks disagree about which box text lives in, and the flagshipunwrappable_text_overflowis the one that is wrong. The gap equalspadding.left + padding.right + border.left + border.right.Fix
In
walk/walk_anim, passlayout.content_box()'s(x, y, w, h)tocheck_unwrappable_textinstead ofraw_bbox, matchingcheck_content_overflows_box. Keepraw_bboxforcheck_viewport(which genuinely tests the border box against the frame).Evidence the audit read
Part of the September 2026 audit remediation chantier. Refs #220 (RM-31).