Incorrect cached child size is used because YGNodeCanUseCachedMeasurement() does not respect min/max dimensions
Nobody has claimed this yet.
- Dominant language
- C++
- Stars
- 18.9k
- Forks
- 1.6k
- Avg merge
- 1m
- Merged PRs (30d)
- 1
Description
Report
- I have searched existing issues and this is not a duplicate
Issues and Steps to Reproduce
See the attached example.
Child node has height = 10, minHeight = 40%, maxHeight = 60%.
When parent is measured against height = NaN, child height is computed to be 10, which is correct.
But then parent is laid out against height = 30.
Now child height should be max(40% * 30, min(10, 60% * 30)) = max(12, min(10, 18)) = 12.
But YGNodeCanUseCachedMeasurement() returns true and cached height of 10 is used instead.
Expected Behavior
In all the cases, final layout should have child height of 12.
Actual Behavior
In some of the scenarios incorrect cached height is used.
Link to Code
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by inspecting YGNodeCanUseCachedMeasurement() and the attached example at the pastebin link. Reproduce the case where the parent is first measured with an unspecified height and then laid out at height 30. Done means the final child height is 12 and incorrect cached measurements are no longer used in the affected scenarios.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- cpp
- Domain
- frontend, web-dev
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 45/100