Repository navigation
Conversation
javache
force-pushed
the
export-D128898045
branch
from
November 2, 2026 09:41
5661295 to
79a8ffe
Compare
|
@javache has exported this pull request. If you are a Meta employee, you can view the originating Diff in D128898045. |
javache
pushed a commit
to javache/react-native
that referenced
this pull request
Nov 2, 2026
… size (react#2056) (react#59745) Summary: Pull Request resolved: react#59745 ## Summary Fixes react#2052. Replacing a non-integer size with `max-content`, `fit-content`, or `stretch` could make the getter return a different keyword. `YGNodeStyleSetHeight(node, 0.5f)`, then `YGNodeStyleSetWidth(node, 0.25f)`, then `YGNodeStyleSetWidthMaxContent(node)` made `YGNodeStyleGetWidth` return `YGUnitFitContent` instead of `YGUnitMaxContent`. A non-integer size is stored in the value pool, and the handle keeps that pool index in its value bits. `storeKeyword` changed the type to `Keyword` but left the indexed bit set, so `isKeyword` compared the pool index with the keyword enum (`MaxContent` = 0, `FitContent` = 1, `Stretch` = 2). The same mismatch affects height, min and max size, and flex-basis. A pool index of 3 or more matches no keyword and hits the debug assert in `getSize`. `auto`, `undefined`, margin, and padding read the type bits only, so those getters were already correct. `storeKeyword` still writes the keyword into the handle's existing pool slot. `getSize` now reads that slot when the indexed bit is set, so the handle keeps the slot and the getter returns the stored keyword. ## Test plan - `YogaTest.width_keyword_replaces_pooled_number` covers the react#2052 sequence. - `StyleValuePool.store_keywords_after_large_int` checks max-content, fit-content, and stretch in pool slots 0 through 3. - `StyleValuePool.store_large_int_and_keyword_repeatedly` switches a pooled number and max-content 5000 times and checks that the slot is reused. - `./unit_tests Debug`: 880 passed, 0 failed. Baseline before these tests was 877 passed, 0 failed. Changelog: [General][Fixed] - Fix reading back max-content, fit-content, and stretch after a non-integer size was stored Reviewed By: javache Differential Revision: D128898045
javache
force-pushed
the
export-D128898045
branch
from
November 2, 2026 09:44
79a8ffe to
2267126
Compare
meta-codesync Bot
pushed a commit
to meta/litho
that referenced
this pull request
Nov 2, 2026
… size (#2056) Summary: X-link: react/react-native#59745 ## Summary Fixes #2052. Replacing a non-integer size with `max-content`, `fit-content`, or `stretch` could make the getter return a different keyword. `YGNodeStyleSetHeight(node, 0.5f)`, then `YGNodeStyleSetWidth(node, 0.25f)`, then `YGNodeStyleSetWidthMaxContent(node)` made `YGNodeStyleGetWidth` return `YGUnitFitContent` instead of `YGUnitMaxContent`. A non-integer size is stored in the value pool, and the handle keeps that pool index in its value bits. `storeKeyword` changed the type to `Keyword` but left the indexed bit set, so `isKeyword` compared the pool index with the keyword enum (`MaxContent` = 0, `FitContent` = 1, `Stretch` = 2). The same mismatch affects height, min and max size, and flex-basis. A pool index of 3 or more matches no keyword and hits the debug assert in `getSize`. `auto`, `undefined`, margin, and padding read the type bits only, so those getters were already correct. `storeKeyword` still writes the keyword into the handle's existing pool slot. `getSize` now reads that slot when the indexed bit is set, so the handle keeps the slot and the getter returns the stored keyword. ## Test plan - `YogaTest.width_keyword_replaces_pooled_number` covers the #2052 sequence. - `StyleValuePool.store_keywords_after_large_int` checks max-content, fit-content, and stretch in pool slots 0 through 3. - `StyleValuePool.store_large_int_and_keyword_repeatedly` switches a pooled number and max-content 5000 times and checks that the slot is reused. - `./unit_tests Debug`: 880 passed, 0 failed. Baseline before these tests was 877 passed, 0 failed. Changelog: [General][Fixed] - Fix reading back max-content, fit-content, and stretch after a non-integer size was stored Reviewed By: javache Differential Revision: D128898045 fbshipit-source-id: 0c09558d2774b3ad58b34459466a2455811e18b4
Abbondanzo
approved these changes
Nov 2, 2026
javache
enabled auto-merge (squash)
November 2, 2026 21:58
… size (react#2056) (react#59745) Summary: ## Summary Fixes react#2052. Replacing a non-integer size with `max-content`, `fit-content`, or `stretch` could make the getter return a different keyword. `YGNodeStyleSetHeight(node, 0.5f)`, then `YGNodeStyleSetWidth(node, 0.25f)`, then `YGNodeStyleSetWidthMaxContent(node)` made `YGNodeStyleGetWidth` return `YGUnitFitContent` instead of `YGUnitMaxContent`. A non-integer size is stored in the value pool, and the handle keeps that pool index in its value bits. `storeKeyword` changed the type to `Keyword` but left the indexed bit set, so `isKeyword` compared the pool index with the keyword enum (`MaxContent` = 0, `FitContent` = 1, `Stretch` = 2). The same mismatch affects height, min and max size, and flex-basis. A pool index of 3 or more matches no keyword and hits the debug assert in `getSize`. `auto`, `undefined`, margin, and padding read the type bits only, so those getters were already correct. `storeKeyword` still writes the keyword into the handle's existing pool slot. `getSize` now reads that slot when the indexed bit is set, so the handle keeps the slot and the getter returns the stored keyword. ## Test plan - `YogaTest.width_keyword_replaces_pooled_number` covers the react#2052 sequence. - `StyleValuePool.store_keywords_after_large_int` checks max-content, fit-content, and stretch in pool slots 0 through 3. - `StyleValuePool.store_large_int_and_keyword_repeatedly` switches a pooled number and max-content 5000 times and checks that the slot is reused. - `./unit_tests Debug`: 880 passed, 0 failed. Baseline before these tests was 877 passed, 0 failed. Changelog: [General][Fixed] - Fix reading back max-content, fit-content, and stretch after a non-integer size was stored Reviewed By: javache Differential Revision: D128898045
javache
force-pushed
the
export-D128898045
branch
from
November 2, 2026 22:00
2267126 to
6de547f
Compare
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary:
Summary
Fixes #2052.
Replacing a non-integer size with
max-content,fit-content, orstretchcould make the getter return a different keyword.YGNodeStyleSetHeight(node, 0.5f), thenYGNodeStyleSetWidth(node, 0.25f), thenYGNodeStyleSetWidthMaxContent(node)madeYGNodeStyleGetWidthreturnYGUnitFitContentinstead ofYGUnitMaxContent.A non-integer size is stored in the value pool, and the handle keeps that pool index in its value bits.
storeKeywordchanged the type toKeywordbut left the indexed bit set, soisKeywordcompared the pool index with the keyword enum (MaxContent= 0,FitContent= 1,Stretch= 2). The same mismatch affects height, min and max size, and flex-basis. A pool index of 3 or more matches no keyword and hits the debug assert ingetSize.auto,undefined, margin, and padding read the type bits only, so those getters were already correct.storeKeywordstill writes the keyword into the handle's existing pool slot.getSizenow reads that slot when the indexed bit is set, so the handle keeps the slot and the getter returns the stored keyword.Test plan
YogaTest.width_keyword_replaces_pooled_numbercovers the [ScrollView] Why the top of ScrollView has more than 20 pixels #2052 sequence.StyleValuePool.store_keywords_after_large_intchecks max-content, fit-content, and stretch in pool slots 0 through 3.StyleValuePool.store_large_int_and_keyword_repeatedlyswitches a pooled number and max-content 5000 times and checks that the slot is reused../unit_tests Debug: 880 passed, 0 failed. Baseline before these tests was 877 passed, 0 failed.Changelog:
[General][Fixed] - Fix reading back max-content, fit-content, and stretch after a non-integer size was stored
Reviewed By: javache
Differential Revision: D128898045