Commit f44f44a8 authored by Gauthier Ambard's avatar Gauthier Ambard Committed by Commit Bot

Stop NTP scrolling when focusing the omnibox

When you focus the omnibox, the scroll of the NTP should be stopped.
If it is not stopped, the focus is immediately lost as scrolling the
NTP unfocuses the omnibox.

Bug: 834277
Cq-Include-Trybots: master.tryserver.chromium.mac:ios-simulator-cronet;master.tryserver.chromium.mac:ios-simulator-full-configs
Change-Id: I452c459d7c9b009afabd487003a3826f304191f5
Reviewed-on: https://chromium-review.googlesource.com/1025695Reviewed-by: default avatarJustin Cohen <justincohen@chromium.org>
Commit-Queue: Gauthier Ambard <gambard@chromium.org>
Cr-Commit-Position: refs/heads/master@{#553138}
parent b4038417
......@@ -106,6 +106,13 @@ initWithCollectionController:
// Add gesture recognizer to collection view when the omnibox is focused.
[self.collectionView addGestureRecognizer:self.tapGestureRecognizer];
if (self.collectionView.decelerating) {
// Stop the scrolling if the scroll view is decelerating to prevent the
// focus to be immediately lost.
[self.collectionView setContentOffset:self.collectionView.contentOffset
animated:NO];
}
CGFloat pinnedOffsetY = [self.headerController pinnedOffsetY];
self.collectionShiftingOffset =
MAX(0, pinnedOffsetY - self.collectionView.contentOffset.y);
......
......@@ -470,7 +470,7 @@ const UIEdgeInsets kSearchBoxStretchInsets = {3, 3, 3, 3};
return [self.logoVendor logoAnimationControllerOwner];
}
#pragma mark - GoogleLandingConsumer
#pragma mark - NTPHomeConsumer
- (void)setLogoIsShowing:(BOOL)logoIsShowing {
_logoIsShowing = logoIsShowing;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment