0

[New Tab Animation] Fix tab becomes non-interactable

Log statements show that doneHiding is not called when triggering the
animation a second time and halting the current animation. This happens
because LayoutManagerImpl#onUpdate gets called when the newest animation
already started, not allowing to finish hiding the layout. This CL
removes the check of isRunningAnimations to allow the layout to hide in
such cases.

Bug: 414417927
Change-Id: Idabf9867f01f4be11f46ac88ce065657a22a863b
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/6513615
Commit-Queue: Calder Kitagawa <ckitagawa@chromium.org>
Auto-Submit: Dan Polanco <polardz@google.com>
Commit-Queue: Dan Polanco <polardz@google.com>
Reviewed-by: Calder Kitagawa <ckitagawa@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1456965}
This commit is contained in:
Dan Polanco
2025-05-07 06:51:35 -07:00
committed by Chromium LUCI CQ
parent 2c1245a04f
commit f2a1313fb3

@ -344,15 +344,20 @@ public class NewTabAnimationLayout extends Layout {
}
/**
* Returns true if animations are running (excluding {@link #mFadeAnimator}).
* Returns true if the foreground animation is running (excluding {@link #mFadeAnimator}).
*
* <p>Including {@link #mFadeAnimator} would prevent {@link #doneHiding} from being called
* during the animation cycle in {@link
* org.chromium.chrome.browser.compositor.layouts.LayoutManagerImpl#onUpdate(long, long)}.
*
* <p>There is also a race condition in {@link #tabCreatedInBackground} where {@link
* org.chromium.chrome.browser.compositor.layouts.LayoutManagerImpl#onUpdate(long, long)} gets
* called when the animation already started, causing the layout to freeze. Hence, we skip this
* check for the background animation.
*/
@Override
public boolean isRunningAnimations() {
return mTabCreatedForegroundAnimation != null || mTabCreatedBackgroundAnimation != null;
return mTabCreatedForegroundAnimation != null;
}
private void reset() {
@ -632,14 +637,8 @@ public class NewTabAnimationLayout extends Layout {
@Px int y,
ObservableSupplier<Boolean> visibilitySupplier) {
boolean isIncognito = animationTab.isIncognitoBranded();
// TODO(crbug.com/40282469): Investigate why NTP presents lower quality during the
// animation and how to stop forcing browser controls in the NTP.
assert mLayoutTabs.length == 1;
forceNewTabAnimationToFinish();
// TODO(crbug.com/40282469): Fix bug where the animation has a weird state and does not call
// startHiding when opening multiple tabs from NTP MVT context menu.
mSkipForceAnimationToFinish = true;
startHiding();