To improve the smoothness of the gesture.
This moves the code to set up translations to OnAnimate, which has a
reference timestamp for the vsync.
Because this adds lag, it exposed a bug in the cancel spring where the
direction of the initial velocity was wrong, leading to an excessive
rebound on the left edge.
Bug: 383163623, 40945408
Change-Id: I1f0ebab932aa2477bb686e3cc277cdbf8575247b
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/6064026
Reviewed-by: Jonathan Ross <jonross@chromium.org>
Reviewed-by: William Liu <liuwilliam@chromium.org>
Commit-Queue: Aldo Culquicondor <acondor@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1403106}
These used to be different (before NOTREACHED() was CHECK-fatal), now
they're not and NOTREACHED_NORETURN() is an implementation detail.
Bug: 40580068
Change-Id: Ibc868244fa01f12dee872f4ff4d5c164e957af1f
Low-Coverage-Reason: OTHER Should-be-unreachable code
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/6009949
Owners-Override: Lei Zhang <thestig@chromium.org>
Reviewed-by: Lei Zhang <thestig@chromium.org>
Commit-Queue: Peter Boström <pbos@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1381388}
The new id uniquely identifies a screenshot and its navigation entry.
The new id is introduced since the navigation entry's unique ID is
actually not unique (`NavigationEntryImpl::set_unique_id()`), which leads to unexpected behaviour.
Bug: 377381009
Change-Id: I8ada3a70f4134a9d3356a5946f112fbe707d866a
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/5999901
Commit-Queue: Baran Erfani <baranerf@google.com>
Reviewed-by: William Liu <liuwilliam@chromium.org>
Reviewed-by: Khushal Sagar <khushalsagar@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1380512}
It's flaky because we need to wait the callback in order to assert it
has happened.
Cq-Include-Trybots: luci.chromium.try:android-12-x64-rel,android-12l-x64-dbg,android-13-x64-rel,android-14-x64-rel,android-15-x64-rel,android-pie-x86-rel,android-oreo-x86-rel
Bug: 366023026
Fixed: 376867441
Change-Id: Ie9643222a70c50bc0905a90b6c9e142a0c2b6496
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/5989252
Reviewed-by: Baran Erfani <baranerf@google.com>
Commit-Queue: William Liu <liuwilliam@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1380437}
This CL is to handle the cases where the destination
FrameNavigationEntry::item_sequence_number() == -1. When that happens,
we immediately play the cross-fade animation after the invoke animation
has finished. Otherwise the user will have to wait for the stale
screenshot to dismiss after 3 seconds timeout.
Bug: 376944343
Change-Id: I8ec0dbdf973755414ea06f67713c95e8060dad16
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/5989194
Commit-Queue: Baran Erfani <baranerf@google.com>
Reviewed-by: William Liu <liuwilliam@chromium.org>
Reviewed-by: Rakina Zata Amni <rakina@chromium.org>
Reviewed-by: Khushal Sagar <khushalsagar@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1379874}
Replaced the CHECK with explicitly setting the cache hit or miss reason to `kCacheHit` to avoid the crashes. Created a new bug crbug.com/377566662 to identify the reason behind having an incorrect cache hit or miss reason in this case for the future.
Bug: 377338996
Change-Id: I980a0284a4ed82a8d4518f328b75a8849cfd1866
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/5994816
Reviewed-by: Khushal Sagar <khushalsagar@chromium.org>
Commit-Queue: Baran Erfani <baranerf@google.com>
Cr-Commit-Position: refs/heads/main@{#1378795}
If a navigation entry is deleted in the middle of a user gesture, the
invoke action should safely become a no-op. This is already being done
for the case where the gesture has an animation. Also fix it when the
gesture is not animated.
Bug: 376928606
Change-Id: I08debc240fcf121601732e826fd1060c9063d5c1
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/5991673
Auto-Submit: Khushal Sagar <khushalsagar@chromium.org>
Commit-Queue: William Liu <liuwilliam@chromium.org>
Reviewed-by: William Liu <liuwilliam@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1378477}
For 204/205/Download, we start to play the cancel animation when the
navigation commits, at which the animator is still a
RenderWidgetHostObserver, meaning we could be getting the
OnRenderFrameMetadataChangedAfterActivation() notification during the
cancel animation.
And this bug also caused another crash in the dtor
(crbug.com/377279187)
Bug: 377279187, 377340540
Change-Id: I59d28ef5fb21b998fdf497837d54ccb7ffbbf460
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/5990993
Commit-Queue: William Liu <liuwilliam@chromium.org>
Reviewed-by: Khushal Sagar <khushalsagar@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1378345}
Added a new function override from `WebContentsObserver` called `PrimaryMainFrameRenderProcessGone` which gets notified if the primary main frame renderer is destroyed. In that case, the animation manager destroys the animator when the function is called. Also, added a new enum value to keep track of this animation abort reason in the UMA metrics.
Bug: 328601834
Change-Id: I009ba9d4cea1ec17a69a0fe81a1879ce4bf4d050
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/5979352
Reviewed-by: William Liu <liuwilliam@chromium.org>
Reviewed-by: Khushal Sagar <khushalsagar@chromium.org>
Reviewed-by: Robert Kaplow <rkaplow@chromium.org>
Commit-Queue: Baran Erfani <baranerf@google.com>
Cr-Commit-Position: refs/heads/main@{#1377752}
Without tracking kFinished, we don't know the portion of transitions
that are aborted.
Cq-Include-Trybots: luci.chromium.try:android-12-x64-rel,android-12l-x64-dbg,android-13-x64-rel,android-14-x64-rel,android-15-x64-rel,android-pie-x86-rel,android-oreo-x86-rel
Fixed: 376091532
Change-Id: I8ff06e1fce073153c41fc5fcdba5a2040978e299
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/5984810
Reviewed-by: Baran Erfani <baranerf@google.com>
Reviewed-by: Luc Nguyen <lucnguyen@google.com>
Commit-Queue: William Liu <liuwilliam@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1377696}
With this change when navigating from B to A, if a new navigation
commits (C), the live page B will be replaced by C and the animation
continues navigating from C to A as expected. This way we are navigating
to A which is consistent with the screenshot that the user is seeing and
we're also handling the navigation to C by replacing the live page with
it.
Bug: 366023026
Change-Id: I3f60396b84630c16e6a467aa6ba6ec917053536c
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/5935055
Commit-Queue: Baran Erfani <baranerf@google.com>
Reviewed-by: William Liu <liuwilliam@chromium.org>
Reviewed-by: Caitlin Fischer <caitlinfischer@google.com>
Cr-Commit-Position: refs/heads/main@{#1374628}
Before this CL, we run the cancel animation if the navigation is
waiting for the BeforeUnload message. This is very conservative as a
page can register a BeforeUnload listener but doesn't perform anything.
This CL changes the behavior, in that we only play the cancel animation
to bring the active page back if a BeforeUnload dialog is shown.
Cq-Include-Trybots: luci.chromium.try:android-12-x64-rel,android-12l-x64-dbg,android-13-x64-rel,android-14-x64-rel,android-15-x64-rel,android-pie-x86-rel,android-oreo-x86-rel
Fixed: 364694410
Change-Id: Idbe86b5ae5879965fd0559a60ebb47e5b82d3de7
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/5919513
Reviewed-by: Khushal Sagar <khushalsagar@chromium.org>
Commit-Queue: William Liu <liuwilliam@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1372747}
GetNavigationEntryScreenshotCache() asserts the frame tree is primary.
However during WebContents destruction, the frame tree is reset before
the animator, so the navigation controller (owned by the FrameTree) back
pointer is a UAF.
This CL adds a shortcut to destroy the animator as the "first" thing
during the WebContents's destruction. Then the animator can still
perform the clean up tasks while the navigation controller is still
valid.
Bug: 373898450
Change-Id: I0d793d536ca99700cf7f8c324f562131f2a480c4
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/5948024
Commit-Queue: William Liu <liuwilliam@chromium.org>
Reviewed-by: Dave Tapuska <dtapuska@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1372744}
Run this test without the new size change hook:
```
[19806:19806:1003/165908.896123:FATAL:back_forward_transition_animator.cc(1730)] Check failed: values.progress <= 1.f (275.4 vs. 1)
```
which looks very similar to the crash in crbug/326850774
Bug: 326850774, 371459551
Change-Id: I28069954e82703f7411138ed9099f25dac52be13
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/5905983
Reviewed-by: Dave Tapuska <dtapuska@chromium.org>
Reviewed-by: Luc Nguyen <lucnguyen@google.com>
Commit-Queue: William Liu <liuwilliam@chromium.org>
Reviewed-by: Khushal Sagar <khushalsagar@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1364671}
Unclear how this can happen. Need to log the navigation_state_ and
state_. Also add one possible fix: that if a navigation is cancelled
after we have cloned the old surface, reset the clone.
Bug: 371043197
Change-Id: I6fd834459bc86ed13aa0358be177b6906b27d8aa
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/5906319
Commit-Queue: William Liu <liuwilliam@chromium.org>
Reviewed-by: Khushal Sagar <khushalsagar@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1363630}
Tested: on android_31_google_apis_x64.textpb and
android_30_google_apis_x86.textpb, tests are skipped properly. Also
android-13-x64-rel and android-14-x64-rel.
Fixed: 369367803
Change-Id: I5aefceb4ac8ca5d31a673d9f967d3972f67f25a6
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/5905558
Reviewed-by: Robert Flack <flackr@chromium.org>
Commit-Queue: William Liu <liuwilliam@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1363050}
This reverts commit 9d7ad8f58d.
Reason for revert: Newly added tests are failing, see b/369367803
Original change's description:
> [DNT] Defer the dialogs
>
> When a transition starts, we suspend the tab-level dialogs. These
> dialogs include alert, permissions, and do not include BeforeUnload.
>
> When an animated navigation commits, we immediately resume the dialogs
> before the the invoke animation finishes playing. If the navigation is
> cancelled or the navigation never starts, we also resume.
>
> Fixed: 362301376, 40896070
> Change-Id: Id9ab1f8a088586c66936d21c029d2d9c8971982e
> Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/5823843
> Commit-Queue: William Liu <liuwilliam@chromium.org>
> Reviewed-by: Theresa Sullivan <twellington@chromium.org>
> Reviewed-by: Khushal Sagar <khushalsagar@chromium.org>
> Cr-Commit-Position: refs/heads/main@{#1358810}
Change-Id: Ic5803abdc6ebe323755e44a5502a44d10079fe81
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/5887756
Commit-Queue: Sinan Sahin <sinansahin@google.com>
Owners-Override: Sinan Sahin <sinansahin@google.com>
Reviewed-by: William Liu <liuwilliam@chromium.org>
Bot-Commit: Rubber Stamper <rubber-stamper@appspot.gserviceaccount.com>
Cr-Commit-Position: refs/heads/main@{#1359433}
When a transition starts, we suspend the tab-level dialogs. These
dialogs include alert, permissions, and do not include BeforeUnload.
When an animated navigation commits, we immediately resume the dialogs
before the the invoke animation finishes playing. If the navigation is
cancelled or the navigation never starts, we also resume.
Fixed: 362301376, 40896070
Change-Id: Id9ab1f8a088586c66936d21c029d2d9c8971982e
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/5823843
Commit-Queue: William Liu <liuwilliam@chromium.org>
Reviewed-by: Theresa Sullivan <twellington@chromium.org>
Reviewed-by: Khushal Sagar <khushalsagar@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1358810}
This metric is recorded in an enum histogram once per gesture.
The enum values correspond to reason/state of the current navigation and
any other existing navigation in the background.
Bug: 349815498
Change-Id: I7f06609dd574492b997a1f572a844c3f6b7f91d1
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/5833108
Reviewed-by: Alexei Svitkine <asvitkine@chromium.org>
Reviewed-by: Vladimir Levin <vmpstr@chromium.org>
Commit-Queue: Baran Erfani <baranerf@google.com>
Cr-Commit-Position: refs/heads/main@{#1352095}