Commit c84e17c5 authored by Robbie Gibson's avatar Robbie Gibson Committed by Commit Bot

[iOS][Thumb Strip] Scroll newly added tabs into view

This CL scrolls the grid view controller to a newly inserted item when
it is inserted.

Bug: 1094335
Change-Id: I38f497ce7b37eeacfad92ef17f8f9d469d618d62
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2534912Reviewed-by: default avataredchin <edchin@chromium.org>
Commit-Queue: Robbie Gibson <rkgibson@google.com>
Cr-Commit-Position: refs/heads/master@{#827756}
parent 924cf20a
......@@ -658,10 +658,14 @@ NSIndexPath* CreateIndexPath(NSInteger index) {
deselectItemAtIndexPath:CreateIndexPath([self
indexOfItemWithID:previouslySelectedItemID])
animated:YES];
UICollectionViewScrollPosition scrollPosition =
(self.currentLayout == self.horizontalLayout)
? UICollectionViewScrollPositionCenteredHorizontally
: UICollectionViewScrollPositionNone;
[self.collectionView
selectItemAtIndexPath:CreateIndexPath(self.selectedIndex)
animated:YES
scrollPosition:UICollectionViewScrollPositionNone];
scrollPosition:scrollPosition];
[self.delegate gridViewController:self didChangeItemCount:self.items.count];
[self updateFractionVisibleOfLastItem];
};
......
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