Commit 99fb6fc3 authored by Robbie Gibson's avatar Robbie Gibson Committed by Commit Bot

[iOS] Scroll selected tab into view when opening the thumb strip

Bug: 1094335
Change-Id: I33ed238b32e77fbb18a54b37a1619287948f4fa5
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2546542Reviewed-by: default avataredchin <edchin@chromium.org>
Commit-Queue: Robbie Gibson <rkgibson@google.com>
Cr-Commit-Position: refs/heads/master@{#828735}
parent 80af9710
......@@ -303,9 +303,13 @@ NSIndexPath* CreateIndexPath(NSInteger index) {
[self animateEmptyStateIn];
return;
}
UICollectionViewScrollPosition scrollPosition =
(self.currentLayout == self.horizontalLayout)
? UICollectionViewScrollPositionCenteredHorizontally
: UICollectionViewScrollPositionTop;
[self.collectionView selectItemAtIndexPath:CreateIndexPath(self.selectedIndex)
animated:NO
scrollPosition:UICollectionViewScrollPositionTop];
scrollPosition:scrollPosition];
// Update the delegate, in case it wasn't set when |items| was populated.
[self.delegate gridViewController:self didChangeItemCount:self.items.count];
[self removeEmptyStateAnimated:NO];
......
......@@ -463,6 +463,7 @@ NSUInteger GetPageIndexFromPage(TabGridPage page) {
0, [self hiddenTopToolbarYTranslation]);
[self gridViewControllerForPage:self.currentPage].gridView.transform =
CGAffineTransformMakeTranslation(0, kThumbStripSlideInHeight);
[self contentWillAppearAnimated:YES];
break;
case ViewRevealState::Peeked:
break;
......@@ -486,6 +487,7 @@ NSUInteger GetPageIndexFromPage(TabGridPage page) {
self.topToolbar.alpha = 0;
[self showPlusSignButtonWithAlpha:1 - gridViewController
.fractionVisibleOfLastItem];
[self contentWillDisappearAnimated:YES];
self.plusSignButton.transform =
CGAffineTransformMakeTranslation(0, kThumbStripSlideInHeight);
break;
......@@ -503,7 +505,6 @@ NSUInteger GetPageIndexFromPage(TabGridPage page) {
self.topToolbar.transform = CGAffineTransformIdentity;
gridViewController.gridView.transform = CGAffineTransformMakeTranslation(
0, self.topToolbar.intrinsicContentSize.height);
[self contentWillAppearAnimated:YES];
self.topToolbar.alpha = 1;
[self hidePlusSignButton];
break;
......
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