Skip to content

Commit 38021b8

Browse files
acoates-msiamAbhi-916gmacmaster
authored
[0.81] Fix touch event handling, improve reliability, and optimize performance (#16050)
* Fix ScrollView keyboard scroll drift on long key press (#15988) * Fix ScrollView keyboard scroll drift on long key press * Change files * [0.84] Fix multiline TextInput crash from TxDrawD2D reentrancy (#15990) (#16003) * Fix multiline TextInput crash from TxDrawD2D reentrancy * Change files * Fix touch event handling, improve reliability, and optimize performance (#16048) * Fix touch event handling, improve reliability, and optimize performance - Fix touch/pen pointer device type detection and screenPoint coordinates - Fix touch cancel to include all active touches per W3C spec - Synthesize touch-cancel for stale pointers and releases outside views - Fix TextInput pointer message translation (use mouse-style messages for RichEdit) - Fix ShouldSubmit modifier key checks (altDown, ctrlKey) - Add null safety to RootComponentView() for island teardown - Fix Pressability hover timeout and tabIndex focusable mapping - Cache event path to root to avoid repeated tree walks - Use unordered_set for pointer capture tracking - Eliminate O(n²) hit testing by caching visual children - Skip snap scroll reconfiguration when unchanged - Improve TextInput reliability: thread-safe loading, null safety, use-after-free fix - Fix Timing data race and remove duplicate image error allocation - Use unordered_set for animated node and component registry lookups - Clean up dead code in ScrollView and simplify Modal event emitter init * formatting * Change files * Update react-native-windows-cd995d7a-4df8-4c73-9b1b-c57b3b886cc6.json * Touch target * addressed pr comments * Crash on invalid index * revert until rn core pr * Update react-native-windows-cd995d7a-4df8-4c73-9b1b-c57b3b886cc6.json * format * snapshots --------- Co-authored-by: Gordon MacMaster <31481849+gmacmaster@users.noreply.github.com> Co-authored-by: Gordon MacMaster <gordomacmaster@gmail.com> * change files * Fix some issues with rounded borders (#16051) * Some fixes for rounded borders * Change files * Image snaphots --------- Co-authored-by: Abhijeet Jha <74712637+iamAbhi-916@users.noreply.github.com> Co-authored-by: Gordon MacMaster <31481849+gmacmaster@users.noreply.github.com> Co-authored-by: Gordon MacMaster <gordomacmaster@gmail.com>
1 parent ea19ef5 commit 38021b8

20 files changed

Lines changed: 492 additions & 229 deletions
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
{
2+
"type": "patch",
3+
"comment": "Some fixes for rounded borders",
4+
"packageName": "react-native-windows",
5+
"email": "30809111+acoates-ms@users.noreply.github.com",
6+
"dependentChangeType": "patch"
7+
}
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
{
2+
"type": "patch",
3+
"comment": "Fix ScrollView keyboard scroll drift on long key press",
4+
"packageName": "react-native-windows",
5+
"email": "74712637+iamAbhi-916@users.noreply.github.com",
6+
"dependentChangeType": "patch"
7+
}
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
{
2+
"type": "patch",
3+
"comment": "Fix touch event handling, improve reliability, and optimize performance",
4+
"packageName": "react-native-windows",
5+
"email": "gordomacmaster@gmail.com",
6+
"dependentChangeType": "patch"
7+
}
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
{
2+
"type": "patch",
3+
"comment": "Fix multiline TextInput crash from TxDrawD2D reentrancy",
4+
"packageName": "react-native-windows",
5+
"email": "74712637+iamAbhi-916@users.noreply.github.com",
6+
"dependentChangeType": "patch"
7+
}

packages/e2e-test-app-fabric/test/__snapshots__/PointerClickEventsTest.test.ts.snap

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -19,8 +19,8 @@ exports[`Pointer onClick Test onAuxClick reports correct native event properties
1919
"pointerId": 1,
2020
"pointerType": "mouse",
2121
"pressure": 0,
22-
"screenX": 100,
23-
"screenY": 99,
22+
"screenX": 110,
23+
"screenY": 165,
2424
"shiftKey": false,
2525
"tangentialPressure": 0,
2626
"target": "<target>",
@@ -52,8 +52,8 @@ exports[`Pointer onClick Test onAuxClick reports correct native event properties
5252
"pointerId": 1,
5353
"pointerType": "mouse",
5454
"pressure": 0,
55-
"screenX": 100,
56-
"screenY": 99,
55+
"screenX": 110,
56+
"screenY": 165,
5757
"shiftKey": false,
5858
"tangentialPressure": 0,
5959
"target": "<target>",
@@ -85,8 +85,8 @@ exports[`Pointer onClick Test onClick reports correct native event properties on
8585
"pointerId": 1,
8686
"pointerType": "mouse",
8787
"pressure": 0,
88-
"screenX": 100,
89-
"screenY": 99,
88+
"screenX": 110,
89+
"screenY": 165,
9090
"shiftKey": false,
9191
"tangentialPressure": 0,
9292
"target": "<target>",

vnext/Microsoft.ReactNative/Fabric/Composition/BorderPrimitive.cpp

Lines changed: 53 additions & 66 deletions
Original file line numberDiff line numberDiff line change
@@ -26,16 +26,18 @@ bool isColorMeaningful(
2626
void pixelRoundBorderRadii(facebook::react::BorderRadii &borderRadii, float scaleFactor) noexcept {
2727
// Always round radii down to avoid spikey circles
2828
borderRadii.topLeft = {
29-
std::floor(borderRadii.topLeft.horizontal * scaleFactor), std::floor(borderRadii.topLeft.vertical * scaleFactor)};
29+
.vertical = std::floor(borderRadii.topLeft.vertical * scaleFactor),
30+
.horizontal = std::floor(borderRadii.topLeft.horizontal * scaleFactor)};
3031
borderRadii.topRight = {
31-
std::floor(borderRadii.topRight.horizontal * scaleFactor),
32-
std::floor(borderRadii.topRight.vertical * scaleFactor)};
32+
.vertical = std::floor(borderRadii.topRight.vertical * scaleFactor),
33+
.horizontal = std::floor(borderRadii.topRight.horizontal * scaleFactor)};
3334
borderRadii.bottomLeft = {
34-
std::floor(borderRadii.bottomLeft.horizontal * scaleFactor),
35-
std::floor(borderRadii.bottomLeft.vertical * scaleFactor)};
35+
.vertical = std::floor(borderRadii.bottomLeft.vertical * scaleFactor),
36+
.horizontal = std::floor(borderRadii.bottomLeft.horizontal * scaleFactor)};
3637
borderRadii.bottomRight = {
37-
std::floor(borderRadii.bottomRight.horizontal * scaleFactor),
38-
std::floor(borderRadii.bottomRight.vertical * scaleFactor)};
38+
.vertical = std::floor(borderRadii.bottomRight.vertical * scaleFactor),
39+
.horizontal = std::floor(borderRadii.bottomRight.horizontal * scaleFactor),
40+
};
3941
}
4042

4143
void scaleAndPixelRoundBorderWidths(
@@ -268,30 +270,14 @@ RoundedPathParameters GenerateRoundedPathParameters(
268270
return result;
269271
}
270272

271-
float totalTopRadius = baseRadius.topLeft.horizontal + baseRadius.topRight.horizontal;
272-
float totalRightRadius = baseRadius.topRight.vertical + baseRadius.bottomRight.vertical;
273-
float totalBottomRadius = baseRadius.bottomRight.horizontal + baseRadius.bottomLeft.horizontal;
274-
float totalLeftRadius = baseRadius.bottomLeft.vertical + baseRadius.topLeft.vertical;
275-
276-
float maxHorizontalRadius = std::max(totalTopRadius, totalBottomRadius);
277-
float maxVerticalRadius = std::max(totalLeftRadius, totalRightRadius);
278-
279-
double totalWidth = inset.left + inset.right + pathSize.width;
280-
double totalHeight = inset.top + inset.bottom + pathSize.height;
281-
282-
float scaleHoriz = static_cast<float>(maxHorizontalRadius / totalWidth);
283-
float scaleVert = static_cast<float>(maxVerticalRadius / totalHeight);
284-
285-
float maxScale = std::max(1.0f, std::max(scaleHoriz, scaleVert));
286-
287-
result.topLeftRadiusX = std::max(0.0f, baseRadius.topLeft.horizontal / maxScale - inset.left);
288-
result.topLeftRadiusY = std::max(0.0f, baseRadius.topLeft.vertical / maxScale - inset.top);
289-
result.topRightRadiusX = std::max(0.0f, baseRadius.topRight.horizontal / maxScale - inset.right);
290-
result.topRightRadiusY = std::max(0.0f, baseRadius.topRight.vertical / maxScale - inset.top);
291-
result.bottomRightRadiusX = std::max(0.0f, baseRadius.bottomRight.horizontal / maxScale - inset.right);
292-
result.bottomRightRadiusY = std::max(0.0f, baseRadius.bottomRight.vertical / maxScale - inset.bottom);
293-
result.bottomLeftRadiusX = std::max(0.0f, baseRadius.bottomLeft.horizontal / maxScale - inset.left);
294-
result.bottomLeftRadiusY = std::max(0.0f, baseRadius.bottomLeft.vertical / maxScale - inset.bottom);
273+
result.topLeftRadiusX = std::max(0.0f, baseRadius.topLeft.horizontal - inset.left);
274+
result.topLeftRadiusY = std::max(0.0f, baseRadius.topLeft.vertical - inset.top);
275+
result.topRightRadiusX = std::max(0.0f, baseRadius.topRight.horizontal - inset.right);
276+
result.topRightRadiusY = std::max(0.0f, baseRadius.topRight.vertical - inset.top);
277+
result.bottomRightRadiusX = std::max(0.0f, baseRadius.bottomRight.horizontal - inset.right);
278+
result.bottomRightRadiusY = std::max(0.0f, baseRadius.bottomRight.vertical - inset.bottom);
279+
result.bottomLeftRadiusX = std::max(0.0f, baseRadius.bottomLeft.horizontal - inset.left);
280+
result.bottomLeftRadiusY = std::max(0.0f, baseRadius.bottomLeft.vertical - inset.bottom);
295281

296282
return result;
297283
}
@@ -473,8 +459,8 @@ void SetBorderLayerProperties(
473459
/*
474460
else
475461
{
476-
SetBorderLayerPropertiesCommon(theme, comContext, layer, shape, borderTexture, textureRect,
477-
anchorPoint, anchorOffset, strokeWidth, borderColor, borderStyle);
462+
SetBorderLayerPropertiesCommon(theme, compContext, layer, shape, borderTexture, textureRect,
463+
anchorPoint, anchorOffset, size, relativeSizeAdjustment, strokeWidth, borderColor, borderStyle);
478464
}
479465
*/
480466
}
@@ -516,11 +502,11 @@ void DrawAllBorderLayers(
516502
spTextures[0], // Target Layer, Source Texture, Target Texture
517503
{0,
518504
0,
519-
borderRadii.topLeft.vertical + borderWidths.left,
520-
borderRadii.topLeft.horizontal + borderWidths.top}, // Texture Left, Top, Width, Height
505+
borderRadii.topLeft.horizontal + borderWidths.left,
506+
borderRadii.topLeft.vertical + borderWidths.top}, // Texture Left, Top, Width, Height
521507
{AnchorPosition::Left, AnchorPosition::Top}, // Layer Anchor Point
522508
{0, 0}, // Layer Anchor Offset
523-
{borderRadii.topLeft.vertical + borderWidths.left, borderRadii.topLeft.horizontal + borderWidths.top}, // size
509+
{borderRadii.topLeft.horizontal + borderWidths.left, borderRadii.topLeft.vertical + borderWidths.top}, // size
524510
{0.0f, 0.0f}, // relativeSize
525511
std::max(borderWidths.left, borderWidths.top),
526512
borderColors.left ? borderColors.left : borderColors.top,
@@ -533,13 +519,13 @@ void DrawAllBorderLayers(
533519
spBorderLayers[1],
534520
shape,
535521
spTextures[1],
536-
{borderRadii.topLeft.vertical + borderWidths.left,
522+
{borderRadii.topLeft.horizontal + borderWidths.left,
537523
0,
538-
textureWidth - (borderRadii.topRight.vertical + borderWidths.right),
524+
textureWidth - (borderRadii.topRight.horizontal + borderWidths.right),
539525
borderWidths.top},
540526
{AnchorPosition::Left, AnchorPosition::Top},
541-
{borderRadii.topLeft.vertical + borderWidths.left, 0},
542-
{-(borderRadii.topLeft.vertical + borderWidths.left + borderRadii.topRight.vertical + borderWidths.right),
527+
{borderRadii.topLeft.horizontal + borderWidths.left, 0},
528+
{-(borderRadii.topLeft.horizontal + borderWidths.left + borderRadii.topRight.horizontal + borderWidths.right),
543529
borderWidths.top}, // size
544530
{1.0f, 0.0f}, // relativeSize
545531
borderWidths.top,
@@ -553,13 +539,13 @@ void DrawAllBorderLayers(
553539
spBorderLayers[2],
554540
shape,
555541
spTextures[2],
556-
{textureWidth - (borderRadii.topRight.vertical + borderWidths.right),
542+
{textureWidth - (borderRadii.topRight.horizontal + borderWidths.right),
557543
0,
558544
textureWidth,
559-
borderRadii.topRight.horizontal + borderWidths.top},
545+
borderRadii.topRight.vertical + borderWidths.top},
560546
{AnchorPosition::Right, AnchorPosition::Top},
561-
{-(borderRadii.topRight.vertical + borderWidths.right), 0},
562-
{borderRadii.topRight.vertical + borderWidths.right, borderRadii.topRight.horizontal + borderWidths.top},
547+
{-(borderRadii.topRight.horizontal + borderWidths.right), 0},
548+
{borderRadii.topRight.horizontal + borderWidths.right, borderRadii.topRight.vertical + borderWidths.top},
563549
{0.0f, 0.0f},
564550
std::max(borderWidths.right, borderWidths.top),
565551
borderColors.right ? borderColors.right : borderColors.top,
@@ -573,14 +559,14 @@ void DrawAllBorderLayers(
573559
shape,
574560
spTextures[3],
575561
{textureWidth - borderWidths.right,
576-
borderWidths.top + borderRadii.topRight.horizontal,
562+
borderWidths.top + borderRadii.topRight.vertical,
577563
textureWidth,
578-
textureHeight - (borderWidths.bottom + borderRadii.bottomRight.horizontal)},
564+
textureHeight - (borderWidths.bottom + borderRadii.bottomRight.vertical)},
579565
{AnchorPosition::Right, AnchorPosition::Top},
580-
{-borderWidths.right, borderWidths.top + borderRadii.topRight.horizontal},
566+
{-borderWidths.right, borderWidths.top + borderRadii.topRight.vertical},
581567
{borderWidths.right,
582-
-(borderWidths.top + borderRadii.topRight.horizontal + borderWidths.bottom +
583-
borderRadii.bottomRight.horizontal)}, // size
568+
-(borderWidths.top + borderRadii.topRight.vertical + borderWidths.bottom +
569+
borderRadii.bottomRight.vertical)}, // size
584570
{0.0f, 1.0f},
585571
borderWidths.right,
586572
borderColors.right,
@@ -593,14 +579,14 @@ void DrawAllBorderLayers(
593579
spBorderLayers[4],
594580
shape,
595581
spTextures[4],
596-
{textureWidth - (borderWidths.right + borderRadii.bottomRight.vertical),
597-
textureHeight - (borderWidths.bottom + borderRadii.bottomRight.horizontal),
582+
{textureWidth - (borderWidths.right + borderRadii.bottomRight.horizontal),
583+
textureHeight - (borderWidths.bottom + borderRadii.bottomRight.vertical),
598584
textureWidth,
599585
textureHeight},
600586
{AnchorPosition::Right, AnchorPosition::Bottom},
601-
{-(borderWidths.right + borderRadii.bottomRight.vertical),
602-
-(borderWidths.bottom + borderRadii.bottomRight.horizontal)},
603-
{borderWidths.right + borderRadii.bottomRight.vertical, borderWidths.bottom + borderRadii.bottomRight.horizontal},
587+
{-(borderWidths.right + borderRadii.bottomRight.horizontal),
588+
-(borderWidths.bottom + borderRadii.bottomRight.vertical)},
589+
{borderWidths.right + borderRadii.bottomRight.horizontal, borderWidths.bottom + borderRadii.bottomRight.vertical},
604590
{0, 0},
605591
std::max(borderWidths.right, borderWidths.bottom),
606592
borderColors.right ? borderColors.right : borderColors.bottom,
@@ -613,13 +599,14 @@ void DrawAllBorderLayers(
613599
spBorderLayers[5],
614600
shape,
615601
spTextures[5],
616-
{borderWidths.left + borderRadii.bottomLeft.vertical,
602+
{borderWidths.left + borderRadii.bottomLeft.horizontal,
617603
textureHeight - borderWidths.bottom,
618-
textureWidth - (borderWidths.right + borderRadii.bottomRight.vertical),
604+
textureWidth - (borderWidths.right + borderRadii.bottomRight.horizontal),
619605
textureHeight},
620606
{AnchorPosition::Left, AnchorPosition::Bottom},
621-
{borderWidths.left + borderRadii.bottomLeft.vertical, -borderWidths.bottom},
622-
{-(borderWidths.right + borderRadii.bottomLeft.vertical + borderWidths.left + borderRadii.bottomRight.vertical),
607+
{borderWidths.left + borderRadii.bottomLeft.horizontal, -borderWidths.bottom},
608+
{-(borderWidths.right + borderRadii.bottomLeft.horizontal + borderWidths.left +
609+
borderRadii.bottomRight.horizontal),
623610
borderWidths.bottom},
624611
{1.0f, 0.0f},
625612
borderWidths.bottom,
@@ -634,12 +621,12 @@ void DrawAllBorderLayers(
634621
shape,
635622
spTextures[6],
636623
{0,
637-
textureHeight - (borderWidths.bottom + borderRadii.bottomLeft.horizontal),
638-
borderWidths.left + borderRadii.bottomLeft.vertical,
624+
textureHeight - (borderWidths.bottom + borderRadii.bottomLeft.vertical),
625+
borderWidths.left + borderRadii.bottomLeft.horizontal,
639626
textureHeight},
640627
{AnchorPosition::Left, AnchorPosition::Bottom},
641-
{0, -(borderWidths.bottom + borderRadii.bottomLeft.horizontal)},
642-
{borderWidths.left + borderRadii.bottomLeft.vertical, borderWidths.bottom + borderRadii.bottomLeft.horizontal},
628+
{0, -(borderWidths.bottom + borderRadii.bottomLeft.vertical)},
629+
{borderWidths.left + borderRadii.bottomLeft.horizontal, borderWidths.bottom + borderRadii.bottomLeft.vertical},
643630
{0, 0},
644631
std::max(borderWidths.left, borderWidths.bottom),
645632
borderColors.left ? borderColors.left : borderColors.bottom,
@@ -653,13 +640,13 @@ void DrawAllBorderLayers(
653640
shape,
654641
spTextures[7],
655642
{0,
656-
borderWidths.top + borderRadii.topLeft.horizontal,
643+
borderWidths.top + borderRadii.topLeft.vertical,
657644
borderWidths.left,
658-
textureHeight - (borderWidths.bottom + borderRadii.bottomLeft.horizontal)},
645+
textureHeight - (borderWidths.bottom + borderRadii.bottomLeft.vertical)},
659646
{AnchorPosition::Left, AnchorPosition::Top},
660-
{0, borderWidths.top + borderRadii.topLeft.horizontal},
647+
{0, borderWidths.top + borderRadii.topLeft.vertical},
661648
{borderWidths.left,
662-
-(borderWidths.top + borderRadii.topLeft.horizontal + borderWidths.bottom + borderRadii.bottomLeft.horizontal)},
649+
-(borderWidths.top + borderRadii.topLeft.vertical + borderWidths.bottom + borderRadii.bottomLeft.vertical)},
663650
{0, 1},
664651
borderWidths.left,
665652
borderColors.left,

0 commit comments

Comments
 (0)