New issue
Advanced search Search tips

Issue 819416 link

Starred by 1 user

Issue metadata

Status: Fixed
Owner:
Closed: Mar 2018
Cc:
Components:
EstimatedDays: ----
NextAction: ----
OS: iOS
Pri: 2
Type: Bug

Blocking:
issue 791806



Sign in to add a comment

Side Swipe animation is broken for New Download Manager

Project Member Reported by eugene...@chromium.org, Mar 6 2018

Issue description

App Version (from "Chrome Settings > About Chrome"): ToT
iOS Version: All
Device: iPhone

Steps to reproduce: 
1.) Enable New Download Manager in chrome://flags
2.) Load https://www.barebones.com/products/bbedit/download.html
3.) Tap Download
4.) Open a new Tab
5.) Side swipe toolbar to switch to the previous tab

Observed behavior: 
Download Manager UI displayed before swipe animation is finished.

Expected behavior: 
Download Manager UI should be displayed after the animation is finished.

 
SwipeToNavigateAndDownloadManager.mov
2.8 MB View Download
This bug happens because WebStateObserver::WasShown is called before the animation is complete. -[CardSideSwipeView finishPan] calls setCurrentTab, which calls WebStateObserver::WasHidden (correct timing) and WebStateObserver::WasShown (too early). 

Justin, can we replace setCurrentTab: with two separate calls?:
 1.) removes current tab and called instead of setCurrentTab:
 2.) adds a new tab and called inside animation completion block

Infobar works fine in this case because infobar is displayed inside -[BrowserViewController sideSwipeViewDismissAnimationDidEnd:]. We do not have New Download Manager code inside BVC, so infobar solution is not appropriate for Download Manager.
Blocking: 791806
Summary: Side Swipe animation is broken for New Download Manager (was: Issue Summary)
Cc: sdefresne@chromium.org
Maybe Sylvain can suggest WebStateList API which I could use for side swipe (see comment #1).
Can we pass destinationTab to sideSwipeViewDismissAnimationDidEnd and call setCurrentTab at the end of the animation?
Maybe the code can listen to the following event from WebStateListObserver:

          void WebStateActivatedAt(WebStateList* web_state_list,
                                   web::WebState* old_web_state,
                                   web::WebState* new_web_state,
                                   int active_index,
                                   int reason);

This is called when switching tabs. Code can use this to know which tab will become hidden/visible. Note that the visibility is probably changed in one of the observer of this method, so should probably not be relied on by the animation code.

Also important, but either old_web_state or new_web_state may be null (when first tab created / last tab closed respectively).

Would this work for you?
Labels: -Restrict-View-Google
Status: Started (was: Assigned)
WebStateActivatedAt is called too early. I guess the solution is hiding WebState before animation is started and showing after the animation is completed.

I moved setCurrentTab to animation completion callback. Doing so delays WebStateObserver::WasHidden call, which is not correct, so I added WebState::WasHidden call to compensate that. crrev.com/c/953075

Project Member

Comment 7 by bugdroid1@chromium.org, Mar 7 2018

The following revision refers to this bug:
  https://chromium.googlesource.com/chromium/src.git/+/991b0c246baf4713d4c1d91696d15fdb29658c53

commit 991b0c246baf4713d4c1d91696d15fdb29658c53
Author: Eugene But <eugenebut@google.com>
Date: Wed Mar 07 19:44:41 2018

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/953075
Reviewed-by: Justin Cohen <justincohen@chromium.org>
Commit-Queue: Eugene But <eugenebut@chromium.org>
Cr-Commit-Position: refs/heads/master@{#541533}
[modify] https://crrev.com/991b0c246baf4713d4c1d91696d15fdb29658c53/ios/chrome/browser/ui/side_swipe/card_side_swipe_view.mm

Status: Fixed (was: Started)

Sign in to add a comment