Repository navigation
Commit 0ec933a
Walk only the requested axis for a container's min-content size (#2102)
Summary:
* Walk only the requested axis for a container's min-content size
Why
===
The min-content walk behind automatic minimum sizes (css-flexbox-1 §4.5) is asked for a container's size on one axis. For every child it computed the size on both of the container's axes, summed one, took the largest of the other, and returned only the one it was asked for. The work on the other axis was wasted: a leaf was measured, and a container walked, on an axis no flex line needed.
How
===
The walk asks each child for the requested axis alone. It sums the children where that is the container's main axis and takes the largest where it is the cross axis. Layout results are unchanged. The memo already kept a leaf to one probe per axis per layout, so the saving is one measure call per leaf, and one walk per container, on the axis nobody asked for.
Test Plan
=========
`cmake --build tests/build && tests/build/yogatests` passes. `nested_leaf_probed_at_most_once_per_axis_per_layout`, a measured leaf ten containers deep in a shrinking row, accepted up to two probes. It now expects one, and sees 2 without this change.
`yarn gentest -h` leaves the tree clean, and `node ./scripts/clang-format.js --check` passes.
Changelog:
[General][Changed] - Yoga calls a measure function for an automatic minimum size only on the axis it needs
* Simplify alongMainAxis check and assert probed axis in test
---------
Reviewed By: javache
Differential Revision: D1353283931 parent ac9efe5 commit 0ec933a
1 file changed
Lines changed: 18 additions & 40 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1026 | 1026 | | |
1027 | 1027 | | |
1028 | 1028 | | |
1029 | | - | |
1030 | | - | |
1031 | | - | |
1032 | | - | |
| 1029 | + | |
| 1030 | + | |
| 1031 | + | |
1033 | 1032 | | |
1034 | | - | |
1035 | | - | |
| 1033 | + | |
1036 | 1034 | | |
1037 | 1035 | | |
1038 | 1036 | | |
| |||
1042 | 1040 | | |
1043 | 1041 | | |
1044 | 1042 | | |
1045 | | - | |
| 1043 | + | |
1046 | 1044 | | |
1047 | 1045 | | |
1048 | | - | |
| 1046 | + | |
1049 | 1047 | | |
1050 | 1048 | | |
1051 | 1049 | | |
1052 | 1050 | | |
1053 | | - | |
1054 | | - | |
1055 | | - | |
1056 | | - | |
1057 | | - | |
1058 | | - | |
1059 | | - | |
1060 | | - | |
1061 | | - | |
1062 | | - | |
1063 | | - | |
1064 | | - | |
1065 | | - | |
1066 | | - | |
1067 | | - | |
| 1051 | + | |
| 1052 | + | |
| 1053 | + | |
| 1054 | + | |
1068 | 1055 | | |
1069 | | - | |
1070 | | - | |
| 1056 | + | |
1071 | 1057 | | |
1072 | 1058 | | |
1073 | | - | |
1074 | | - | |
1075 | | - | |
1076 | | - | |
1077 | | - | |
1078 | | - | |
| 1059 | + | |
| 1060 | + | |
1079 | 1061 | | |
1080 | | - | |
| 1062 | + | |
1081 | 1063 | | |
1082 | | - | |
1083 | | - | |
1084 | | - | |
1085 | | - | |
1086 | 1064 | | |
1087 | 1065 | | |
1088 | 1066 | | |
| |||
1201 | 1179 | | |
1202 | 1180 | | |
1203 | 1181 | | |
1204 | | - | |
1205 | | - | |
1206 | | - | |
1207 | | - | |
| 1182 | + | |
| 1183 | + | |
| 1184 | + | |
| 1185 | + | |
1208 | 1186 | | |
1209 | 1187 | | |
1210 | 1188 | | |
| |||
0 commit comments