From f5d9b5210ec9ed75fadd1a44068dfbf2e73b01a0 Mon Sep 17 00:00:00 2001 From: Valentin Shergin Date: Tue, 18 Jul 2017 14:33:56 -0700 Subject: [PATCH] ScrollView: Couple of unnecessary checks was removed from RCTCustomScrollView Summary: * Now `setFrame:` is called by autoresizing masks, so it is safe. * Nobody calls `setBounds:`, so it is also safe. Reviewed By: javache Differential Revision: D5414441 fbshipit-source-id: 6fc51c7598c4817301db51f627aa1e9840642fec --- React/Views/RCTScrollView.m | 22 ---------------------- 1 file changed, 22 deletions(-) diff --git a/React/Views/RCTScrollView.m b/React/Views/RCTScrollView.m index 2e064602d6c..7e2adeae6c9 100644 --- a/React/Views/RCTScrollView.m +++ b/React/Views/RCTScrollView.m @@ -301,30 +301,8 @@ RCT_NOT_IMPLEMENTED(- (instancetype)init) super.contentOffset = contentOffset; } -static inline BOOL isRectInvalid(CGRect rect) { - return isnan(rect.origin.x) || isinf(rect.origin.x) || - isnan(rect.origin.y) || isinf(rect.origin.y) || - isnan(rect.size.width) || isinf(rect.size.width) || - isnan(rect.size.height) || isinf(rect.size.height); -} - -- (void)setBounds:(CGRect)bounds -{ - if (isRectInvalid(bounds)) { - RCTLogError(@"Attempted to set an invalid bounds to inner scrollview: %@", NSStringFromCGRect(bounds)); - return; - } - - [super setBounds:bounds]; -} - - (void)setFrame:(CGRect)frame { - if (isRectInvalid(frame)) { - RCTLogError(@"Attempted to set an invalid frame to inner scrollview: %@", NSStringFromCGRect(frame)); - return; - } - // Preserving and revalidating `contentOffset`. CGPoint originalOffset = self.contentOffset;