Commit 991b0c24 authored by Eugene But's avatar Eugene But Committed by Commit Bot

Fix Download Manager UI presentation during side swipe tab switching.

crbug.com/819416 was happening, because WebStateObserver::WasShown was
called before the animation was completed. This CL moves actual tab
switch operation to animation completion block to fix WasShown timing.
However it is necessary to send WebStateObserver::WasHidden before
animation is started, so this cl adds WebState::WasHidden call if the
tab was actually changed.

Bug: 819416
Cq-Include-Trybots: master.tryserver.chromium.mac:ios-simulator-cronet;master.tryserver.chromium.mac:ios-simulator-full-configs
Change-Id: Ic45ad02e76674a4bd861fe2626f7d3c32aea3a11
Reviewed-on: https://chromium-review.googlesource.com/953075Reviewed-by: default avatarJustin Cohen <justincohen@chromium.org>
Commit-Queue: Eugene But <eugenebut@chromium.org>
Cr-Commit-Position: refs/heads/master@{#541533}
parent d90e1fbf
...@@ -438,9 +438,11 @@ const CGFloat kResizeFactor = 4; ...@@ -438,9 +438,11 @@ const CGFloat kResizeFactor = 4;
} }
} }
// Changing the model even when the tab is the same at the end of the if (destinationTab != model_.currentTab) {
// animation allows the UI to recover. // The old tab is now hidden. The new tab will be inserted once the
[model_ setCurrentTab:destinationTab]; // animation is complete.
model_.currentTab.webState->WasHidden();
}
// Make sure the dominant card animates on top. // Make sure the dominant card animates on top.
[dominantCard.superview bringSubviewToFront:dominantCard]; [dominantCard.superview bringSubviewToFront:dominantCard];
...@@ -453,6 +455,9 @@ const CGFloat kResizeFactor = 4; ...@@ -453,6 +455,9 @@ const CGFloat kResizeFactor = 4;
[_rightCard setFrame:rightFrame]; [_rightCard setFrame:rightFrame];
} }
completion:^(BOOL finished) { completion:^(BOOL finished) {
// Changing the model even when the tab is the same at the end of the
// animation allows the UI to recover.
[model_ setCurrentTab:destinationTab];
[_leftCard setImage:nil]; [_leftCard setImage:nil];
[_rightCard setImage:nil]; [_rightCard setImage:nil];
[_leftCard setTopToolbarImage:nil isNewTabPage:NO]; [_leftCard setTopToolbarImage:nil isNewTabPage:NO];
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment