Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(236)

Unified Diff: ios/chrome/browser/ui/tab_switcher/tab_switcher_controller.mm

Issue 2776083003: Use correct snapshot for the tab transition animation on iPad (Closed)
Patch Set: Formatting changes Created 3 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | ios/chrome/browser/ui/tab_switcher/tab_switcher_transition_context.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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]];
« no previous file with comments | « no previous file | ios/chrome/browser/ui/tab_switcher/tab_switcher_transition_context.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698