Repository navigation
Conversation
ide
force-pushed
the
@ide/min-content-walk-lookups
branch
2 times, most recently
from
December 4, 2026 01:42
b8e7023 to
9429781
Compare
ide
marked this pull request as ready for review
December 4, 2026 01:48
ide
force-pushed
the
@ide/min-content-walk-lookups
branch
from
December 4, 2026 11:33
9429781 to
a1791cd
Compare
Why === With `MinSizeUndefinedInsteadOfAuto` cleared, Yoga can walk a flex item's subtree to compute its automatic minimum size. To measure a leaf's min-content height, the walk derives its content width from each enclosing box. It resolves some of the same style values more than once per box. [CSS Flexbox §4.5](https://www.w3.org/TR/css-flexbox-1/#min-size-auto) How === Pass each container's resolved direction to `contentWidthUnderOwner`. Resolve a measured leaf's direction again after the callback because the callback can change it. Subtract margins only when the owner width is defined. If the resulting width is undefined, use the resolved maximum width as the input to the bounds check. Resolve stored width and height values directly with `Style::resolvedDimension`. Resolve a child's cross-axis size only when an aspect ratio can transfer that size to the measured axis. Test Plan === `cmake --build tests/build && tests/build/yogatests` passes. One regression test checks that opposing percentage margins whose sum overflows to NaN still let a leaf measure at its `max-width`. Another changes the leaf's direction to RTL within its min-content callback and checks that its automatic minimum width includes the RTL padding. Fuzz layouts match main for 200,000 varied trees and 200,000 nested trees with default configs and for 300,000 flat rows. They also match for 200,000 varied trees per config mode with `MinSizeUndefinedInsteadOfAuto` cleared, with all errata cleared, and with mixed node configs. Callgrind counts instructions in one `YGNodeCalculateLayout` call. GCC first layouts use the CI harness. Clang first layouts and both compilers' relayouts use a harness that replays the same captures. "All errata" uses the captured React Native config. "No errata" clears every erratum. The first-layout table compares react#2218 with this change. **Relayouts with no errata** | Relayout | Compiler | `3a201ff47` | Main baseline | react#2218 | This change | Change from react#2218 | Change from `3a201ff47` | | --- | --- | ---: | ---: | ---: | ---: | ---: | ---: | | rendering-sample-mac, one text grows | GCC 15.2 x86-64 | 246,928 | 333,330 | 256,769 | 236,553 | −7.87% | −4.20% | | rendering-sample-mac, one text grows | Clang 18.1 arm64 | 264,393 | 347,824 | 256,364 | 239,304 | −6.65% | −9.49% | | profile-ios, then the root narrows by 20pt | GCC 15.2 x86-64 | 1,162,027 | 1,268,056 | 1,101,596 | 1,098,279 | −0.30% | −5.49% | | profile-ios, then the root narrows by 20pt | Clang 18.1 arm64 | 1,313,623 | 1,365,936 | 1,149,762 | 1,147,321 | −0.21% | −12.66% | | chat-mac, one text grows | GCC 15.2 x86-64 | 1,099,172 | 1,110,516 | 987,547 | 983,130 | −0.45% | −10.56% | | chat-mac, one text grows | Clang 18.1 arm64 | 1,062,258 | 1,029,942 | 872,183 | 869,089 | −0.35% | −18.18% | The other relayouts change by −0.91% to +0.00% with GCC and −0.67% to +0.00% with Clang. **First layout** | Capture | Errata | GCC 15.2 x86-64 | Change | Clang 18.1 arm64 | Change | | --- | --- | ---: | ---: | ---: | ---: | | chat-mac | all errata | 42,238,101 → 42,238,384 | +0.00% | 43,685,141 → 43,685,141 | +0.00% | | chat-mac | no errata | 49,472,849 → 49,297,928 | −0.35% | 51,298,624 → 51,157,887 | −0.27% | | feed-android | all errata | 8,236,026 → 8,236,019 | −0.00% | 8,566,118 → 8,566,118 | +0.00% | | feed-android | no errata | 8,975,977 → 8,922,530 | −0.60% | 9,255,504 → 9,210,881 | −0.48% | | profile-ios | all errata | 1,627,904 → 1,627,883 | −0.00% | 1,698,555 → 1,698,555 | +0.00% | | profile-ios | no errata | 1,549,111 → 1,540,062 | −0.58% | 1,612,305 → 1,604,555 | −0.48% | | rendering-sample-mac | all errata | 749,944 → 749,944 | +0.00% | 764,552 → 764,552 | +0.00% | | rendering-sample-mac | no errata | 913,338 → 889,504 | −2.61% | 934,103 → 914,623 | −2.09% | Changelog: [Internal] Signed-off-by: James Ide <ide@expo.dev>
ide
force-pushed
the
@ide/min-content-walk-lookups
branch
from
December 5, 2026 16:45
a1791cd to
e55972b
Compare
This branch has not been deployed
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.
Why
With
MinSizeUndefinedInsteadOfAutocleared, Yoga can walk a flex item's subtree to compute its automatic minimum size. To measure a leaf's min-content height, the walk derives its content width from each enclosing box. It resolves some of the same style values more than once per box. CSS Flexbox §4.5How
Pass each container's resolved direction to
contentWidthUnderOwner. Resolve a measured leaf's direction again after the callback because the callback can change it. Subtract margins only when the owner width is defined. If the resulting width is undefined, use the resolved maximum width as the input to the bounds check.Resolve stored width and height values directly with
Style::resolvedDimension. Resolve a child's cross-axis size only when an aspect ratio can transfer that size to the measured axis.Test Plan
cmake --build tests/build && tests/build/yogatestspasses. One regression test checks that opposing percentage margins whose sum overflows to NaN still let a leaf measure at itsmax-width. Another changes the leaf's direction to RTL within its min-content callback and checks that its automatic minimum width includes the RTL padding.Fuzz layouts match main for 200,000 varied trees and 200,000 nested trees with default configs and for 300,000 flat rows. They also match for 200,000 varied trees per config mode with
MinSizeUndefinedInsteadOfAutocleared, with all errata cleared, and with mixed node configs.Callgrind counts instructions in one
YGNodeCalculateLayoutcall. GCC first layouts use the CI harness. Clang first layouts and both compilers' relayouts use a harness that replays the same captures. "All errata" uses the captured React Native config. "No errata" clears every erratum. The first-layout table compares #2218 with this change.Relayouts with no errata
3a201ff473a201ff47The other relayouts change by −0.91% to +0.00% with GCC and −0.67% to +0.00% with Clang.
First layout
Changelog: [Internal]