🐛 Keep the fill sizing of a shape an update main leaves absolute

An update main that resizes a main shape a layout fills fixes its sizing,
so the layout does not undo the pushed size; for a shape that is not a
layout, that drops the sizing. A copy child made absolute pushed its
absolute flag and its width, so its main shape came out absolute without
the fill sizing the copy keeps. No layout fills an absolute shape: a fill
axis of a shape the push leaves absolute now keeps its sizing.

Test: updating-a-main-keeps-the-fill-sizing-its-child-authors (the
library gate program of seed 175377838).

Benchmark (scripts/bench-components, ms, lower 2.5% quantile), measured
with the next commit's change in the tree as well:
|                             :world | :baseline |    :now |   :mean | :ratio |
|------------------------------------+-----------+---------+---------+--------|
|  deepest-edit-through-three-levels |    35.215 |  21.071 |  22.737 |    0.6 |
| edit-through-a-chain-of-dependents |    68.931 |  44.394 |   45.61 |   0.64 |
|         library-update-into-copies |    83.083 |  53.752 |  54.632 |   0.65 |
|        main-edit-among-many-shapes |     4.837 |   2.372 |   2.633 |   0.49 |
|           main-edit-into-10-copies |      1.79 |   0.997 |   1.029 |   0.56 |
|          main-edit-into-100-copies |    15.415 |  10.009 |  11.143 |   0.65 |
|         main-edit-into-1000-copies |   153.086 | 109.767 | 112.342 |   0.72 |
|         variant-switch-into-copies |    32.052 |  22.182 |  23.614 |   0.69 |

AI-assisted-by: claude-opus-5-5
This commit is contained in:
alonso.torres 2026-11-12 11:05:04 +01:00
parent e766345cd0
commit ed1dbca6da
2 changed files with 9 additions and 0 deletions

View File

@ -984,6 +984,9 @@
(and laid?
(not (ctk/touched-group? shape-inst sizing))
(contains? #{:fill :auto} (get shape-main sizing))
;; no layout fills a shape the push leaves absolute
(not (and (= :fill (get shape-main sizing))
(ctsl/position-absolute? shape-inst)))
(or turned?
(and (not (copy-sized? sizing))
(not (mth/close? (get source size) (get shape-main size)))))))

View File

@ -2387,6 +2387,12 @@
:layout-copies false :text false}]
:ops [[:grid-track 10 5 0 11] [:grid-track 0 1] [:grid-cell 0 0 0 1]]}))))
(t/deftest updating-a-main-keeps-the-fill-sizing-its-child-authors
(t/is (map? (cg/run {:world [1 1 {:variants false :text-styles false :layout :flex :layout-item-margins false
:grid-square false :library false :rich-variants false :layout-children true
:grid-empty false :layout-copies true :text false}]
:ops [[:style 8 35 1] [:style 0 29 1] [:update-main]]}))))
(t/deftest updating-a-main-pushes-a-swapped-shape-nested-in-a-swap-with-its-children
(t/is (map? (cg/run {:world [3 3 {:variants true :text-styles true :scale true :layout :flex :variant-diff true
:grid-square false :copies 5 :rich-variants true :layout-children true