Index: ios/chrome/browser/ui/overscroll_actions/overscroll_actions_controller.mm |
diff --git a/ios/chrome/browser/ui/overscroll_actions/overscroll_actions_controller.mm b/ios/chrome/browser/ui/overscroll_actions/overscroll_actions_controller.mm |
index 09d8d61d3f123c62b8f96143cd7f5945e4e973b9..5539e74936439ff56cb26194df2f34fa005398c3 100644 |
--- a/ios/chrome/browser/ui/overscroll_actions/overscroll_actions_controller.mm |
+++ b/ios/chrome/browser/ui/overscroll_actions/overscroll_actions_controller.mm |
@@ -196,6 +196,8 @@ NSString* const kOverscollActionsDidEnd = @"OverscollActionsDidStop"; |
// Setup/tearDown methods are used to register values when the delegate is set. |
- (void)tearDown; |
- (void)setup; |
+// Resets scroll view's top content inset to |self.initialContentInset|. |
+- (void)resetScrollViewTopContentInset; |
// Access the headerView from the delegate. |
- (UIView<RelaxedBoundsConstraintsHitTestSupport>*)headerView; |
// Locking/unlocking methods used to disable/enable the overscroll actions |
@@ -381,8 +383,7 @@ NSString* const kOverscollActionsDidEnd = @"OverscollActionsDidStop"; |
// restored to initial value. |
if (contentOffset.y >= 0 || |
self.overscrollState == ios_internal::OverscrollState::NO_PULL_STARTED) { |
- [self setScrollViewContentInset:UIEdgeInsetsMake(self.initialContentInset, |
- 0, 0, 0)]; |
+ [self resetScrollViewTopContentInset]; |
} |
[self triggerActionIfNeeded]; |
@@ -590,6 +591,12 @@ NSString* const kOverscollActionsDidEnd = @"OverscollActionsDidStop"; |
[_webViewScrollViewProxy setContentInset:contentInset]; |
} |
+- (void)resetScrollViewTopContentInset { |
+ UIEdgeInsets contentInset = self.scrollView.contentInset; |
+ contentInset.top = self.initialContentInset; |
+ [self setScrollViewContentInset:contentInset]; |
+} |
+ |
- (UIView<RelaxedBoundsConstraintsHitTestSupport>*)headerView { |
return [self.delegate headerView]; |
} |