Only include a leaf's own end padding in content_size for scroll containers - #1117
Merged
Conversation
…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.
🤖 Devin AI EngineerI'll be helping with this pull request! Here's what you should know: ✅ I will automatically:
Note: I can only respond to comments from users who have write access to this repository. ⚙️ Control Options:
|
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.
Objective
Extend #1114 to leaf nodes:
compute_leaf_layoutpreviously setcontent_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 itscontent_sizewhen it is a scroll container, so an ordinary padded leaf whose measured content overflows (e.g. clamped bymax-size) over-reported its content size by the end padding.compute_leaf_layoutnow computes: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_layouton the old unconditional behaviour. Adds leaf regression tests alongside the existing ones intests/hand_written/scroll_size.rsand a changelog entry.Link to Devin session: https://dioxus.staging.devinenterprise.com/sessions/cc8042ea8adf46a2a8d8e3431d560ae8
Requested by: @nicoburns