Only include a container's own end padding in content_size for scroll containers - #1114
Merged
nicoburns merged 2 commits intoAug 16, 2026
Conversation
… containers A box that is not a scroll container does not extend its scrollable overflow region by its own padding, so block, flexbox and grid layout now only add the container's end-side padding to its content size when the container is a scroll container. This matches browser behaviour and prevents ordinary padded boxes from propagating spurious overflow to ancestor scroll containers.
🤖 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:
|
nicoburns
deleted the
devin/1786922561-content-size-padding-scroll-containers-only
branch
August 16, 2026 23:39
This was referenced Aug 16, 2026
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
Fix ordinary (non-scroll-container) padded boxes propagating spuriously enlarged content sizes to ancestor scroll containers. In Blitz this manifested as a spurious ~34px horizontal scroll on https://csskit.rs at a 1200px viewport: the page's
footer(a padded block whose child<p>has negative horizontal margins pulling it into the padding) reportedcontent_size.width = 1234, which propagated up to the root and made the document horizontally scrollable.Per CSS Overflow, a scroll container's own end-side padding is part of its scrollable overflow region, but a box that is not a scroll container does not extend its overflow region by its own padding. Browsers behave this way: content overflowing into (or past) a non-scroll-container's padding does not enlarge the scrollable overflow contributed to ancestors.
The block, flexbox and grid algorithms now only add the container's own end-side padding (right for LTR, left for RTL, plus bottom) to
content_sizewhen the container is a scroll container:For flexbox this required threading an
is_scroll_containerflag throughAlgoConstants(cfg-gated oncontent_size).Context
scrollWidth/scrollHeightsemantics for scroll containers; this PR keeps that behaviour for scroll containers (the existingcontent_size_includes_the_containers_own_padding/scroll_height_accounts_for_the_containers_own_paddingtests still pass) and only removes it for non-scroll-containers.content_size_excludes_the_own_padding_of_a_non_scroll_containertest covering Block/Flex/Grid.content_size=1234x3246, scroll_width=34tocontent_size=1200x3246, scroll_width=0(companion Blitz PR bumps the taffy rev).Link to Devin session: https://dioxus.staging.devinenterprise.com/sessions/b6f5529e9a3e4823b603788b475ab109
Requested by: @nicoburns