Skip to content

Only include a leaf's own end padding in content_size for scroll containers - #1117

Merged
nicoburns merged 1 commit into
mainfrom
devin/1786966849-leaf-content-size
Aug 17, 2026
Merged

Only include a leaf's own end padding in content_size for scroll containers#1117
nicoburns merged 1 commit into
mainfrom
devin/1786966849-leaf-content-size

Conversation

@nicoburns

Copy link
Copy Markdown
Member

Objective

Extend #1114 to leaf nodes: compute_leaf_layout previously set content_size = measured_size + padding.sum_axes(), unconditionally including both start and end padding. Block, flexbox and grid only include a container's own end-side padding in its content_size when it is a scroll container, so an ordinary padded leaf whose measured content overflows (e.g. clamped by max-size) over-reported its content size by the end padding.

compute_leaf_layout now computes:

content_size = Size {
    width: start_padding + measured_size.width + if is_scroll_container { end_padding } else { 0.0 },
    height: padding.top + measured_size.height + if is_scroll_container { padding.bottom } else { 0.0 },
}

where start/end padding follow the direction (left/right for LTR, right/left for RTL), matching the block/flexbox/grid convention exactly.

Context

Follow-up to #1114, which applied this convention to block/flexbox/grid but left compute_leaf_layout on the old unconditional behaviour. Adds leaf regression tests alongside the existing ones in tests/hand_written/scroll_size.rs and a changelog entry.

Link to Devin session: https://dioxus.staging.devinenterprise.com/sessions/cc8042ea8adf46a2a8d8e3431d560ae8
Requested by: @nicoburns

…ainers

Match the convention used by block, flexbox and grid layout:
compute_leaf_layout now only adds the node's end-side padding (right for
LTR, left for RTL, and bottom) to its content_size when the node is a
scroll container. Boxes that are not scroll containers do not extend
their scrollable overflow region by their own padding.
@staging-devin-ai-integration

Copy link
Copy Markdown

🤖 Devin AI Engineer

I'll be helping with this pull request! Here's what you should know:

✅ I will automatically:

  • Address comments on this PR that start with 'DevinAI' or '@devin'.
  • Look at CI failures and help fix them

Note: I can only respond to comments from users who have write access to this repository.

⚙️ Control Options:

  • Disable automatic comment, CI, and merge conflict monitoring

@nicoburns
nicoburns merged commit f30c49d into main Aug 17, 2026
28 checks passed
@nicoburns
nicoburns deleted the devin/1786966849-leaf-content-size branch August 17, 2026 13:04
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