[EncapsulateAnimations] Re-enable optional button transitions [chromium/src : main]

0 views
Skip to first unread message

Neil Coronado (Gerrit)

unread,
Dec 4, 2025, 3:27:19 PM (12 days ago) Dec 4
to Sirisha Kavuluru, Chromium LUCI CQ, chromium...@chromium.org, hanxi...@chromium.org, peilinwa...@google.com
Attention needed from Sirisha Kavuluru

Neil Coronado voted and added 2 comments

Votes added by Neil Coronado

Commit-Queue+1

2 comments

File chrome/browser/ui/android/toolbar/java/src/org/chromium/chrome/browser/toolbar/optional_button/OptionalButtonView.java
Line 940, Patchset 1: mOnBeforeShowTransitionCallback.run();
Neil Coronado . unresolved

Adding this event and the one at the start of `#beginDelayedTransition` are the only real changes to the `OptionalButton` files; the rest is boilerplate to set the callbacks (or I suppose runnables, but `mOnBeforeHideTransitionCallback` is also a runnable, so I opted to just keep the naming consistent).

File chrome/browser/ui/android/toolbar/java/src/org/chromium/chrome/browser/toolbar/top/ToolbarPhone.java
Line 2092, Patchset 1: endFocusTransition(/* hasFocus= */ false);
Neil Coronado . unresolved

`#endUrlFocusAnimation` is called when the URL loses focus. Adding this effectively disables the unfocus animation (like with our feature disabled).

Open in Gerrit

Related details

Attention is currently required from:
  • Sirisha Kavuluru
Submit Requirements:
  • requirement satisfiedCode-Coverage
  • requirement is not satisfiedCode-Owners
  • requirement is not satisfiedCode-Review
  • requirement is not satisfiedNo-Unresolved-Comments
  • requirement is not satisfiedReview-Enforcement
Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. DiffyGerrit
Gerrit-MessageType: comment
Gerrit-Project: chromium/src
Gerrit-Branch: main
Gerrit-Change-Id: I6ecb4bb416efc949737cba7098004ebbc6983817
Gerrit-Change-Number: 7214947
Gerrit-PatchSet: 2
Gerrit-Owner: Neil Coronado <ne...@google.com>
Gerrit-Reviewer: Neil Coronado <ne...@google.com>
Gerrit-Reviewer: Sirisha Kavuluru <skav...@google.com>
Gerrit-Attention: Sirisha Kavuluru <skav...@google.com>
Gerrit-Comment-Date: Thu, 04 Dec 2025 20:27:09 +0000
Gerrit-HasComments: Yes
Gerrit-Has-Labels: Yes
satisfied_requirement
unsatisfied_requirement
open
diffy

Sirisha Kavuluru (Gerrit)

unread,
Dec 10, 2025, 11:55:49 PM (5 days ago) Dec 10
to Neil Coronado, Code Review Nudger, Chromium LUCI CQ, chromium...@chromium.org, hanxi...@chromium.org, peilinwa...@google.com
Attention needed from Neil Coronado

Sirisha Kavuluru added 6 comments

File chrome/browser/ui/android/toolbar/java/src/org/chromium/chrome/browser/toolbar/optional_button/OptionalButtonView.java
Line 940, Patchset 1: mOnBeforeShowTransitionCallback.run();
Neil Coronado . unresolved

Adding this event and the one at the start of `#beginDelayedTransition` are the only real changes to the `OptionalButton` files; the rest is boilerplate to set the callbacks (or I suppose runnables, but `mOnBeforeHideTransitionCallback` is also a runnable, so I opted to just keep the naming consistent).

Sirisha Kavuluru

Shouldn't this be called before the setVisibility call in line 936 since this is named "beforeShow"?

File chrome/browser/ui/android/toolbar/java/src/org/chromium/chrome/browser/toolbar/top/ToolbarPhone.java
Line 864, Patchset 2 (Latest): // MeasuredWidth() represents the desired width of the container which is accurate most
// time, except during the optional button animations, where the MeasuredWidth changes
// instantly to the final size and Width() represents the actual size at that frame.
Sirisha Kavuluru . unresolved

This comment only applies to the else block?

Line 2092, Patchset 1: endFocusTransition(/* hasFocus= */ false);
Neil Coronado . resolved

`#endUrlFocusAnimation` is called when the URL loses focus. Adding this effectively disables the unfocus animation (like with our feature disabled).

Sirisha Kavuluru

Acknowledged

Line 3281, Patchset 2 (Latest): mOptionalButtonCoordinator.setOnBeforeDelayedTransitionCallback(
Sirisha Kavuluru . unresolved

What is the exact difference between this and setTransitionStartedCallback? Is setTransitionStartedCallback called during onTransitionStart() which might be too late to endFocusTransition?

Line 3290, Patchset 2 (Latest): mOptionalButtonCoordinator.setOnBeforeWidthTransitionCallback(
Sirisha Kavuluru . unresolved

Dont we need to set mLayoutLocationBarWithExtraButton = true here?

Line 3285, Patchset 2 (Latest): mOptionalButtonCoordinator.setOnBeforeShowTransitionCallback(
() -> {
mLayoutLocationBarWithExtraButton = true;
createAndRunFocusAnimatorRefactored(urlHasFocus());
});
mOptionalButtonCoordinator.setOnBeforeWidthTransitionCallback(
(type, widthDelta) -> {
mOptionalButtonTransitionWidthDelta = widthDelta;
createAndRunFocusAnimatorRefactored(urlHasFocus());
});
Sirisha Kavuluru . unresolved

Synced offline - wanted to check if hiding button would trigger a width change callback / should we merge callbacks

There is also setTransitionStartedCallback - would be nice to see if we can merge all of them into this one

Open in Gerrit

Related details

Attention is currently required from:
  • Neil Coronado
Submit Requirements:
  • requirement satisfiedCode-Coverage
  • requirement is not satisfiedCode-Owners
  • requirement is not satisfiedCode-Review
  • requirement is not satisfiedNo-Unresolved-Comments
  • requirement is not satisfiedReview-Enforcement
Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. DiffyGerrit
Gerrit-MessageType: comment
Gerrit-Project: chromium/src
Gerrit-Branch: main
Gerrit-Change-Id: I6ecb4bb416efc949737cba7098004ebbc6983817
Gerrit-Change-Number: 7214947
Gerrit-PatchSet: 2
Gerrit-Owner: Neil Coronado <ne...@google.com>
Gerrit-Reviewer: Neil Coronado <ne...@google.com>
Gerrit-Reviewer: Sirisha Kavuluru <skav...@google.com>
Gerrit-CC: Code Review Nudger <android-build...@prod.google.com>
Gerrit-Attention: Neil Coronado <ne...@google.com>
Gerrit-Comment-Date: Thu, 11 Dec 2025 04:55:38 +0000
Gerrit-HasComments: Yes
Gerrit-Has-Labels: No
Comment-In-Reply-To: Neil Coronado <ne...@google.com>
satisfied_requirement
unsatisfied_requirement
open
diffy

Neil Coronado (Gerrit)

unread,
Dec 11, 2025, 5:34:19 PM (5 days ago) Dec 11
to Code Review Nudger, Sirisha Kavuluru, Chromium LUCI CQ, chromium...@chromium.org, hanxi...@chromium.org, peilinwa...@google.com
Attention needed from Sirisha Kavuluru

Neil Coronado added 4 comments

File chrome/browser/ui/android/toolbar/java/src/org/chromium/chrome/browser/toolbar/optional_button/OptionalButtonView.java
Line 940, Patchset 1: mOnBeforeShowTransitionCallback.run();
Neil Coronado . unresolved

Adding this event and the one at the start of `#beginDelayedTransition` are the only real changes to the `OptionalButton` files; the rest is boilerplate to set the callbacks (or I suppose runnables, but `mOnBeforeHideTransitionCallback` is also a runnable, so I opted to just keep the naming consistent).

Sirisha Kavuluru

Shouldn't this be called before the setVisibility call in line 936 since this is named "beforeShow"?

Neil Coronado

I agree the naming/timing feels weird to me, but I did this to be consistent with when the other callbacks are triggered (e.g. `OnBeforeWidth` [1] and `onBeforeHide`). I think this is because it's not meant to be interpreted as "before X state is set," but instead "after X state is set, but before the X transition happens."

[1] https://crsrc.org/c/chrome/browser/ui/android/toolbar/java/src/org/chromium/chrome/browser/toolbar/optional_button/OptionalButtonView.java;l=823-829;drc=264504830cc1341cd717224911502c68abc5a26b
[2] https://crsrc.org/c/chrome/browser/ui/android/toolbar/java/src/org/chromium/chrome/browser/toolbar/optional_button/OptionalButtonView.java;l=874-883;drc=264504830cc1341cd717224911502c68abc5a26b

File chrome/browser/ui/android/toolbar/java/src/org/chromium/chrome/browser/toolbar/top/ToolbarPhone.java
Line 3281, Patchset 2 (Latest): mOptionalButtonCoordinator.setOnBeforeDelayedTransitionCallback(
Sirisha Kavuluru . unresolved

What is the exact difference between this and setTransitionStartedCallback? Is setTransitionStartedCallback called during onTransitionStart() which might be too late to endFocusTransition?

Neil Coronado

Is setTransitionStartedCallback called during onTransitionStart() which might be too late to endFocusTransition

Yes, that is the case. I wanted to "get everything into a good state" before triggering `#beginDelayedTransition` for the optional button. This is because the OptionalButton somewhat counterintuitively animates its sibling views [1] (i.e. the toolbar buttons container).

So I needed to clear any transition state on the toolbar buttons before letting the optional button animations start (i.e. before the `#beginDelayedTransition` call).

[1] https://crsrc.org/c/chrome/browser/ui/android/toolbar/java/src/org/chromium/chrome/browser/toolbar/optional_button/OptionalButtonView.java;l=385-386;drc=397107e399d4b0f4a6e801e7a888d7d71778529c

Line 3290, Patchset 2 (Latest): mOptionalButtonCoordinator.setOnBeforeWidthTransitionCallback(
Sirisha Kavuluru . unresolved

Dont we need to set mLayoutLocationBarWithExtraButton = true here?

Neil Coronado

IIUC, the width transition can be for either collapse or expand. `mLayoutLocationBarWITHOUTExtraButton` is only set when the button is explicitly hidden, and I opted to model our use case after this (i.e. set `mLayoutLocationBarWITHExtraButton` when explicitly shown).

Line 3285, Patchset 2 (Latest): mOptionalButtonCoordinator.setOnBeforeShowTransitionCallback(
() -> {
mLayoutLocationBarWithExtraButton = true;
createAndRunFocusAnimatorRefactored(urlHasFocus());
});
mOptionalButtonCoordinator.setOnBeforeWidthTransitionCallback(
(type, widthDelta) -> {
mOptionalButtonTransitionWidthDelta = widthDelta;
createAndRunFocusAnimatorRefactored(urlHasFocus());
});
Sirisha Kavuluru . resolved

Synced offline - wanted to check if hiding button would trigger a width change callback / should we merge callbacks

There is also setTransitionStartedCallback - would be nice to see if we can merge all of them into this one

Neil Coronado

In the flow that I tested, I was only getting show/hide signals, and not widthChange signals. re:setTransitionStarted, the signal was too late as per the comment above.

Open in Gerrit

Related details

Attention is currently required from:
  • Sirisha Kavuluru
Submit Requirements:
  • requirement satisfiedCode-Coverage
  • requirement is not satisfiedCode-Owners
  • requirement is not satisfiedCode-Review
  • requirement is not satisfiedNo-Unresolved-Comments
  • requirement is not satisfiedReview-Enforcement
Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. DiffyGerrit
Gerrit-MessageType: comment
Gerrit-Project: chromium/src
Gerrit-Branch: main
Gerrit-Change-Id: I6ecb4bb416efc949737cba7098004ebbc6983817
Gerrit-Change-Number: 7214947
Gerrit-PatchSet: 2
Gerrit-Owner: Neil Coronado <ne...@google.com>
Gerrit-Reviewer: Neil Coronado <ne...@google.com>
Gerrit-Reviewer: Sirisha Kavuluru <skav...@google.com>
Gerrit-CC: Code Review Nudger <android-build...@prod.google.com>
Gerrit-Attention: Sirisha Kavuluru <skav...@google.com>
Gerrit-Comment-Date: Thu, 11 Dec 2025 22:34:06 +0000
Gerrit-HasComments: Yes
Gerrit-Has-Labels: No
Comment-In-Reply-To: Sirisha Kavuluru <skav...@google.com>
Comment-In-Reply-To: Neil Coronado <ne...@google.com>
satisfied_requirement
unsatisfied_requirement
open
diffy

Sirisha Kavuluru (Gerrit)

unread,
Dec 11, 2025, 7:05:00 PM (5 days ago) Dec 11
to Neil Coronado, Salvador Guerrero Ramos, Code Review Nudger, Chromium LUCI CQ, chromium...@chromium.org, hanxi...@chromium.org, peilinwa...@google.com
Attention needed from Neil Coronado and Salvador Guerrero Ramos

Sirisha Kavuluru added 4 comments

File chrome/browser/ui/android/toolbar/java/src/org/chromium/chrome/browser/toolbar/optional_button/OptionalButtonView.java
Line 940, Patchset 1: mOnBeforeShowTransitionCallback.run();
Neil Coronado . unresolved

Adding this event and the one at the start of `#beginDelayedTransition` are the only real changes to the `OptionalButton` files; the rest is boilerplate to set the callbacks (or I suppose runnables, but `mOnBeforeHideTransitionCallback` is also a runnable, so I opted to just keep the naming consistent).

Sirisha Kavuluru

Shouldn't this be called before the setVisibility call in line 936 since this is named "beforeShow"?

Neil Coronado

I agree the naming/timing feels weird to me, but I did this to be consistent with when the other callbacks are triggered (e.g. `OnBeforeWidth` [1] and `onBeforeHide`). I think this is because it's not meant to be interpreted as "before X state is set," but instead "after X state is set, but before the X transition happens."

[1] https://crsrc.org/c/chrome/browser/ui/android/toolbar/java/src/org/chromium/chrome/browser/toolbar/optional_button/OptionalButtonView.java;l=823-829;drc=264504830cc1341cd717224911502c68abc5a26b
[2] https://crsrc.org/c/chrome/browser/ui/android/toolbar/java/src/org/chromium/chrome/browser/toolbar/optional_button/OptionalButtonView.java;l=874-883;drc=264504830cc1341cd717224911502c68abc5a26b

Sirisha Kavuluru

Ack - I'll also loop into @salg into this CL to review /optional_button/ changes as an owner

File chrome/browser/ui/android/toolbar/java/src/org/chromium/chrome/browser/toolbar/top/ToolbarPhone.java
Line 872, Patchset 2 (Latest): if (mOptionalButtonCoordinator != null && mLayoutLocationBarWithExtraButton) {
Sirisha Kavuluru . unresolved

Should we rename this is isOptionalButtonShowInTransition ?

The naming is confusing - this is set to true only when show transition is running and false otherwise (location bar will be drawn with the extra optional button after the transition is complete / during width transition)

Line 3281, Patchset 2 (Latest): mOptionalButtonCoordinator.setOnBeforeDelayedTransitionCallback(
Sirisha Kavuluru . resolved

What is the exact difference between this and setTransitionStartedCallback? Is setTransitionStartedCallback called during onTransitionStart() which might be too late to endFocusTransition?

Neil Coronado

Is setTransitionStartedCallback called during onTransitionStart() which might be too late to endFocusTransition

Yes, that is the case. I wanted to "get everything into a good state" before triggering `#beginDelayedTransition` for the optional button. This is because the OptionalButton somewhat counterintuitively animates its sibling views [1] (i.e. the toolbar buttons container).

So I needed to clear any transition state on the toolbar buttons before letting the optional button animations start (i.e. before the `#beginDelayedTransition` call).

[1] https://crsrc.org/c/chrome/browser/ui/android/toolbar/java/src/org/chromium/chrome/browser/toolbar/optional_button/OptionalButtonView.java;l=385-386;drc=397107e399d4b0f4a6e801e7a888d7d71778529c

Sirisha Kavuluru

Acknowledged

Line 3290, Patchset 2 (Latest): mOptionalButtonCoordinator.setOnBeforeWidthTransitionCallback(
Sirisha Kavuluru . resolved

Dont we need to set mLayoutLocationBarWithExtraButton = true here?

Neil Coronado

IIUC, the width transition can be for either collapse or expand. `mLayoutLocationBarWITHOUTExtraButton` is only set when the button is explicitly hidden, and I opted to model our use case after this (i.e. set `mLayoutLocationBarWITHExtraButton` when explicitly shown).

Sirisha Kavuluru

Acknowledged

Open in Gerrit

Related details

Attention is currently required from:
  • Neil Coronado
  • Salvador Guerrero Ramos
Submit Requirements:
  • requirement satisfiedCode-Coverage
  • requirement is not satisfiedCode-Owners
  • requirement is not satisfiedCode-Review
  • requirement is not satisfiedNo-Unresolved-Comments
  • requirement is not satisfiedReview-Enforcement
Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. DiffyGerrit
Gerrit-MessageType: comment
Gerrit-Project: chromium/src
Gerrit-Branch: main
Gerrit-Change-Id: I6ecb4bb416efc949737cba7098004ebbc6983817
Gerrit-Change-Number: 7214947
Gerrit-PatchSet: 2
Gerrit-Owner: Neil Coronado <ne...@google.com>
Gerrit-Reviewer: Neil Coronado <ne...@google.com>
Gerrit-Reviewer: Salvador Guerrero Ramos <sa...@google.com>
Gerrit-Reviewer: Sirisha Kavuluru <skav...@google.com>
Gerrit-CC: Code Review Nudger <android-build...@prod.google.com>
Gerrit-Attention: Salvador Guerrero Ramos <sa...@google.com>
Gerrit-Attention: Neil Coronado <ne...@google.com>
Gerrit-Comment-Date: Fri, 12 Dec 2025 00:04:51 +0000
satisfied_requirement
unsatisfied_requirement
open
diffy

Sirisha Kavuluru (Gerrit)

unread,
Dec 11, 2025, 7:05:08 PM (5 days ago) Dec 11
to Neil Coronado, Salvador Guerrero Ramos, Code Review Nudger, Chromium LUCI CQ, chromium...@chromium.org, hanxi...@chromium.org, peilinwa...@google.com
Attention needed from Neil Coronado and Salvador Guerrero Ramos

Sirisha Kavuluru voted Code-Review+1

Code-Review+1
Open in Gerrit

Related details

Attention is currently required from:
  • Neil Coronado
  • Salvador Guerrero Ramos
Submit Requirements:
  • requirement satisfiedCode-Coverage
  • requirement satisfiedCode-Owners
  • requirement satisfiedCode-Review
  • requirement is not satisfiedNo-Unresolved-Comments
  • requirement satisfiedReview-Enforcement
Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. DiffyGerrit
Gerrit-MessageType: comment
Gerrit-Project: chromium/src
Gerrit-Branch: main
Gerrit-Change-Id: I6ecb4bb416efc949737cba7098004ebbc6983817
Gerrit-Change-Number: 7214947
Gerrit-PatchSet: 2
Gerrit-Owner: Neil Coronado <ne...@google.com>
Gerrit-Reviewer: Neil Coronado <ne...@google.com>
Gerrit-Reviewer: Salvador Guerrero Ramos <sa...@google.com>
Gerrit-Reviewer: Sirisha Kavuluru <skav...@google.com>
Gerrit-CC: Code Review Nudger <android-build...@prod.google.com>
Gerrit-Attention: Salvador Guerrero Ramos <sa...@google.com>
Gerrit-Attention: Neil Coronado <ne...@google.com>
Gerrit-Comment-Date: Fri, 12 Dec 2025 00:04:56 +0000
Gerrit-HasComments: No
Gerrit-Has-Labels: Yes
satisfied_requirement
unsatisfied_requirement
open
diffy

Salvador Guerrero Ramos (Gerrit)

unread,
Dec 12, 2025, 7:26:03 PM (4 days ago) Dec 12
to Neil Coronado, Sirisha Kavuluru, Code Review Nudger, Chromium LUCI CQ, chromium...@chromium.org, hanxi...@chromium.org, peilinwa...@google.com
Attention needed from Neil Coronado

Salvador Guerrero Ramos added 5 comments

File chrome/browser/ui/android/toolbar/java/src/org/chromium/chrome/browser/toolbar/optional_button/OptionalButtonView.java
Line 95, Patchset 2 (Latest): private @Nullable Runnable mOnBeforeHideTransitionCallback;
Salvador Guerrero Ramos . unresolved

Could you also update this to be non-nullable? to be consistent with the other callbacks.

Line 183, Patchset 2 (Latest): mOnBeforeShowTransitionCallback = callback;
Salvador Guerrero Ramos . unresolved

Could you update OptionalButtonViewTest.java with these new callbacks?

Line 940, Patchset 1: mOnBeforeShowTransitionCallback.run();
Neil Coronado . unresolved

Adding this event and the one at the start of `#beginDelayedTransition` are the only real changes to the `OptionalButton` files; the rest is boilerplate to set the callbacks (or I suppose runnables, but `mOnBeforeHideTransitionCallback` is also a runnable, so I opted to just keep the naming consistent).

Sirisha Kavuluru

Shouldn't this be called before the setVisibility call in line 936 since this is named "beforeShow"?

Neil Coronado

I agree the naming/timing feels weird to me, but I did this to be consistent with when the other callbacks are triggered (e.g. `OnBeforeWidth` [1] and `onBeforeHide`). I think this is because it's not meant to be interpreted as "before X state is set," but instead "after X state is set, but before the X transition happens."

[1] https://crsrc.org/c/chrome/browser/ui/android/toolbar/java/src/org/chromium/chrome/browser/toolbar/optional_button/OptionalButtonView.java;l=823-829;drc=264504830cc1341cd717224911502c68abc5a26b
[2] https://crsrc.org/c/chrome/browser/ui/android/toolbar/java/src/org/chromium/chrome/browser/toolbar/optional_button/OptionalButtonView.java;l=874-883;drc=264504830cc1341cd717224911502c68abc5a26b

Sirisha Kavuluru

Ack - I'll also loop into @salg into this CL to review /optional_button/ changes as an owner

Salvador Guerrero Ramos

Timing wise this is okay, all the UI changes after the call to beginDelayedTransition will be animated, and the animation won't start until the next frame.

Line 942, Patchset 2 (Parent): if (ChromeFeatureList.sToolbarPhoneAnimationRefactor.isEnabled()) {
Salvador Guerrero Ramos . unresolved

Just to confirm, this is no longer needed because of the new callback?

File chrome/browser/ui/android/toolbar/java/src/org/chromium/chrome/browser/toolbar/top/ToolbarPhone.java
Line 864, Patchset 2 (Latest): // MeasuredWidth() represents the desired width of the container which is accurate most
// time, except during the optional button animations, where the MeasuredWidth changes
// instantly to the final size and Width() represents the actual size at that frame.
Sirisha Kavuluru . unresolved

This comment only applies to the else block?

Salvador Guerrero Ramos

+1

Open in Gerrit

Related details

Attention is currently required from:
  • Neil Coronado
Submit Requirements:
  • requirement satisfiedCode-Coverage
  • requirement satisfiedCode-Owners
  • requirement satisfiedCode-Review
  • requirement is not satisfiedNo-Unresolved-Comments
  • requirement satisfiedReview-Enforcement
Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. DiffyGerrit
Gerrit-MessageType: comment
Gerrit-Project: chromium/src
Gerrit-Branch: main
Gerrit-Change-Id: I6ecb4bb416efc949737cba7098004ebbc6983817
Gerrit-Change-Number: 7214947
Gerrit-PatchSet: 2
Gerrit-Owner: Neil Coronado <ne...@google.com>
Gerrit-Reviewer: Neil Coronado <ne...@google.com>
Gerrit-Reviewer: Salvador Guerrero Ramos <sa...@google.com>
Gerrit-Reviewer: Sirisha Kavuluru <skav...@google.com>
Gerrit-CC: Code Review Nudger <android-build...@prod.google.com>
Gerrit-Attention: Neil Coronado <ne...@google.com>
Gerrit-Comment-Date: Sat, 13 Dec 2025 00:25:53 +0000
satisfied_requirement
unsatisfied_requirement
open
diffy

Neil Coronado (Gerrit)

unread,
Dec 15, 2025, 1:58:20 PM (20 hours ago) Dec 15
to Sirisha Kavuluru, Salvador Guerrero Ramos, Code Review Nudger, Chromium LUCI CQ, chromium...@chromium.org, hanxi...@chromium.org, peilinwa...@google.com
Attention needed from Salvador Guerrero Ramos and Sirisha Kavuluru

Neil Coronado voted and added 6 comments

Votes added by Neil Coronado

Commit-Queue+1

6 comments

File chrome/browser/ui/android/toolbar/java/src/org/chromium/chrome/browser/toolbar/optional_button/OptionalButtonView.java
Line 95, Patchset 2: private @Nullable Runnable mOnBeforeHideTransitionCallback;
Salvador Guerrero Ramos . resolved

Could you also update this to be non-nullable? to be consistent with the other callbacks.

Neil Coronado

Done

Line 183, Patchset 2: mOnBeforeShowTransitionCallback = callback;
Salvador Guerrero Ramos . resolved

Could you update OptionalButtonViewTest.java with these new callbacks?

Neil Coronado

Done

Line 940, Patchset 1: mOnBeforeShowTransitionCallback.run();
Neil Coronado . resolved

Adding this event and the one at the start of `#beginDelayedTransition` are the only real changes to the `OptionalButton` files; the rest is boilerplate to set the callbacks (or I suppose runnables, but `mOnBeforeHideTransitionCallback` is also a runnable, so I opted to just keep the naming consistent).

Sirisha Kavuluru

Shouldn't this be called before the setVisibility call in line 936 since this is named "beforeShow"?

Neil Coronado

I agree the naming/timing feels weird to me, but I did this to be consistent with when the other callbacks are triggered (e.g. `OnBeforeWidth` [1] and `onBeforeHide`). I think this is because it's not meant to be interpreted as "before X state is set," but instead "after X state is set, but before the X transition happens."

[1] https://crsrc.org/c/chrome/browser/ui/android/toolbar/java/src/org/chromium/chrome/browser/toolbar/optional_button/OptionalButtonView.java;l=823-829;drc=264504830cc1341cd717224911502c68abc5a26b
[2] https://crsrc.org/c/chrome/browser/ui/android/toolbar/java/src/org/chromium/chrome/browser/toolbar/optional_button/OptionalButtonView.java;l=874-883;drc=264504830cc1341cd717224911502c68abc5a26b

Sirisha Kavuluru

Ack - I'll also loop into @salg into this CL to review /optional_button/ changes as an owner

Salvador Guerrero Ramos

Timing wise this is okay, all the UI changes after the call to beginDelayedTransition will be animated, and the animation won't start until the next frame.

Neil Coronado

Acknowledged

Line 942, Patchset 2 (Parent): if (ChromeFeatureList.sToolbarPhoneAnimationRefactor.isEnabled()) {
Salvador Guerrero Ramos . resolved

Just to confirm, this is no longer needed because of the new callback?

Neil Coronado

Yep, that is correct.

Or I guess to explain a bit more, the `#addTarget` call effectively disabled the optional button animations while our flag was enabled, as the timing caused it to suppress our newly-added transitions on the toolbar buttons container. We no longer need to do this, as we instead use the new callbacks to stop the transitions from conflicting.

File chrome/browser/ui/android/toolbar/java/src/org/chromium/chrome/browser/toolbar/top/ToolbarPhone.java
Line 864, Patchset 2: // MeasuredWidth() represents the desired width of the container which is accurate most

// time, except during the optional button animations, where the MeasuredWidth changes
// instantly to the final size and Width() represents the actual size at that frame.
Sirisha Kavuluru . resolved

This comment only applies to the else block?

Salvador Guerrero Ramos

+1

Neil Coronado

Done

Line 872, Patchset 2: if (mOptionalButtonCoordinator != null && mLayoutLocationBarWithExtraButton) {
Sirisha Kavuluru . resolved

Should we rename this is isOptionalButtonShowInTransition ?

The naming is confusing - this is set to true only when show transition is running and false otherwise (location bar will be drawn with the extra optional button after the transition is complete / during width transition)

Neil Coronado

Renamed to `mOptionalButtonShowTransitionRunning`

Open in Gerrit

Related details

Attention is currently required from:
  • Salvador Guerrero Ramos
  • Sirisha Kavuluru
Submit Requirements:
  • requirement satisfiedCode-Coverage
  • requirement is not satisfiedCode-Owners
  • requirement is not satisfiedCode-Review
  • requirement is not satisfiedReview-Enforcement
Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. DiffyGerrit
Gerrit-MessageType: comment
Gerrit-Project: chromium/src
Gerrit-Branch: main
Gerrit-Change-Id: I6ecb4bb416efc949737cba7098004ebbc6983817
Gerrit-Change-Number: 7214947
Gerrit-PatchSet: 3
Gerrit-Owner: Neil Coronado <ne...@google.com>
Gerrit-Reviewer: Neil Coronado <ne...@google.com>
Gerrit-Reviewer: Salvador Guerrero Ramos <sa...@google.com>
Gerrit-Reviewer: Sirisha Kavuluru <skav...@google.com>
Gerrit-CC: Code Review Nudger <android-build...@prod.google.com>
Gerrit-Attention: Sirisha Kavuluru <skav...@google.com>
Gerrit-Attention: Salvador Guerrero Ramos <sa...@google.com>
Gerrit-Comment-Date: Mon, 15 Dec 2025 18:58:08 +0000
Gerrit-HasComments: Yes
Gerrit-Has-Labels: Yes
Comment-In-Reply-To: Sirisha Kavuluru <skav...@google.com>
Comment-In-Reply-To: Salvador Guerrero Ramos <sa...@google.com>
Comment-In-Reply-To: Neil Coronado <ne...@google.com>
satisfied_requirement
unsatisfied_requirement
open
diffy

Salvador Guerrero Ramos (Gerrit)

unread,
Dec 15, 2025, 1:59:40 PM (20 hours ago) Dec 15
to Neil Coronado, Sirisha Kavuluru, Code Review Nudger, Chromium LUCI CQ, chromium...@chromium.org, hanxi...@chromium.org, peilinwa...@google.com
Attention needed from Neil Coronado and Sirisha Kavuluru

Salvador Guerrero Ramos voted Code-Review+1

Code-Review+1
Open in Gerrit

Related details

Attention is currently required from:
  • Neil Coronado
  • Sirisha Kavuluru
Submit Requirements:
  • requirement satisfiedCode-Coverage
  • requirement satisfiedCode-Owners
  • requirement satisfiedCode-Review
  • requirement satisfiedReview-Enforcement
Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. DiffyGerrit
Gerrit-MessageType: comment
Gerrit-Project: chromium/src
Gerrit-Branch: main
Gerrit-Change-Id: I6ecb4bb416efc949737cba7098004ebbc6983817
Gerrit-Change-Number: 7214947
Gerrit-PatchSet: 3
Gerrit-Owner: Neil Coronado <ne...@google.com>
Gerrit-Reviewer: Neil Coronado <ne...@google.com>
Gerrit-Reviewer: Salvador Guerrero Ramos <sa...@google.com>
Gerrit-Reviewer: Sirisha Kavuluru <skav...@google.com>
Gerrit-CC: Code Review Nudger <android-build...@prod.google.com>
Gerrit-Attention: Sirisha Kavuluru <skav...@google.com>
Gerrit-Attention: Neil Coronado <ne...@google.com>
Gerrit-Comment-Date: Mon, 15 Dec 2025 18:59:25 +0000
Gerrit-HasComments: No
Gerrit-Has-Labels: Yes
satisfied_requirement
open
diffy

Chromium LUCI CQ (Gerrit)

unread,
Dec 15, 2025, 2:48:44 PM (19 hours ago) Dec 15
to Neil Coronado, Salvador Guerrero Ramos, Sirisha Kavuluru, Code Review Nudger, chromium...@chromium.org, hanxi...@chromium.org, peilinwa...@google.com

Chromium LUCI CQ submitted the change

Change information

Commit message:
[EncapsulateAnimations] Re-enable optional button transitions

Re-enable optional button transitions.
-Update the OptionalButton flow to be aware of the ToolbarPhone
transitions. If an OptionalButton transition starts, then immediately
end the URL focus transition, and restart with updated widths.
-Similarly, use the OptionalButton transition state to calculate the
LocationBar width, etc. accordingly.

Before: http://go/scrcast/NTcxNzIwNDY2OTU2Mjg4MHxhOTNhMjkwNy1hNQ
After: http://go/scrcast/NTA3NTg2NDMxNTIzMjI1Nnw2YzA5NGE4Mi04Ng
Bug: 425817689
Change-Id: I6ecb4bb416efc949737cba7098004ebbc6983817
Reviewed-by: Salvador Guerrero Ramos <sa...@google.com>
Commit-Queue: Neil Coronado <ne...@google.com>
Cr-Commit-Position: refs/heads/main@{#1558895}
Files:
  • M chrome/browser/ui/android/toolbar/java/src/org/chromium/chrome/browser/toolbar/optional_button/OptionalButtonCoordinator.java
  • M chrome/browser/ui/android/toolbar/java/src/org/chromium/chrome/browser/toolbar/optional_button/OptionalButtonMediator.java
  • M chrome/browser/ui/android/toolbar/java/src/org/chromium/chrome/browser/toolbar/optional_button/OptionalButtonProperties.java
  • M chrome/browser/ui/android/toolbar/java/src/org/chromium/chrome/browser/toolbar/optional_button/OptionalButtonView.java
  • M chrome/browser/ui/android/toolbar/java/src/org/chromium/chrome/browser/toolbar/optional_button/OptionalButtonViewBinder.java
  • M chrome/browser/ui/android/toolbar/java/src/org/chromium/chrome/browser/toolbar/optional_button/OptionalButtonViewTest.java
  • M chrome/browser/ui/android/toolbar/java/src/org/chromium/chrome/browser/toolbar/top/ToolbarPhone.java
Change size: M
Delta: 7 files changed, 137 insertions(+), 19 deletions(-)
Branch: refs/heads/main
Submit Requirements:
  • requirement satisfiedCode-Review: +1 by Salvador Guerrero Ramos
Open in Gerrit
Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. DiffyGerrit
Gerrit-MessageType: merged
Gerrit-Project: chromium/src
Gerrit-Branch: main
Gerrit-Change-Id: I6ecb4bb416efc949737cba7098004ebbc6983817
Gerrit-Change-Number: 7214947
Gerrit-PatchSet: 4
Gerrit-Owner: Neil Coronado <ne...@google.com>
Gerrit-Reviewer: Chromium LUCI CQ <chromiu...@luci-project-accounts.iam.gserviceaccount.com>
Gerrit-Reviewer: Neil Coronado <ne...@google.com>
Gerrit-Reviewer: Salvador Guerrero Ramos <sa...@google.com>
Gerrit-Reviewer: Sirisha Kavuluru <skav...@google.com>
open
diffy
satisfied_requirement
Reply all
Reply to author
Forward
0 new messages