| Index: ios/chrome/browser/ui/tab_switcher/tab_switcher_controller.mm
|
| diff --git a/ios/chrome/browser/ui/tab_switcher/tab_switcher_controller.mm b/ios/chrome/browser/ui/tab_switcher/tab_switcher_controller.mm
|
| index 12db3675405241372ef676ba85877956b4998773..d3fde7a0a09f1988b9a5e1568a4bbc7b550f6d32 100644
|
| --- a/ios/chrome/browser/ui/tab_switcher/tab_switcher_controller.mm
|
| +++ b/ios/chrome/browser/ui/tab_switcher/tab_switcher_controller.mm
|
| @@ -568,16 +568,19 @@ enum class SnapshotViewOption {
|
| base::WeakNSObject<UIImageView> weakTabScreenshotImageView(
|
| tabScreenshotImageView.get());
|
|
|
| - if (self.transitionContext.initialTabModel != tabModel ||
|
| - transitionContextContent.initialSelectedTabIndex != selectedTabIndex) {
|
| + if ([self initialTabModelAndTabIDMatchesTabModel:tabModel
|
| + tabID:selectedTab.tabId]) {
|
| + tabScreenshotImageView.get().image =
|
| + self.transitionContext.tabSnapshotImage;
|
| + } else {
|
| + // If transitioning to a different tab than the one animated in
|
| + // from, a new snapshot should be generated instead of using the transition
|
| + // context
|
| tabScreenshotImageView.get().image =
|
| [self updateScreenshotForCellIfNeeded:selectedCell tabModel:tabModel];
|
| [selectedTab retrieveSnapshot:^(UIImage* snapshot) {
|
| [weakTabScreenshotImageView setImage:snapshot];
|
| }];
|
| - } else {
|
| - tabScreenshotImageView.get().image =
|
| - self.transitionContext.tabSnapshotImage;
|
| }
|
|
|
| const CGSize tabScreenshotImageSize = tabScreenshotImageView.get().image.size;
|
| @@ -716,6 +719,14 @@ enum class SnapshotViewOption {
|
| completion:completionBlock];
|
| }
|
|
|
| +- (BOOL)initialTabModelAndTabIDMatchesTabModel:(nonnull TabModel*)tabModel
|
| + tabID:(nonnull NSString*)tabID {
|
| + TabModel* initialTabModel = self.transitionContext.initialTabModel;
|
| + NSString* initialTabID =
|
| + [self transitionContextContentForTabModel:initialTabModel].initialTabID;
|
| + return initialTabModel == tabModel && [initialTabID isEqualToString:tabID];
|
| +}
|
| +
|
| - (void)updateLocalPanelsCells {
|
| auto mainTabPanel =
|
| [self panelControllerForTabModel:[_tabSwitcherModel mainTabModel]];
|
|
|