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) { ...@@ -303,9 +303,13 @@ NSIndexPath* CreateIndexPath(NSInteger index) {
[self animateEmptyStateIn]; [self animateEmptyStateIn];
return; return;
} }
UICollectionViewScrollPosition scrollPosition =
(self.currentLayout == self.horizontalLayout)
? UICollectionViewScrollPositionCenteredHorizontally
: UICollectionViewScrollPositionTop;
[self.collectionView selectItemAtIndexPath:CreateIndexPath(self.selectedIndex) [self.collectionView selectItemAtIndexPath:CreateIndexPath(self.selectedIndex)
animated:NO animated:NO
scrollPosition:UICollectionViewScrollPositionTop]; scrollPosition:scrollPosition];
// Update the delegate, in case it wasn't set when |items| was populated. // Update the delegate, in case it wasn't set when |items| was populated.
[self.delegate gridViewController:self didChangeItemCount:self.items.count]; [self.delegate gridViewController:self didChangeItemCount:self.items.count];
[self removeEmptyStateAnimated:NO]; [self removeEmptyStateAnimated:NO];
......
...@@ -463,6 +463,7 @@ NSUInteger GetPageIndexFromPage(TabGridPage page) { ...@@ -463,6 +463,7 @@ NSUInteger GetPageIndexFromPage(TabGridPage page) {
0, [self hiddenTopToolbarYTranslation]); 0, [self hiddenTopToolbarYTranslation]);
[self gridViewControllerForPage:self.currentPage].gridView.transform = [self gridViewControllerForPage:self.currentPage].gridView.transform =
CGAffineTransformMakeTranslation(0, kThumbStripSlideInHeight); CGAffineTransformMakeTranslation(0, kThumbStripSlideInHeight);
[self contentWillAppearAnimated:YES];
break; break;
case ViewRevealState::Peeked: case ViewRevealState::Peeked:
break; break;
...@@ -486,6 +487,7 @@ NSUInteger GetPageIndexFromPage(TabGridPage page) { ...@@ -486,6 +487,7 @@ NSUInteger GetPageIndexFromPage(TabGridPage page) {
self.topToolbar.alpha = 0; self.topToolbar.alpha = 0;
[self showPlusSignButtonWithAlpha:1 - gridViewController [self showPlusSignButtonWithAlpha:1 - gridViewController
.fractionVisibleOfLastItem]; .fractionVisibleOfLastItem];
[self contentWillDisappearAnimated:YES];
self.plusSignButton.transform = self.plusSignButton.transform =
CGAffineTransformMakeTranslation(0, kThumbStripSlideInHeight); CGAffineTransformMakeTranslation(0, kThumbStripSlideInHeight);
break; break;
...@@ -503,7 +505,6 @@ NSUInteger GetPageIndexFromPage(TabGridPage page) { ...@@ -503,7 +505,6 @@ NSUInteger GetPageIndexFromPage(TabGridPage page) {
self.topToolbar.transform = CGAffineTransformIdentity; self.topToolbar.transform = CGAffineTransformIdentity;
gridViewController.gridView.transform = CGAffineTransformMakeTranslation( gridViewController.gridView.transform = CGAffineTransformMakeTranslation(
0, self.topToolbar.intrinsicContentSize.height); 0, self.topToolbar.intrinsicContentSize.height);
[self contentWillAppearAnimated:YES];
self.topToolbar.alpha = 1; self.topToolbar.alpha = 1;
[self hidePlusSignButton]; [self hidePlusSignButton];
break; 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