https://www.w3.org/TR/css-contain-1/#valdef-contain-layout
layout
This value turns on layout containment for the element. This ensures that the containing element is totally
opaque for layout purposes; nothing outside can affect its internal layout, and vice versa.
However, I can't find anything in the description of contain: layout that disallows sizing to the available space (<div style="width: auto">) or fit-content sizing. So the inline-size of the containing element, in the common case, depends on the size of its parent.