Repository navigation
Fix OverflowBox dry layout when deferToChild overrides the constraints - #196839
Conversation
RenderConstrainedOverflowBox.computeDryLayout with OverflowBoxFit.deferToChild asked the child for its dry size under the incoming constraints, while performLayout lays the child out under _getInnerConstraints(constraints) and then constrains the child's size to the incoming constraints. With a min or max of its own, getDryLayout disagreed with layout (and so did the dry baseline). computeDryLayout now mirrors performLayout. Fixes flutter#196838
There was a problem hiding this comment.
Code Review
This pull request updates RenderConstrainedOverflowBox.computeDryLayout to constrain the returned size and pass the correct inner constraints to the child when using OverflowBoxFit.deferToChild. It also adds a widget test to verify that the dry layout matches the actual layout when min or max constraints override the incoming constraints. There are no review comments, and I have no feedback to provide.
…in the test The test now enables debugCheckIntrinsicSizes itself and restores the previous value at the end, so it keeps checking dry layout against layout if the suite default changes. The loop variable is testCase (case is a reserved word).
|
@navaronbracke Thanks for the review! Looks like the "Google testing" check is blocked by an approval from a Googler. Is there a way to pin someone from the Google team to approve this PR? |
|
I'll look into that for you! |
theprantadutta
left a comment
There was a problem hiding this comment.
I compared computeDryLayout with performLayout, and the fix looks correct. I also verified the four test cases individually. Three fail without the fix, but case 4 passes even with the old implementation because both dry layout and actual layout return the same constrained size (100×30).
Case 4 is still useful for verifying the constraint clamp, but could we clarify in the PR description that it doesn't reproduce the original bug?
|
Thanks, you're right: case 4 passes on the old code too, since both clamp to 100×30. I kept it as a guard for the clamp and updated the description. |
Roll Flutter from e8cc6f3451b7 to b34b017b48ad (36 revisions) flutter/flutter@e8cc6f3...b34b017 2026-11-20 [email protected] Fix OverflowBox dry layout when deferToChild overrides the constraints (flutter/flutter#196839) 2026-11-20 [email protected] Roll Dart SDK from f118f476ebce to 3b5f45d812f8 (1 revision) (flutter/flutter#197048) 2026-11-20 [email protected] [macOS] Register plugins in multiple_windows example (flutter/flutter#196068) 2026-11-20 [email protected] Roll Skia from 87027a9d4659 to a1edf5c2ea5c (1 revision) (flutter/flutter#197045) 2026-11-20 [email protected] Add highp directives to UberSDF to prevent overflow (flutter/flutter#196997) 2026-11-20 [email protected] [Impeller] Cap the Vulkan command pool recycler cache (flutter/flutter#194793) 2026-11-20 [email protected] Roll Skia from 12610b69511d to 87027a9d4659 (4 revisions) (flutter/flutter#197037) 2026-11-20 [email protected] [macOS] Unregister nil binary message handlers (flutter/flutter#193672) 2026-11-20 [email protected] Roll Dart SDK from b803c3ec01de to f118f476ebce (2 revisions) (flutter/flutter#197034) 2026-11-20 [email protected] Roll Skia from 2f1436ba8e64 to 12610b69511d (3 revisions) (flutter/flutter#197030) 2026-11-20 [email protected] [Android] Do not use the HCPP external view embedder from its platform tasks (flutter/flutter#196490) 2026-11-20 [email protected] Roll Dart SDK from 849e17ad3ae6 to b803c3ec01de (1 revision) (flutter/flutter#197012) 2026-11-20 [email protected] [iOS a11y] Synchronize hit-test children when replacing semantics objects (flutter/flutter#196439) 2026-11-20 [email protected] Sync CHANGELOG.md from stable (flutter/flutter#197019) 2026-11-19 [email protected] [flutter_tools] Reland "Extract Windows archives using native tar" (flutter/flutter#193515) 2026-11-19 [email protected] [Reland][flutter_tools] Migrate lib/runner.dart off runInContext and overrides (flutter/flutter#196931) 2026-11-19 [email protected] Include assigned issues in Android incoming triage link (flutter/flutter#197008) 2026-11-19 [email protected] [Flutter GPU] Record on the UI thread, encode and submit on the raster thread (flutter/flutter#194882) 2026-11-19 [email protected] Add Pixel 7 Pro Impeller benchmarks without fixed-performance mode (flutter/flutter#197010) 2026-11-19 [email protected] Reduce time of uiscene_plugin_lifecycle_test_ios (flutter/flutter#196363) 2026-11-19 [email protected] [native assets] Respect Apple deployment targets (flutter/flutter#194146) 2026-11-19 [email protected] iOS: Represent platform view frames as FlutterPlatformViewFrames (flutter/flutter#196955) 2026-11-19 [email protected] Roll Skia from 0bf961e4ff05 to 2f1436ba8e64 (3 revisions) (flutter/flutter#196999) 2026-11-19 [email protected] [ios] Record OCMReject expectations before the stimulus in FlutterPluginAppLifeCycleDelegateTest (flutter/flutter#193011) 2026-11-19 [email protected] Fix post-monorepo doc rot in docs/infra and dev/bots/README.md (flutter/flutter#193010) 2026-11-19 [email protected] Roll Skia from c3567e170362 to 0bf961e4ff05 (4 revisions) (flutter/flutter#196994) 2026-11-19 [email protected] Close Linux popups when their parent loses focuses (flutter/flutter#196825) 2026-11-19 [email protected] Roll Packages from dca2e58 to 81b7c44 (6 revisions) (flutter/flutter#196992) 2026-11-19 [email protected] Roll Dart SDK from d8d40cf9c21b to 849e17ad3ae6 (1 revision) (flutter/flutter#196986) 2026-11-19 [email protected] Fix RouteObserver didPushNext not firing when routes are pushed synchronously (flutter/flutter#189057) 2026-11-19 [email protected] [Impeller] Reuse render targets on text shadow cache misses (flutter/flutter#194769) 2026-11-19 [email protected] Roll Skia from 81de64af9806 to c3567e170362 (3 revisions) (flutter/flutter#196982) 2026-11-19 [email protected] Reland: "Move macOS desktop builds to ThinLTO" (flutter/flutter#196928) 2026-11-19 [email protected] [Linux] Desynchronize the Wayland subsurface so frames don't redraw the GTK window (flutter/flutter#195287) 2026-11-19 [email protected] Roll Skia from 3dfb69d709c7 to 81de64af9806 (1 revision) (flutter/flutter#196975) 2026-11-19 [email protected] Update `ProxyAnimation.didStartListening` and `ProxyAnimation. didStopListening` to use dart's `Conditional member access` (flutter/flutter#195762) If this roll has caused a breakage, revert this CL and set the roller to dry run mode using the controls here: https://autoroll.skia.org/r/flutter-packages Please CC [email protected],[email protected] on the revert to ensure that a human is aware of the problem. To file a bug in Packages: https://github.com/flutter/flutter/issues/new/choose To report a problem with the AutoRoller itself, please file a bug: ...
RenderConstrainedOverflowBox.computeDryLayoutwithOverflowBoxFit.deferToChildasks the child for its dry size under the incoming constraints.performLayoutlays the child out under_getInnerConstraints(constraints)and then constrains the child's size to the incoming constraints. So whenminWidth,maxWidth,minHeightormaxHeightoverride the incoming constraints,getDryLayoutreturns a different size from layout, anddebugCheckIntrinsicSizesreports it. Dry baselines are off as well, becausecomputeDryBaselinetakes the box's own size fromgetDryLayout.This change makes
computeDryLayoutmirrorperformLayout: the child is dry-laid out under the inner constraints, and the result is constrained to the incoming ones.Fixes #196838
The new test in
overflow_box_test.dartcovers four cases:The first three cases fail without the change. The fourth (a child larger than the incoming max) passes either way, since both paths clamp it to 100×30; it guards that clamp.
Pre-launch Checklist
///).Prepared with the help of Claude Code.