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

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 and other feedback 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
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]];

Powered by Google App Engine
This is Rietveld 408576698