diff --git a/packages/react-native/React/Fabric/RCTCancelledTouches+Internal.h b/packages/react-native/React/Fabric/RCTCancelledTouches+Internal.h new file mode 100644 index 00000000000..37d0da9d7e5 --- /dev/null +++ b/packages/react-native/React/Fabric/RCTCancelledTouches+Internal.h @@ -0,0 +1,118 @@ +/* + * Copyright (c) Meta Platforms, Inc. and affiliates. + * + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. + */ + +#pragma once + +#import + +#import +#import + +namespace facebook::react { + +/* + * The touches that a touch or pointer handler cancelled for JavaScript and that have not ended. + * UIKit keeps reporting them. The handler passes the touches of each event through this class, + * which returns the ones to report to JavaScript. + */ +class RCTCancelledTouches { + public: + /* + * Remembers `touches`, which began inside `view`, as cancelled. + */ + void add(NSSet *touches, UIView *view) + { + for (UITouch *touch in touches) { + touches_.insert(touch); + } + view_ = view; + } + + /* + * Returns the touches of a `touchesBegan:` to report. A touch that begins inside the view whose + * touches were cancelled last, while a remembered touch is still down, is part of the gesture + * that the view took: it is remembered too and not returned. + */ + NSSet *touchesToReportBegan(NSSet *touches) + { + UIView *view = view_; + if (touches_.empty() || view == nil) { + return touches; + } + + NSMutableSet *remainingTouches = [NSMutableSet setWithCapacity:touches.count]; + for (UITouch *touch in touches) { + if ([touch.view isDescendantOfView:view]) { + touches_.insert(touch); + } else { + [remainingTouches addObject:touch]; + } + } + return remainingTouches; + } + + /* + * Returns the touches of a `touchesMoved:` to report: those that are not remembered. + */ + NSSet *touchesToReportMoved(NSSet *touches) + { + return touchesNotCancelled(touches, false); + } + + /* + * Returns the touches of a `touchesEnded:` or a `touchesCancelled:` to report: those that are + * not remembered. Forgets the remembered ones, which UIKit reports for the last time. + */ + NSSet *touchesToReportEndedOrCancelled(NSSet *touches) + { + return touchesNotCancelled(touches, true); + } + + /* + * Forgets the remembered touches. The view is kept: it matters only while a touch is remembered. + */ + void clear() + { + touches_.clear(); + } + + private: + // `std::hash` cannot hash an `__unsafe_unretained` pointer + struct TouchHasher { + std::size_t operator()(__unsafe_unretained UITouch *touch) const + { + return reinterpret_cast(touch); + } + }; + + NSSet *touchesNotCancelled(NSSet *touches, bool forgetCancelledTouches) + { + if (touches_.empty()) { + return touches; + } + + NSMutableSet *remainingTouches = [NSMutableSet setWithCapacity:touches.count]; + for (UITouch *touch in touches) { + auto iterator = touches_.find(touch); + if (iterator == touches_.end()) { + [remainingTouches addObject:touch]; + } else if (forgetCancelledTouches) { + touches_.erase(iterator); + } + } + return remainingTouches; + } + + std::unordered_set<__unsafe_unretained UITouch *, TouchHasher> touches_; + + /* + * The view whose touches were cancelled last. + */ + __weak UIView *view_; +}; + +} // namespace facebook::react diff --git a/packages/react-native/React/Fabric/RCTSurfacePointerHandler.mm b/packages/react-native/React/Fabric/RCTSurfacePointerHandler.mm index aa685b7d351..3a8797683ed 100644 --- a/packages/react-native/React/Fabric/RCTSurfacePointerHandler.mm +++ b/packages/react-native/React/Fabric/RCTSurfacePointerHandler.mm @@ -12,6 +12,7 @@ #import #import +#import "RCTCancelledTouches+Internal.h" #import "RCTConversions.h" #import "RCTTouchableComponentViewProtocol.h" @@ -443,15 +444,9 @@ @implementation RCTSurfacePointerHandler { _activePointers; /* - * The touches whose pointers `cancelPointersInView:` cancelled and that have not ended. - * UIKit keeps reporting them, and their events are dropped. + * The touches whose pointers are withheld from JavaScript after `cancelPointersInView:`. */ - std::unordered_set<__unsafe_unretained UITouch *, PointerHasher<__unsafe_unretained UITouch *>> _cancelledTouches; - - /* - * The view whose touches were cancelled last. - */ - __weak UIView *_cancelledTouchesView; + RCTCancelledTouches _cancelledTouches; /* * We hold the view weakly to prevent a retain cycle. @@ -669,7 +664,7 @@ - (void)touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event { [super touchesBegan:touches withEvent:event]; - touches = [self _touchesWithoutTouchesBeganInCancelledView:touches]; + touches = _cancelledTouches.touchesToReportBegan(touches); [self _registerTouches:touches withEvent:event]; [self _dispatchActivePointers:[self _activePointersFromTouches:touches] eventType:RCTPointerEventTypeStart]; @@ -684,7 +679,7 @@ - (void)touchesMoved:(NSSet *)touches withEvent:(UIEvent *)event { [super touchesMoved:touches withEvent:event]; - touches = [self _touchesWithoutCancelledTouches:touches forgettingThem:NO]; + touches = _cancelledTouches.touchesToReportMoved(touches); [self _updateTouches:touches withEvent:event]; [self _dispatchActivePointers:[self _activePointersFromTouches:touches] eventType:RCTPointerEventTypeMove]; @@ -695,7 +690,7 @@ - (void)touchesEnded:(NSSet *)touches withEvent:(UIEvent *)event { [super touchesEnded:touches withEvent:event]; - touches = [self _touchesWithoutCancelledTouches:touches forgettingThem:YES]; + touches = _cancelledTouches.touchesToReportEndedOrCancelled(touches); [self _updateTouches:touches withEvent:event]; [self _dispatchActivePointers:[self _activePointersFromTouches:touches] eventType:RCTPointerEventTypeEnd]; [self _unregisterTouches:touches]; @@ -711,7 +706,7 @@ - (void)touchesCancelled:(NSSet *)touches withEvent:(UIEvent *)event { [super touchesCancelled:touches withEvent:event]; - touches = [self _touchesWithoutCancelledTouches:touches forgettingThem:YES]; + touches = _cancelledTouches.touchesToReportEndedOrCancelled(touches); [self _updateTouches:touches withEvent:event]; [self _dispatchActivePointers:[self _activePointersFromTouches:touches] eventType:RCTPointerEventTypeCancel]; [self _unregisterTouches:touches]; @@ -762,51 +757,8 @@ - (void)cancelPointersInView:(UIView *)view if (touches.count > 0) { [self _dispatchActivePointers:[self _activePointersFromTouches:touches] eventType:RCTPointerEventTypeCancel]; [self _unregisterTouches:touches]; - for (UITouch *touch in touches) { - _cancelledTouches.insert(touch); - } - _cancelledTouchesView = view; - } -} - -/* - * A touch that begins inside the view whose touches were cancelled, while one of those touches is still down, - * is part of the gesture that the view took. JavaScript is not told about it. Returns the other touches. - */ -- (NSSet *)_touchesWithoutTouchesBeganInCancelledView:(NSSet *)touches -{ - UIView *cancelledTouchesView = _cancelledTouchesView; - if (_cancelledTouches.empty() || cancelledTouchesView == nil) { - return touches; - } - - NSMutableSet *remainingTouches = [NSMutableSet setWithCapacity:touches.count]; - for (UITouch *touch in touches) { - if ([touch.view isDescendantOfView:cancelledTouchesView]) { - _cancelledTouches.insert(touch); - } else { - [remainingTouches addObject:touch]; - } - } - return remainingTouches; -} - -- (NSSet *)_touchesWithoutCancelledTouches:(NSSet *)touches forgettingThem:(BOOL)forgettingThem -{ - if (_cancelledTouches.empty()) { - return touches; - } - - NSMutableSet *remainingTouches = [NSMutableSet setWithCapacity:touches.count]; - for (UITouch *touch in touches) { - auto iterator = _cancelledTouches.find(touch); - if (iterator == _cancelledTouches.end()) { - [remainingTouches addObject:touch]; - } else if (forgettingThem) { - _cancelledTouches.erase(iterator); - } + _cancelledTouches.add(touches, view); } - return remainingTouches; } #pragma mark - Hover callbacks diff --git a/packages/react-native/React/Fabric/RCTSurfaceTouchHandler.mm b/packages/react-native/React/Fabric/RCTSurfaceTouchHandler.mm index fe2cb22694d..11113715cab 100644 --- a/packages/react-native/React/Fabric/RCTSurfaceTouchHandler.mm +++ b/packages/react-native/React/Fabric/RCTSurfaceTouchHandler.mm @@ -12,6 +12,7 @@ #import #import +#import "RCTCancelledTouches+Internal.h" #import "RCTConversions.h" #import "RCTSurfacePointerHandler+Internal.h" #import "RCTTouchableComponentViewProtocol.h" @@ -138,15 +139,9 @@ @implementation RCTSurfaceTouchHandler { _activeTouches; /* - * The touches that `cancelTouchesInView:` cancelled and that have not ended. - * UIKit keeps reporting them, and their events are dropped. + * The touches withheld from JavaScript after `cancelTouchesInView:`. */ - std::unordered_set<__unsafe_unretained UITouch *, PointerHasher<__unsafe_unretained UITouch *>> _cancelledTouches; - - /* - * The view whose touches were cancelled last. - */ - __weak UIView *_cancelledTouchesView; + RCTCancelledTouches _cancelledTouches; /* * We hold the view weakly to prevent a retain cycle. @@ -319,7 +314,7 @@ - (void)touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event { [super touchesBegan:touches withEvent:event]; - touches = [self _touchesWithoutTouchesBeganInCancelledView:touches]; + touches = _cancelledTouches.touchesToReportBegan(touches); [self _registerTouches:touches]; [self _dispatchActiveTouches:[self _activeTouchesFromTouches:touches] eventType:RCTTouchEventTypeTouchStart]; @@ -334,7 +329,7 @@ - (void)touchesMoved:(NSSet *)touches withEvent:(UIEvent *)event { [super touchesMoved:touches withEvent:event]; - touches = [self _touchesWithoutCancelledTouches:touches forgettingThem:NO]; + touches = _cancelledTouches.touchesToReportMoved(touches); [self _updateTouches:touches]; [self _dispatchActiveTouches:[self _activeTouchesFromTouches:touches] eventType:RCTTouchEventTypeTouchMove]; @@ -345,7 +340,7 @@ - (void)touchesEnded:(NSSet *)touches withEvent:(UIEvent *)event { [super touchesEnded:touches withEvent:event]; - touches = [self _touchesWithoutCancelledTouches:touches forgettingThem:YES]; + touches = _cancelledTouches.touchesToReportEndedOrCancelled(touches); [self _updateTouches:touches]; [self _dispatchActiveTouches:[self _activeTouchesFromTouches:touches] eventType:RCTTouchEventTypeTouchEnd]; [self _unregisterTouches:touches]; @@ -361,7 +356,7 @@ - (void)touchesCancelled:(NSSet *)touches withEvent:(UIEvent *)event { [super touchesCancelled:touches withEvent:event]; - touches = [self _touchesWithoutCancelledTouches:touches forgettingThem:YES]; + touches = _cancelledTouches.touchesToReportEndedOrCancelled(touches); [self _updateTouches:touches]; [self _dispatchActiveTouches:[self _activeTouchesFromTouches:touches] eventType:RCTTouchEventTypeTouchCancel]; [self _unregisterTouches:touches]; @@ -440,55 +435,12 @@ - (void)cancelTouchesInView:(UIView *)view if (touches.count > 0) { [self _dispatchActiveTouches:[self _activeTouchesFromTouches:touches] eventType:RCTTouchEventTypeTouchCancel]; [self _unregisterTouches:touches]; - for (UITouch *touch in touches) { - _cancelledTouches.insert(touch); - } - _cancelledTouchesView = view; + _cancelledTouches.add(touches, view); } [_pointerHandler cancelPointersInView:view]; } -/* - * A touch that begins inside the view whose touches were cancelled, while one of those touches is still down, - * is part of the gesture that the view took. JavaScript is not told about it. Returns the other touches. - */ -- (NSSet *)_touchesWithoutTouchesBeganInCancelledView:(NSSet *)touches -{ - UIView *cancelledTouchesView = _cancelledTouchesView; - if (_cancelledTouches.empty() || cancelledTouchesView == nil) { - return touches; - } - - NSMutableSet *remainingTouches = [NSMutableSet setWithCapacity:touches.count]; - for (UITouch *touch in touches) { - if ([touch.view isDescendantOfView:cancelledTouchesView]) { - _cancelledTouches.insert(touch); - } else { - [remainingTouches addObject:touch]; - } - } - return remainingTouches; -} - -- (NSSet *)_touchesWithoutCancelledTouches:(NSSet *)touches forgettingThem:(BOOL)forgettingThem -{ - if (_cancelledTouches.empty()) { - return touches; - } - - NSMutableSet *remainingTouches = [NSMutableSet setWithCapacity:touches.count]; - for (UITouch *touch in touches) { - auto iterator = _cancelledTouches.find(touch); - if (iterator == _cancelledTouches.end()) { - [remainingTouches addObject:touch]; - } else if (forgettingThem) { - _cancelledTouches.erase(iterator); - } - } - return remainingTouches; -} - - (void)_cancelTouches { [self setEnabled:NO]; diff --git a/packages/react-native/React/Tests/Mounting/RCTScrollViewComponentViewTests.mm b/packages/react-native/React/Tests/Mounting/RCTScrollViewComponentViewTests.mm index 6679ddd18f8..e77954328a3 100644 --- a/packages/react-native/React/Tests/Mounting/RCTScrollViewComponentViewTests.mm +++ b/packages/react-native/React/Tests/Mounting/RCTScrollViewComponentViewTests.mm @@ -5,13 +5,17 @@ * LICENSE file in the root directory of this source tree. */ +#import +#import #import #import #import #import +#import #import #import #import +#import #import #import #import @@ -197,9 +201,11 @@ void flushQueuedState() } // namespace -// A view that takes touches as a component view does and records the touch events sent to it. +// A view that takes touches as a component view does and records the touch and pointer events sent to it. @interface RCTTouchRecordingView : UIView @property (nonatomic, readonly) NSArray *eventTypes; +@property (nonatomic, readonly) NSArray *touchEventTypes; +@property (nonatomic, readonly) NSArray *pointerEventTypes; @end @implementation RCTTouchRecordingView { @@ -216,12 +222,26 @@ - (SharedTouchEventEmitter)touchEventEmitterAtPoint:(CGPoint)point return [_recorder.eventTypes copy]; } +- (NSArray *)touchEventTypes +{ + return [_recorder.eventTypes + filteredArrayUsingPredicate:[NSPredicate predicateWithFormat:@"SELF BEGINSWITH 'topTouch'"]]; +} + +- (NSArray *)pointerEventTypes +{ + return [_recorder.eventTypes + filteredArrayUsingPredicate:[NSPredicate predicateWithFormat:@"NOT (SELF BEGINSWITH 'topTouch')"]]; +} + @end -// A touch on a given view. `RCTSurfaceTouchHandler` reads only what is overridden here. +// A touch on a given view. The touch and pointer handlers read only what is overridden here. @interface RCTTestTouch : UITouch @property (nonatomic, strong) UIView *testView; @property (nonatomic, assign) UITouchPhase testPhase; +// In window coordinates. The pointer handler sends a pointer's events to the view at its location. +@property (nonatomic, assign) CGPoint testLocation; @end @implementation RCTTestTouch @@ -246,7 +266,27 @@ - (UITouchPhase)phase - (CGPoint)locationInView:(UIView *)view { - return CGPointZero; + return [view convertPoint:_testLocation fromView:nil]; +} + +- (UITouchType)type +{ + return UITouchTypeDirect; +} + +- (CGFloat)majorRadius +{ + return 0; +} + +- (CGFloat)altitudeAngle +{ + return M_PI_2; +} + +- (CGFloat)azimuthAngleInView:(UIView *)view +{ + return 0; } - (NSTimeInterval)timestamp @@ -277,8 +317,42 @@ @implementation RCTTestTouchEvent return _testTouches; } +- (UIKeyModifierFlags)modifierFlags +{ + return 0; +} + @end +// Delivers touches to the touch and pointer handlers by their phase, as UIKit does to a view's gesture recognizers. +static void RCTDeliverTestTouches( + NSArray *handlers, + NSArray *touches, + UITouchPhase phase, + UIEvent *event) +{ + for (RCTTestTouch *touch in touches) { + touch.testPhase = phase; + } + NSSet *touchSet = [NSSet setWithArray:touches]; + for (UIGestureRecognizer *handler in handlers) { + switch (phase) { + case UITouchPhaseBegan: + [handler touchesBegan:touchSet withEvent:event]; + break; + case UITouchPhaseMoved: + [handler touchesMoved:touchSet withEvent:event]; + break; + case UITouchPhaseEnded: + [handler touchesEnded:touchSet withEvent:event]; + break; + default: + [handler touchesCancelled:touchSet withEvent:event]; + break; + } + } +} + @interface RCTScrollViewComponentView (Tests) - (void)_keyboardWillChangeFrame:(NSNotification *)notification; @end @@ -463,6 +537,124 @@ - (void)testDragUnderScrollViewJSResponderCancelsOnlyTheTouchesInsideTheScrollVi window.windowScene = nil; } +- (void)testDragUnderScrollViewJSResponderCancelsOnlyThePointersInsideTheScrollView +{ + BOOL previousDispatchW3CPointerEvents = RCTGetDispatchW3CPointerEvents(); + RCTSetDispatchW3CPointerEvents(YES); + // The pointer handler asserts when UIKit reports a touch it does not know. Where assertions raise, the + // exception fails the test; the count fails it where they only report. + __block NSUInteger assertionCount = 0; + RCTAssertFunction previousAssertFunction = RCTGetAssertFunction(); + RCTSetAssertFunction( + ^(NSString *condition, NSString *fileName, NSNumber *lineNumber, NSString *function, NSString *message) { + assertionCount++; + }); + // The pointer handler finds a pointer's target by hit-testing its view. A hidden window has no target, and a + // scroll view looks for one in its container view. + UIWindow *window = [[UIWindow alloc] initWithFrame:CGRectMake(0, 0, 100, 100)]; + [self addTeardownBlock:^{ + RCTSetDispatchW3CPointerEvents(previousDispatchW3CPointerEvents); + RCTSetAssertFunction(previousAssertFunction); + // Take the window out of its scene, where UIKit would keep laying it out + window.windowScene = nil; + }]; + UIView *root = [[UIView alloc] initWithFrame:window.bounds]; + [window addSubview:root]; + RCTSurfaceTouchHandler *touchHandler = [RCTSurfaceTouchHandler new]; + [touchHandler attachToView:root]; + NSUInteger pointerHandlerIndex = [root.gestureRecognizers + indexOfObjectPassingTest:^(UIGestureRecognizer *recognizer, NSUInteger index, BOOL *stop) { + return [recognizer isKindOfClass:[RCTSurfacePointerHandler class]]; + }]; + XCTAssertNotEqual(pointerHandlerIndex, (NSUInteger)NSNotFound); + NSArray *handlers = @[ touchHandler, root.gestureRecognizers[pointerHandlerIndex] ]; + + RCTScrollViewComponentView *responder = [[RCTScrollViewComponentView alloc] initWithFrame:root.bounds]; + [root addSubview:responder]; + RCTTouchRecordingView *outside = [[RCTTouchRecordingView alloc] initWithFrame:CGRectMake(0, 50, 100, 50)]; + [responder.containerView addSubview:outside]; + RCTScrollViewComponentView *scrollView = [[RCTScrollViewComponentView alloc] initWithFrame:CGRectMake(0, 0, 100, 50)]; + [responder.containerView addSubview:scrollView]; + RCTTouchRecordingView *inside = [[RCTTouchRecordingView alloc] initWithFrame:scrollView.bounds]; + [scrollView.containerView addSubview:inside]; + [responder setIsJSResponder:YES]; + + // The first pointer down is the primary one + RCTTestTouch *insideTouch = [RCTTestTouch touchOnView:inside]; + insideTouch.testLocation = CGPointMake(50, 25); + RCTTestTouch *outsideTouch = [RCTTestTouch touchOnView:outside]; + outsideTouch.testLocation = CGPointMake(50, 75); + RCTTestTouchEvent *event = [RCTTestTouchEvent new]; + event.testTouches = [NSSet setWithObjects:insideTouch, outsideTouch, nil]; + RCTDeliverTestTouches(handlers, @[ insideTouch ], UITouchPhaseBegan, event); + RCTDeliverTestTouches(handlers, @[ outsideTouch ], UITouchPhaseBegan, event); + + [(id)scrollView scrollViewWillBeginDragging:scrollView.scrollView]; + XCTAssertEqualObjects(inside.pointerEventTypes, (@[ @"topPointerDown", @"topPointerCancel" ])); + XCTAssertEqualObjects(outside.pointerEventTypes, (@[ @"topPointerDown" ])); + + // A finger that lands inside the scroll view during its gesture is not reported to JavaScript + RCTTestTouch *lateTouch = [RCTTestTouch touchOnView:inside]; + lateTouch.testLocation = insideTouch.testLocation; + RCTTestTouchEvent *lateEvent = [RCTTestTouchEvent new]; + lateEvent.testTouches = [NSSet setWithObjects:insideTouch, outsideTouch, lateTouch, nil]; + RCTDeliverTestTouches(handlers, @[ lateTouch ], UITouchPhaseBegan, lateEvent); + RCTDeliverTestTouches(handlers, @[ lateTouch ], UITouchPhaseCancelled, lateEvent); + XCTAssertEqualObjects(inside.pointerEventTypes, (@[ @"topPointerDown", @"topPointerCancel" ])); + + // UIKit keeps reporting the cancelled touch; only the other pointer reaches JavaScript + RCTDeliverTestTouches(handlers, @[ insideTouch, outsideTouch ], UITouchPhaseMoved, event); + RCTDeliverTestTouches(handlers, @[ insideTouch, outsideTouch ], UITouchPhaseEnded, event); + XCTAssertEqualObjects(inside.pointerEventTypes, (@[ @"topPointerDown", @"topPointerCancel" ])); + XCTAssertEqualObjects(outside.pointerEventTypes, (@[ @"topPointerDown", @"topPointerMove", @"topPointerUp" ])); + + // The next touch inside the scroll view is delivered as usual, as the primary pointer, which clicks + RCTTestTouch *nextTouch = [RCTTestTouch touchOnView:inside]; + nextTouch.testLocation = insideTouch.testLocation; + event.testTouches = [NSSet setWithObject:nextTouch]; + RCTDeliverTestTouches(handlers, @[ nextTouch ], UITouchPhaseBegan, event); + RCTDeliverTestTouches(handlers, @[ nextTouch ], UITouchPhaseEnded, event); + XCTAssertEqualObjects( + inside.pointerEventTypes, + (@[ @"topPointerDown", @"topPointerCancel", @"topPointerDown", @"topPointerUp", @"topClick" ])); + + // UIKit resets a handler when its gesture is over and reports that gesture's touches no more, so a reset + // forgets the cancelled touches, and a touch inside the scroll view is delivered again + RCTTestTouch *heldTouch = [RCTTestTouch touchOnView:inside]; + heldTouch.testLocation = insideTouch.testLocation; + event.testTouches = [NSSet setWithObject:heldTouch]; + RCTDeliverTestTouches(handlers, @[ heldTouch ], UITouchPhaseBegan, event); + [(id)scrollView scrollViewWillBeginDragging:scrollView.scrollView]; + for (UIGestureRecognizer *handler in handlers) { + [handler reset]; + } + RCTTestTouch *touchAfterReset = [RCTTestTouch touchOnView:inside]; + touchAfterReset.testLocation = insideTouch.testLocation; + event.testTouches = [NSSet setWithObject:touchAfterReset]; + RCTDeliverTestTouches(handlers, @[ touchAfterReset ], UITouchPhaseBegan, event); + XCTAssertEqualObjects(inside.touchEventTypes, (@[ + @"topTouchStart", + @"topTouchCancel", + @"topTouchStart", + @"topTouchEnd", + @"topTouchStart", + @"topTouchCancel", + @"topTouchStart" + ])); + XCTAssertEqualObjects(inside.pointerEventTypes, (@[ + @"topPointerDown", + @"topPointerCancel", + @"topPointerDown", + @"topPointerUp", + @"topClick", + @"topPointerDown", + @"topPointerCancel", + @"topPointerDown" + ])); + + XCTAssertEqual(assertionCount, 0u); +} + // XCTest assertion macros use variadic reporting and catch framework exceptions by value. // NOLINTBEGIN(cppcoreguidelines-pro-type-vararg, misc-throw-by-value-catch-by-reference) - (void)testSafeAreaCorrectionPreservesPullToRefreshInset