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

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 change to keep to max number of columns 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..0a701cc66fcefb370b017c753f248540c0dc4b00 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 initialTabModelAndTabDifferFromTabModel:tabModel
+ andTabID:selectedTab.tabId]) {
marq (ping after 24h) 2017/03/30 06:17:45 Align colons.
+ // If we're transitioning to a different tab than the one we animated in
marq (ping after 24h) 2017/03/30 06:17:45 Avoid using "we" in comments; it can be ambiguous.
+ // from, generate a new snapshot instead of using the transition
+ // context...
tabScreenshotImageView.get().image =
[self updateScreenshotForCellIfNeeded:selectedCell tabModel:tabModel];
[selectedTab retrieveSnapshot:^(UIImage* snapshot) {
@@ -716,6 +719,17 @@ enum class SnapshotViewOption {
completion:completionBlock];
}
+- (BOOL)initialTabModelAndTabDifferFromTabModel:(nonnull TabModel*)tabModel
+ andTabID:(nonnull NSString*)tabID {
marq (ping after 24h) 2017/03/30 06:17:45 Align colons. Prefer not to use 'and' to join met
+ BOOL differ = NO;
marq (ping after 24h) 2017/03/30 06:17:44 'differs' ? But see below.
+ TabModel *initialTabModel = self.transitionContext.initialTabModel;
marq (ping after 24h) 2017/03/30 06:17:44 Chromium style is to have the pointer operator adh
+ NSString* initialTabID = [self transitionContextContentForTabModel:
+ initialTabModel].initialTabID;
+ differ = initialTabModel != tabModel ||
+ [initialTabID isEqualToString:tabID] == NO;
+ return differ;
marq (ping after 24h) 2017/03/30 06:17:45 Instead of using the intermediate variable, it's c
marq (ping after 24h) 2017/03/30 09:20:06 And, (as I should have realized), we can apply De
+}
+
- (void)updateLocalPanelsCells {
auto mainTabPanel =
[self panelControllerForTabModel:[_tabSwitcherModel mainTabModel]];

Powered by Google App Engine
This is Rietveld 408576698