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

Closed
NickGerleman wants to merge 1 commits from export-D76793705 into main
NickGerleman commented 2025-06-16 23:41:13 -07:00 (Migrated from github.com)

Summary:
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.

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

Differential Revision: D76793705

Summary: 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. Changelog: [General][Fixed] - Fix possible invalid measurements with width or height is zero pixels Differential Revision: D76793705
vercel[bot] commented 2025-06-16 23:41:17 -07:00 (Migrated from github.com)

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
yoga-website Ready (Inspect) Visit Preview 💬 Add feedback Jun 17, 2025 5:26pm
[vc]: #CMO07B7QteQPl7MHioVwTha2VI0Kayxmmnz7wqyQ5pA=:eyJpc01vbm9yZXBvIjp0cnVlLCJ0eXBlIjoiZ2l0aHViIiwicHJvamVjdHMiOlt7Im5hbWUiOiJ5b2dhLXdlYnNpdGUiLCJyb290RGlyZWN0b3J5Ijoid2Vic2l0ZSIsImluc3BlY3RvclVybCI6Imh0dHBzOi8vdmVyY2VsLmNvbS9mYm9wZW5zb3VyY2UveW9nYS13ZWJzaXRlL0NtaVRFNHRrYUw3bWphYWJpWmNjb3I5V3BqN1ciLCJwcmV2aWV3VXJsIjoieW9nYS13ZWJzaXRlLWdpdC1mb3JrLW5pY2tnZXJsZW1hbi1leHBvcnQtZC04ZTJiYzktZmJvcGVuc291cmNlLnZlcmNlbC5hcHAiLCJuZXh0Q29tbWl0U3RhdHVzIjoiREVQTE9ZRUQiLCJsaXZlRmVlZGJhY2siOnsicmVzb2x2ZWQiOjAsInVucmVzb2x2ZWQiOjAsInRvdGFsIjowLCJsaW5rIjoieW9nYS13ZWJzaXRlLWdpdC1mb3JrLW5pY2tnZXJsZW1hbi1leHBvcnQtZC04ZTJiYzktZmJvcGVuc291cmNlLnZlcmNlbC5hcHAifX1dfQ== **The latest updates on your projects**. Learn more about [Vercel for Git ↗︎](https://vercel.link/github-learn-more) | Name | Status | Preview | Comments | Updated (UTC) | | :--- | :----- | :------ | :------- | :------ | | **yoga-website** | ✅ Ready ([Inspect](https://vercel.com/fbopensource/yoga-website/CmiTE4tkaL7mjaabiZccor9Wpj7W)) | [Visit Preview](https://yoga-website-git-fork-nickgerleman-export-d-8e2bc9-fbopensource.vercel.app) | 💬 [**Add feedback**](https://vercel.live/open-feedback/yoga-website-git-fork-nickgerleman-export-d-8e2bc9-fbopensource.vercel.app?via=pr-comment-feedback-link) | Jun 17, 2025 5:26pm |
facebook-github-bot commented 2025-06-16 23:41:37 -07:00 (Migrated from github.com)

This pull request was exported from Phabricator. Differential Revision: D76793705

This pull request was **exported** from Phabricator. Differential Revision: [D76793705](https://www.internalfb.com/diff/D76793705)
facebook-github-bot commented 2025-06-17 09:58:16 -07:00 (Migrated from github.com)

This pull request was exported from Phabricator. Differential Revision: D76793705

This pull request was **exported** from Phabricator. Differential Revision: [D76793705](https://www.internalfb.com/diff/D76793705)
facebook-github-bot commented 2025-06-17 10:23:38 -07:00 (Migrated from github.com)

This pull request was exported from Phabricator. Differential Revision: D76793705

This pull request was **exported** from Phabricator. Differential Revision: [D76793705](https://www.internalfb.com/diff/D76793705)
facebook-github-bot commented 2025-06-17 14:07:28 -07:00 (Migrated from github.com)

This pull request has been merged in facebook/yoga@27d632c697.

This pull request has been merged in facebook/yoga@27d632c697e983d15f14fc4b9c3adf35c0ade680.
facebook-github-bot commented 2025-06-17 14:36:24 -07:00 (Migrated from github.com)

This pull request has been reverted by 30291398f3.

This pull request has been **reverted** by 30291398f36fd2627f8276f74e8e30f663878dac.

Pull request closed

Sign in to join this conversation.
No description provided.