Reland Fix possible invalid measurements when width or height is zero pixels #1823

Closed
NickGerleman wants to merge 1 commits from export-D76851589 into main

1 Commits

Author SHA1 Message Date
Nick Gerleman
fe6a2f583e Reland Fix possible invalid measurements when width or height is zero pixels
Summary:
Fixes https://github.com/facebook/yoga/issues/1819

Yoga has a fast path when measuring a node, if it thinks it knows its dimensions ahead of time.

This path has some eroneous logic, to set both axis to owner size, if *either* will evaluate to zero, while having an `YGMeasureModeAtMost`/`FitContent` constraint. This means that if a node is given a zero width, and Yoga later measures with with `FitContent`, its height will become the maximum allowable height, even if it shouldn't be that large.

We can fix this, by only allowing if both axis are this fixed case, instead of just one.

This bug has existed for about a decade (going back to at least D3312496).

Changelog:
[General][Fixed] - Fix possible invalid measurements with width or height is zero pixels

Reviewed By: yungsters

Differential Revision: D76851589
2025-06-30 19:45:11 -07:00