Chromium Code Reviews| 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..6f341dc971f68a00f1c434bc3bed41d990d7503f 100644 |
| --- a/ios/chrome/browser/ui/tab_switcher/tab_switcher_controller.mm |
| +++ b/ios/chrome/browser/ui/tab_switcher/tab_switcher_controller.mm |
| @@ -568,8 +568,11 @@ enum class SnapshotViewOption { |
| base::WeakNSObject<UIImageView> weakTabScreenshotImageView( |
| tabScreenshotImageView.get()); |
| - if (self.transitionContext.initialTabModel != tabModel || |
| - transitionContextContent.initialSelectedTabIndex != selectedTabIndex) { |
| + if (![self initialTabModelAndTabIDMatchesTabModel:tabModel |
|
jif
2017/03/30 19:50:58
Can you write the code without the "!" (i.e. swap
|
| + tabID:selectedTab.tabId]) { |
| + // If transitioning to a different tab than the one animated in |
| + // from, a new snapshot should be generated instead of using the transition |
| + // context... |
|
jif
2017/03/30 19:50:58
no need for the "..."
|
| tabScreenshotImageView.get().image = |
| [self updateScreenshotForCellIfNeeded:selectedCell tabModel:tabModel]; |
| [selectedTab retrieveSnapshot:^(UIImage* snapshot) { |
| @@ -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]]; |