Commit 4501979
Preserve negative values in transformOrigin strings (#57691)
Summary:
The numeric tokenizer updated in #57487 still starts at the first digit when a percentage or pixel value is negative. This silently changes values such as `-12.5px -7.5px` into `[12.5, 7.5, 0]`.
Allow a leading minus in numeric tokens so negative percentages, pixel offsets, and leading-dot decimals retain their sign. The pattern is intentionally limited to the failing negative case and leaves leading-plus values unchanged.
## Changelog:
[GENERAL] [FIXED] - Preserve negative values in `transformOrigin` strings.
Pull Request resolved: #57691
Test Plan:
- Added Fantom regression coverage for negative percentages, x/y/z pixel offsets, and leading-dot decimals in `processTransformOrigin-itest.js`
- `./node_modules/.bin/prettier --check packages/react-native/Libraries/StyleSheet/processTransformOrigin.js packages/react-native/Libraries/StyleSheet/__tests__/processTransformOrigin-itest.js`
- `./node_modules/.bin/eslint --max-warnings 0 packages/react-native/Libraries/StyleSheet/processTransformOrigin.js packages/react-native/Libraries/StyleSheet/__tests__/processTransformOrigin-itest.js`
- Ran focused runtime checks against the Flow-stripped parser for the new negative cases and existing leading-plus behavior
Reviewed By: javache
Differential Revision: D113756417
Pulled By: fabriziocucci
fbshipit-source-id: a1506ada24adbeb81892a7c1d821e03ccd388de21 parent 4043e81 commit 4501979
3 files changed
Lines changed: 54 additions & 1 deletion
File tree
- packages/react-native
- Libraries/StyleSheet
- __tests__
- ReactCommon/react/renderer/css/tests
Lines changed: 11 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
122 | 122 | | |
123 | 123 | | |
124 | 124 | | |
| 125 | + | |
| 126 | + | |
| 127 | + | |
| 128 | + | |
| 129 | + | |
| 130 | + | |
| 131 | + | |
| 132 | + | |
| 133 | + | |
| 134 | + | |
| 135 | + | |
125 | 136 | | |
126 | 137 | | |
Lines changed: 1 addition & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
12 | 12 | | |
13 | 13 | | |
14 | 14 | | |
15 | | - | |
| 15 | + | |
16 | 16 | | |
17 | 17 | | |
18 | 18 | | |
| |||
Lines changed: 42 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
455 | 455 | | |
456 | 456 | | |
457 | 457 | | |
| 458 | + | |
| 459 | + | |
| 460 | + | |
| 461 | + | |
| 462 | + | |
| 463 | + | |
| 464 | + | |
| 465 | + | |
| 466 | + | |
| 467 | + | |
| 468 | + | |
| 469 | + | |
| 470 | + | |
| 471 | + | |
| 472 | + | |
| 473 | + | |
| 474 | + | |
| 475 | + | |
| 476 | + | |
| 477 | + | |
| 478 | + | |
| 479 | + | |
| 480 | + | |
| 481 | + | |
| 482 | + | |
| 483 | + | |
| 484 | + | |
| 485 | + | |
| 486 | + | |
| 487 | + | |
| 488 | + | |
| 489 | + | |
| 490 | + | |
| 491 | + | |
| 492 | + | |
| 493 | + | |
| 494 | + | |
| 495 | + | |
| 496 | + | |
| 497 | + | |
| 498 | + | |
| 499 | + | |
458 | 500 | | |
0 commit comments