Fix status mismatch on multiple overscrolls [chromium/src : main]

0 views
Skip to first unread message

Fuhsin Liao (Gerrit)

unread,
Jun 18, 2026, 1:09:47 PM (7 days ago) Jun 18
to Grace Cham, Jonathan Ross, Wenyu Fu, Chromium LUCI CQ, chromium...@chromium.org
Attention needed from Grace Cham, Jonathan Ross and Wenyu Fu

Fuhsin Liao voted and added 1 comment

Votes added by Fuhsin Liao

Auto-Submit+1
Commit-Queue+1

1 comment

Patchset-level comments
File-level comment, Patchset 2 (Latest):
Fuhsin Liao . resolved

Hi I will be on a long weekend and will be back on Monday(June 22nd)
I will be unable to modify the code, but perhaps can reply to questions and messages. We can upload this first if the crash is urgent; We can also wait until I'm back for more discussion. Depends on the urgency~

Open in Gerrit

Related details

Attention is currently required from:
  • Grace Cham
  • Jonathan Ross
  • Wenyu Fu
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: Ifec269e3d95edd9113f26c565bfe4787cc21c618
Gerrit-Change-Number: 7961740
Gerrit-PatchSet: 2
Gerrit-Owner: Fuhsin Liao <fuhsi...@google.com>
Gerrit-Reviewer: Fuhsin Liao <fuhsi...@google.com>
Gerrit-Reviewer: Grace Cham <hsc...@chromium.org>
Gerrit-Reviewer: Jonathan Ross <jon...@chromium.org>
Gerrit-Reviewer: Wenyu Fu <wen...@chromium.org>
Gerrit-Attention: Jonathan Ross <jon...@chromium.org>
Gerrit-Attention: Grace Cham <hsc...@chromium.org>
Gerrit-Attention: Wenyu Fu <wen...@chromium.org>
Gerrit-Comment-Date: Thu, 18 Jun 2026 17:09:17 +0000
Gerrit-HasComments: Yes
Gerrit-Has-Labels: Yes
satisfied_requirement
unsatisfied_requirement
open
diffy

Jonathan Ross (Gerrit)

unread,
Jun 18, 2026, 1:46:12 PM (7 days ago) Jun 18
to Fuhsin Liao, Grace Cham, Wenyu Fu, Chromium LUCI CQ, chromium...@chromium.org
Attention needed from Fuhsin Liao, Grace Cham and Wenyu Fu

Jonathan Ross voted and added 3 comments

Votes added by Jonathan Ross

Code-Review+1

3 comments

Patchset-level comments
Jonathan Ross . resolved

LGTM with nit and forward looking question. I'll be on leave Jun 20-Aug 31 so won't be available for follow ups

Commit Message
Line 24, Patchset 2 (Latest):We could do the following to fix the crash: 1. Clear the
active_action_'s state when the status is set to kDisabled 2. Add a if
Jonathan Ross . unresolved

Should we do this anyways for correctness? Should we consider having `active_action` and `status` in a struct if they are tightly coupled? To make it clear to update them together in the future

File ui/android/overscroll_refresh.cc
Line 99, Patchset 2 (Latest): if (scroll_consumption_state_ !=
ScrollConsumptionState::kAwaitingScrollUpdateAck) {
return;
}
Jonathan Ross . unresolved

This could just be able the `MaybeDisableScrollConsumption` call

Open in Gerrit

Related details

Attention is currently required from:
  • Fuhsin Liao
  • Grace Cham
  • Wenyu Fu
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: Ifec269e3d95edd9113f26c565bfe4787cc21c618
Gerrit-Change-Number: 7961740
Gerrit-PatchSet: 2
Gerrit-Owner: Fuhsin Liao <fuhsi...@google.com>
Gerrit-Reviewer: Fuhsin Liao <fuhsi...@google.com>
Gerrit-Reviewer: Grace Cham <hsc...@chromium.org>
Gerrit-Reviewer: Jonathan Ross <jon...@chromium.org>
Gerrit-Reviewer: Wenyu Fu <wen...@chromium.org>
Gerrit-Attention: Grace Cham <hsc...@chromium.org>
Gerrit-Attention: Fuhsin Liao <fuhsi...@google.com>
Gerrit-Attention: Wenyu Fu <wen...@chromium.org>
Gerrit-Comment-Date: Thu, 18 Jun 2026 17:45:52 +0000
Gerrit-HasComments: Yes
Gerrit-Has-Labels: Yes
satisfied_requirement
unsatisfied_requirement
open
diffy

Fuhsin Liao (Gerrit)

unread,
Jun 18, 2026, 2:01:46 PM (7 days ago) Jun 18
to Jonathan Ross, Grace Cham, Wenyu Fu, Chromium LUCI CQ, chromium...@chromium.org
Attention needed from Grace Cham, Jonathan Ross and Wenyu Fu

Fuhsin Liao voted and added 2 comments

Votes added by Fuhsin Liao

Auto-Submit+1
Commit-Queue+1

2 comments

Commit Message
Line 24, Patchset 2:We could do the following to fix the crash: 1. Clear the

active_action_'s state when the status is set to kDisabled 2. Add a if
Jonathan Ross . unresolved

Should we do this anyways for correctness? Should we consider having `active_action` and `status` in a struct if they are tightly coupled? To make it clear to update them together in the future

Fuhsin Liao

Hi I just realized there's a logic mistake in my previous patch. Please checked the latest code and commit description. Sorry for the trouble!
Yes we can consider putting active_action and status together~ Unfortunately I need to get offline now :( Will fix this in either this cl or the next(Depends on the urgency)

File ui/android/overscroll_refresh.cc
Line 99, Patchset 2: if (scroll_consumption_state_ !=
ScrollConsumptionState::kAwaitingScrollUpdateAck) {
return;
}
Jonathan Ross . resolved

This could just be able the `MaybeDisableScrollConsumption` call

Fuhsin Liao

Same as aboved. I've changed the code due to my logic mistake in the previous patch, please check the latest patch & description, thanks~!

Open in Gerrit

Related details

Attention is currently required from:
  • Grace Cham
  • Jonathan Ross
  • Wenyu Fu
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: Ifec269e3d95edd9113f26c565bfe4787cc21c618
Gerrit-Change-Number: 7961740
Gerrit-PatchSet: 4
Gerrit-Owner: Fuhsin Liao <fuhsi...@google.com>
Gerrit-Reviewer: Fuhsin Liao <fuhsi...@google.com>
Gerrit-Reviewer: Grace Cham <hsc...@chromium.org>
Gerrit-Reviewer: Jonathan Ross <jon...@chromium.org>
Gerrit-Reviewer: Wenyu Fu <wen...@chromium.org>
Gerrit-Attention: Jonathan Ross <jon...@chromium.org>
Gerrit-Attention: Grace Cham <hsc...@chromium.org>
Gerrit-Attention: Wenyu Fu <wen...@chromium.org>
Gerrit-Comment-Date: Thu, 18 Jun 2026 18:01:05 +0000
Gerrit-HasComments: Yes
Gerrit-Has-Labels: Yes
Comment-In-Reply-To: Jonathan Ross <jon...@chromium.org>
satisfied_requirement
unsatisfied_requirement
open
diffy

Jonathan Ross (Gerrit)

unread,
Jun 18, 2026, 2:44:19 PM (7 days ago) Jun 18
to Fuhsin Liao, Grace Cham, Wenyu Fu, Chromium LUCI CQ, chromium...@chromium.org
Attention needed from Fuhsin Liao, Grace Cham and Wenyu Fu

Jonathan Ross voted and added 1 comment

Votes added by Jonathan Ross

Code-Review+1

1 comment

Patchset-level comments
File-level comment, Patchset 4 (Latest):
Jonathan Ross . resolved

Update LGTM

Open in Gerrit

Related details

Attention is currently required from:
  • Fuhsin Liao
  • Grace Cham
  • Wenyu Fu
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: Ifec269e3d95edd9113f26c565bfe4787cc21c618
Gerrit-Change-Number: 7961740
Gerrit-PatchSet: 4
Gerrit-Owner: Fuhsin Liao <fuhsi...@google.com>
Gerrit-Reviewer: Fuhsin Liao <fuhsi...@google.com>
Gerrit-Reviewer: Grace Cham <hsc...@chromium.org>
Gerrit-Reviewer: Jonathan Ross <jon...@chromium.org>
Gerrit-Reviewer: Wenyu Fu <wen...@chromium.org>
Gerrit-Attention: Grace Cham <hsc...@chromium.org>
Gerrit-Attention: Fuhsin Liao <fuhsi...@google.com>
Gerrit-Attention: Wenyu Fu <wen...@chromium.org>
Gerrit-Comment-Date: Thu, 18 Jun 2026 18:43:59 +0000
Gerrit-HasComments: Yes
Gerrit-Has-Labels: Yes
satisfied_requirement
unsatisfied_requirement
open
diffy

Grace Cham (Gerrit)

unread,
Jun 18, 2026, 10:07:54 PM (6 days ago) Jun 18
to Fuhsin Liao, Jonathan Ross, Wenyu Fu, Chromium LUCI CQ, chromium...@chromium.org
Attention needed from Fuhsin Liao and Wenyu Fu

Grace Cham added 3 comments

Commit Message
Line 7, Patchset 4 (Latest):Fix status mismatch on multiple overscrolls

This cl is to fix the crash at http://crash/bcba3320a4b640b2

The reason for the crash: In my previous cl, crrev.com/c/7931727,
overscroll_refresh.cc's line 77, the newly added var. active_action_ and
existing var. ScrollConsumptionState are coupled together. Basically
line 77 is saying active_action_ will only be not null if
ScrollConsumptionState is kEnabled. However, I omit a situation where
kDisabled and active_action_.has_value() can coexist. That is when a
user performs a valid overscroll for the first time, the status will be
set to kEnabled and active_action_.has_value(). Before releasing
fingers, if a user performs another invalid overscroll, then the status
will be set to kDisabled in MaybeDisableScrollConsumption() function,
while the active_action_ is left uncleared, and thus causing the crash
in line 77.

The current solution is to clear the active_action_ state when the
status is set to kDisabled. Since the whole
MaybeDisableScrollConsumption() function only checks for vertical
scroll, I add a if(action == kHistoryNavigation) return at the beginning
of the function, to avoid affecting horizontal scrolls' result.

With the current fix, the original logic is perfectly kept, and didn't
affect vertical/horizontal scrolls on touchpad nor on touchscreen.
Grace Cham . unresolved

I think the commit message currently is so verbose that makes it hard to understand what it is trying dto do, especially for future readers who only see this commit and not aware of the two prior CLs.
It will be more helpful to only include: what is wrong, and what was done to fix it. Maybe something like

```
Unset active action when disable on-going vertical overscroll

crrev.com/c/7931727 introduced a CHECK in OnScrollEnd() to make sure state management is accurate that there should be no active action if ScrollConsumptionState is not enabled.
The CHECK fails because MaybeDisableScrollConsumption() could set consumption state to disabled while there's an on-going overscroll.
```

Have you checked if there are other instances where only active_action_ is changed, or only scroll_consumption_state_ is changed, to make sure the CHECK won't crash for any other cases?
Agree with Jon that we should just couple the two if possible to avoid this happening in the future.

Line 33, Patchset 4 (Latest):Test: Wrote temporary unit tests to successfully reproduce the crash, and use the same test to test against this cl, passed.
Grace Cham . unresolved

Should we just keep the unit test?

File ui/android/overscroll_refresh.cc
Line 165, Patchset 4 (Latest): if (active_action_.has_value() &&
active_action_->action == OverscrollAction::kHistoryNavigation) {
Grace Cham . unresolved

The new comment below says the update is for vertical overscroll only, could it also early return here if there's no active_action_ then?

Stepping back, why do we need this new condition? Commit message says
```
Since the whole
MaybeDisableScrollConsumption() function only checks for vertical
scroll, I add a if(action == kHistoryNavigation) return at the beginning
of the function, to avoid affecting horizontal scrolls' result.
```

Digging the history a bit, this function `MaybeDisableScrollConsumption` was originally added to guard the case that an intermediate scroll update is against the action indicated by their start position (abort effect), for vertical scrolls specifically. See the diff in crrev.com/c/1249530.
At that time, the function is only called by `WillHandleScrollUpdate` when still `kAwaitingScrollUpdateAck`. `WillHandleScrollUpdate` basically splits a scroll sequence into two parts: (1) before overscroll, it might call change consumption state to disable (by `MaybeDisableScrollConsumption`) and not handle further scroll updates at all, (2) after overscroll, consumes scroll deltas and pass to java.
crrev.com/c/6352218 introduced `MaybeDisableScrollConsumption` call in `OnOverscrolled` but IIUC that only happens once in a scroll sequence when it first crosses the overscroll threshold, so it could conceptually be seen as (1) above.

I feel like `MaybeDisableScrollConsumption` implicitly assumed that there is no on going overscroll active action (hence the `is_pull_to_refresh` and `is_pull_from_bottom_edge` is a guess of what user was trying to do if they eventually overscrolls, instead of checking the OverscrollAction type/ edge which will only be set when they overscroll).

```
when a user performs a valid overscroll for the first time, the status will be
set to kEnabled and active_action_.has_value(). Before releasing
fingers, if a user performs another invalid overscroll, then the status
will be set to kDisabled in MaybeDisableScrollConsumption() function,
while the active_action_ is left uncleared, and thus causing the crash
in line 77.
```
you mentioned this in your commit message, how does user performs another invalid overscroll?

Open in Gerrit

Related details

Attention is currently required from:
  • Fuhsin Liao
  • Wenyu Fu
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: Ifec269e3d95edd9113f26c565bfe4787cc21c618
Gerrit-Change-Number: 7961740
Gerrit-PatchSet: 4
Gerrit-Owner: Fuhsin Liao <fuhsi...@google.com>
Gerrit-Reviewer: Fuhsin Liao <fuhsi...@google.com>
Gerrit-Reviewer: Grace Cham <hsc...@chromium.org>
Gerrit-Reviewer: Jonathan Ross <jon...@chromium.org>
Gerrit-Reviewer: Wenyu Fu <wen...@chromium.org>
Gerrit-Attention: Fuhsin Liao <fuhsi...@google.com>
Gerrit-Attention: Wenyu Fu <wen...@chromium.org>
Gerrit-Comment-Date: Fri, 19 Jun 2026 02:07:15 +0000
Gerrit-HasComments: Yes
Gerrit-Has-Labels: No
satisfied_requirement
unsatisfied_requirement
open
diffy

Fuhsin Liao (Gerrit)

unread,
Jun 23, 2026, 3:13:57 AM (2 days ago) Jun 23
to Jonathan Ross, Grace Cham, Wenyu Fu, Chromium LUCI CQ, chromium...@chromium.org
Attention needed from Grace Cham, Jonathan Ross and Wenyu Fu

Fuhsin Liao voted and added 3 comments

Votes added by Fuhsin Liao

Auto-Submit+0

3 comments

Commit Message
Line 7, Patchset 4:Fix status mismatch on multiple overscrolls


This cl is to fix the crash at http://crash/bcba3320a4b640b2

The reason for the crash: In my previous cl, crrev.com/c/7931727,
overscroll_refresh.cc's line 77, the newly added var. active_action_ and
existing var. ScrollConsumptionState are coupled together. Basically
line 77 is saying active_action_ will only be not null if
ScrollConsumptionState is kEnabled. However, I omit a situation where
kDisabled and active_action_.has_value() can coexist. That is when a
user performs a valid overscroll for the first time, the status will be
set to kEnabled and active_action_.has_value(). Before releasing
fingers, if a user performs another invalid overscroll, then the status
will be set to kDisabled in MaybeDisableScrollConsumption() function,
while the active_action_ is left uncleared, and thus causing the crash
in line 77.

The current solution is to clear the active_action_ state when the
status is set to kDisabled. Since the whole
MaybeDisableScrollConsumption() function only checks for vertical
scroll, I add a if(action == kHistoryNavigation) return at the beginning
of the function, to avoid affecting horizontal scrolls' result.

With the current fix, the original logic is perfectly kept, and didn't
affect vertical/horizontal scrolls on touchpad nor on touchscreen.
Grace Cham . resolved

I think the commit message currently is so verbose that makes it hard to understand what it is trying dto do, especially for future readers who only see this commit and not aware of the two prior CLs.
It will be more helpful to only include: what is wrong, and what was done to fix it. Maybe something like

```
Unset active action when disable on-going vertical overscroll

crrev.com/c/7931727 introduced a CHECK in OnScrollEnd() to make sure state management is accurate that there should be no active action if ScrollConsumptionState is not enabled.
The CHECK fails because MaybeDisableScrollConsumption() could set consumption state to disabled while there's an on-going overscroll.
```

Have you checked if there are other instances where only active_action_ is changed, or only scroll_consumption_state_ is changed, to make sure the CHECK won't crash for any other cases?
Agree with Jon that we should just couple the two if possible to avoid this happening in the future.

Fuhsin Liao

Yes I've checked both by myself and with AI that, this crash will very likely happen in this case~
If there're other cases coming after(tho can't think of any now), we can still fix them then!
Changed the cl description and merge 'scroll_consumption_state_' and 'active_action_' into a struct

Line 33, Patchset 4:Test: Wrote temporary unit tests to successfully reproduce the crash, and use the same test to test against this cl, passed.
Grace Cham . resolved

Should we just keep the unit test?

Fuhsin Liao

Done

File ui/android/overscroll_refresh.cc
Line 165, Patchset 4: if (active_action_.has_value() &&

active_action_->action == OverscrollAction::kHistoryNavigation) {
Grace Cham . unresolved

The new comment below says the update is for vertical overscroll only, could it also early return here if there's no active_action_ then?

Stepping back, why do we need this new condition? Commit message says
```
Since the whole
MaybeDisableScrollConsumption() function only checks for vertical
scroll, I add a if(action == kHistoryNavigation) return at the beginning
of the function, to avoid affecting horizontal scrolls' result.
```

Digging the history a bit, this function `MaybeDisableScrollConsumption` was originally added to guard the case that an intermediate scroll update is against the action indicated by their start position (abort effect), for vertical scrolls specifically. See the diff in crrev.com/c/1249530.
At that time, the function is only called by `WillHandleScrollUpdate` when still `kAwaitingScrollUpdateAck`. `WillHandleScrollUpdate` basically splits a scroll sequence into two parts: (1) before overscroll, it might call change consumption state to disable (by `MaybeDisableScrollConsumption`) and not handle further scroll updates at all, (2) after overscroll, consumes scroll deltas and pass to java.
crrev.com/c/6352218 introduced `MaybeDisableScrollConsumption` call in `OnOverscrolled` but IIUC that only happens once in a scroll sequence when it first crosses the overscroll threshold, so it could conceptually be seen as (1) above.

I feel like `MaybeDisableScrollConsumption` implicitly assumed that there is no on going overscroll active action (hence the `is_pull_to_refresh` and `is_pull_from_bottom_edge` is a guess of what user was trying to do if they eventually overscrolls, instead of checking the OverscrollAction type/ edge which will only be set when they overscroll).

```
when a user performs a valid overscroll for the first time, the status will be
set to kEnabled and active_action_.has_value(). Before releasing
fingers, if a user performs another invalid overscroll, then the status
will be set to kDisabled in MaybeDisableScrollConsumption() function,
while the active_action_ is left uncleared, and thus causing the crash
in line 77.
```
you mentioned this in your commit message, how does user performs another invalid overscroll?

Fuhsin Liao

Actually OnOverscrolled will be called many times even after "it first crosses the overscroll threshold". I think OnOverscrolled will be called only once is the case before you fixed at crrev.com/c/7867154. Now whenever user overscrolls, before users lifting their fingers, the overscroll() function will be continuously called with new accumulated_overscroll values.

Open in Gerrit

Related details

Attention is currently required from:
  • Grace Cham
  • Jonathan Ross
  • Wenyu Fu
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: Ifec269e3d95edd9113f26c565bfe4787cc21c618
Gerrit-Change-Number: 7961740
Gerrit-PatchSet: 6
Gerrit-Owner: Fuhsin Liao <fuhsi...@google.com>
Gerrit-Reviewer: Fuhsin Liao <fuhsi...@google.com>
Gerrit-Reviewer: Grace Cham <hsc...@chromium.org>
Gerrit-Reviewer: Jonathan Ross <jon...@chromium.org>
Gerrit-Reviewer: Wenyu Fu <wen...@chromium.org>
Gerrit-Attention: Jonathan Ross <jon...@chromium.org>
Gerrit-Attention: Grace Cham <hsc...@chromium.org>
Gerrit-Attention: Wenyu Fu <wen...@chromium.org>
Gerrit-Comment-Date: Tue, 23 Jun 2026 07:13:29 +0000
Gerrit-HasComments: Yes
Gerrit-Has-Labels: Yes
Comment-In-Reply-To: Grace Cham <hsc...@chromium.org>
satisfied_requirement
unsatisfied_requirement
open
diffy

Fuhsin Liao (Gerrit)

unread,
Jun 23, 2026, 3:14:36 AM (2 days ago) Jun 23
to Jonathan Ross, Grace Cham, Wenyu Fu, Chromium LUCI CQ, chromium...@chromium.org
Attention needed from Grace Cham, Jonathan Ross and Wenyu Fu

Fuhsin Liao added 1 comment

Commit Message
Line 24, Patchset 2:We could do the following to fix the crash: 1. Clear the
active_action_'s state when the status is set to kDisabled 2. Add a if
Jonathan Ross . resolved

Should we do this anyways for correctness? Should we consider having `active_action` and `status` in a struct if they are tightly coupled? To make it clear to update them together in the future

Fuhsin Liao

Hi I just realized there's a logic mistake in my previous patch. Please checked the latest code and commit description. Sorry for the trouble!
Yes we can consider putting active_action and status together~ Unfortunately I need to get offline now :( Will fix this in either this cl or the next(Depends on the urgency)

Fuhsin Liao

Done

Gerrit-Comment-Date: Tue, 23 Jun 2026 07:14:03 +0000
Gerrit-HasComments: Yes
Gerrit-Has-Labels: No
Comment-In-Reply-To: Jonathan Ross <jon...@chromium.org>
Comment-In-Reply-To: Fuhsin Liao <fuhsi...@google.com>
satisfied_requirement
unsatisfied_requirement
open
diffy

Jinsuk Kim (Gerrit)

unread,
Jun 23, 2026, 11:12:42 AM (2 days ago) Jun 23
to Fuhsin Liao, Grace Cham, Wenyu Fu, Chromium LUCI CQ, chromium...@chromium.org
Attention needed from Fuhsin Liao, Grace Cham and Wenyu Fu

Jinsuk Kim voted Code-Review+1

Code-Review+1
Open in Gerrit

Related details

Attention is currently required from:
  • Fuhsin Liao
  • Grace Cham
  • Wenyu Fu
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: Ifec269e3d95edd9113f26c565bfe4787cc21c618
Gerrit-Change-Number: 7961740
Gerrit-PatchSet: 6
Gerrit-Owner: Fuhsin Liao <fuhsi...@google.com>
Gerrit-Reviewer: Fuhsin Liao <fuhsi...@google.com>
Gerrit-Reviewer: Grace Cham <hsc...@chromium.org>
Gerrit-Reviewer: Jinsuk Kim <jins...@chromium.org>
Gerrit-Reviewer: Wenyu Fu <wen...@chromium.org>
Gerrit-Attention: Grace Cham <hsc...@chromium.org>
Gerrit-Attention: Fuhsin Liao <fuhsi...@google.com>
Gerrit-Attention: Wenyu Fu <wen...@chromium.org>
Gerrit-Comment-Date: Tue, 23 Jun 2026 15:12:21 +0000
Gerrit-HasComments: No
Gerrit-Has-Labels: Yes
satisfied_requirement
unsatisfied_requirement
open
diffy

Grace Cham (Gerrit)

unread,
Jun 23, 2026, 10:11:25 PM (2 days ago) Jun 23
to Fuhsin Liao, Jinsuk Kim, Wenyu Fu, Chromium LUCI CQ, chromium...@chromium.org
Attention needed from Fuhsin Liao and Wenyu Fu

Grace Cham added 5 comments

File ui/android/overscroll_refresh.cc
Line 74, Patchset 6 (Latest): scroll_state_.scroll_consumption_state =
ScrollConsumptionState::kAwaitingScrollUpdateAck;
Grace Cham . unresolved

Isn't it defeating the purpose of having ScrollState as a struct if the code could update the internal state independently without going through ScrollState anyways?
I think the properties should be write only through ScrollState methods so action and consumption state are consistent.
Alternatively, wondering if we should use std::variant.

Line 82, Patchset 6 (Latest): CHECK(!scroll_state_.active_action.has_value());
Grace Cham . unresolved

We wouldn't need this CHECK if it's enforced by ScrollState internally

Line 95, Patchset 6 (Latest): if (scroll_state_.scroll_consumption_state !=
ScrollConsumptionState::kAwaitingScrollUpdateAck) {
Grace Cham . unresolved

Not a regression but could probably use OverscrollRefresh::IsAwaitingScrollUpdateAck()?

Line 165, Patchset 4: if (active_action_.has_value() &&
active_action_->action == OverscrollAction::kHistoryNavigation) {
Grace Cham . unresolved

The new comment below says the update is for vertical overscroll only, could it also early return here if there's no active_action_ then?

Stepping back, why do we need this new condition? Commit message says
```
Since the whole
MaybeDisableScrollConsumption() function only checks for vertical
scroll, I add a if(action == kHistoryNavigation) return at the beginning
of the function, to avoid affecting horizontal scrolls' result.
```

Digging the history a bit, this function `MaybeDisableScrollConsumption` was originally added to guard the case that an intermediate scroll update is against the action indicated by their start position (abort effect), for vertical scrolls specifically. See the diff in crrev.com/c/1249530.
At that time, the function is only called by `WillHandleScrollUpdate` when still `kAwaitingScrollUpdateAck`. `WillHandleScrollUpdate` basically splits a scroll sequence into two parts: (1) before overscroll, it might call change consumption state to disable (by `MaybeDisableScrollConsumption`) and not handle further scroll updates at all, (2) after overscroll, consumes scroll deltas and pass to java.
crrev.com/c/6352218 introduced `MaybeDisableScrollConsumption` call in `OnOverscrolled` but IIUC that only happens once in a scroll sequence when it first crosses the overscroll threshold, so it could conceptually be seen as (1) above.

I feel like `MaybeDisableScrollConsumption` implicitly assumed that there is no on going overscroll active action (hence the `is_pull_to_refresh` and `is_pull_from_bottom_edge` is a guess of what user was trying to do if they eventually overscrolls, instead of checking the OverscrollAction type/ edge which will only be set when they overscroll).

```
when a user performs a valid overscroll for the first time, the status will be
set to kEnabled and active_action_.has_value(). Before releasing
fingers, if a user performs another invalid overscroll, then the status
will be set to kDisabled in MaybeDisableScrollConsumption() function,
while the active_action_ is left uncleared, and thus causing the crash
in line 77.
```
you mentioned this in your commit message, how does user performs another invalid overscroll?

Fuhsin Liao

Actually OnOverscrolled will be called many times even after "it first crosses the overscroll threshold". I think OnOverscrolled will be called only once is the case before you fixed at crrev.com/c/7867154. Now whenever user overscrolls, before users lifting their fingers, the overscroll() function will be continuously called with new accumulated_overscroll values.

Grace Cham

I see, so this function is meant to be a recurring check throughout the scroll sequence before and after overscroll occurred. (Don't really see why crrev.com/c/7867154 will affect this though... That is independent to how overscroll works just determination of scroll update vs end events)

IIUC, prior to this new early return condition, the check means if user has started horizontal overscroll, then (while keeping fingers on scrollpad) started going all directions say drawing circles, the horizontal overscroll will be cancelled if the total accumulated y is larger than x, and the y direction (up/ down) is not consistent with the starting y-position (top/ bottom edge).
I agree with you that early returning for horizontal overscroll is correct in terms of user-facing behavior, since the cancellation conditions are very specific to vertical direction, just not sure if we want to include it in this change that's for fixing the state mismatch. No strong opinion.

Line 240, Patchset 6 (Latest): if (scroll_state_.scroll_consumption_state ==
ScrollConsumptionState::kEnabled) {
Grace Cham . unresolved

ditto: maybe use OverscrollRefresh::IsActive()?

Open in Gerrit

Related details

Attention is currently required from:
  • Fuhsin Liao
  • Wenyu Fu
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: Ifec269e3d95edd9113f26c565bfe4787cc21c618
Gerrit-Change-Number: 7961740
Gerrit-PatchSet: 6
Gerrit-Owner: Fuhsin Liao <fuhsi...@google.com>
Gerrit-Reviewer: Fuhsin Liao <fuhsi...@google.com>
Gerrit-Reviewer: Grace Cham <hsc...@chromium.org>
Gerrit-Reviewer: Jinsuk Kim <jins...@chromium.org>
Gerrit-Reviewer: Wenyu Fu <wen...@chromium.org>
Gerrit-Attention: Fuhsin Liao <fuhsi...@google.com>
Gerrit-Attention: Wenyu Fu <wen...@chromium.org>
Gerrit-Comment-Date: Wed, 24 Jun 2026 02:10:51 +0000
Gerrit-HasComments: Yes
Gerrit-Has-Labels: No
Comment-In-Reply-To: Grace Cham <hsc...@chromium.org>
Comment-In-Reply-To: Fuhsin Liao <fuhsi...@google.com>
satisfied_requirement
unsatisfied_requirement
open
diffy

Fuhsin Liao (Gerrit)

unread,
Jun 24, 2026, 4:45:46 AM (23 hours ago) Jun 24
to Jinsuk Kim, Grace Cham, Wenyu Fu, Chromium LUCI CQ, chromium...@chromium.org
Attention needed from Grace Cham and Wenyu Fu

Fuhsin Liao added 5 comments

File ui/android/overscroll_refresh.cc
Line 74, Patchset 6: scroll_state_.scroll_consumption_state =
ScrollConsumptionState::kAwaitingScrollUpdateAck;
Grace Cham . resolved

Isn't it defeating the purpose of having ScrollState as a struct if the code could update the internal state independently without going through ScrollState anyways?
I think the properties should be write only through ScrollState methods so action and consumption state are consistent.
Alternatively, wondering if we should use std::variant.

Fuhsin Liao

Thanks for the suggestion! Never heard of std::variant before and try to use it for the first time. Please check if the current implementation is what you have in mind~

Line 82, Patchset 6: CHECK(!scroll_state_.active_action.has_value());
Grace Cham . resolved

We wouldn't need this CHECK if it's enforced by ScrollState internally

Fuhsin Liao

Done

Line 95, Patchset 6: if (scroll_state_.scroll_consumption_state !=
ScrollConsumptionState::kAwaitingScrollUpdateAck) {
Grace Cham . resolved

Not a regression but could probably use OverscrollRefresh::IsAwaitingScrollUpdateAck()?

Fuhsin Liao

Done. Did the same thing for KEnabled too

Line 165, Patchset 4: if (active_action_.has_value() &&
active_action_->action == OverscrollAction::kHistoryNavigation) {
Grace Cham . resolved

The new comment below says the update is for vertical overscroll only, could it also early return here if there's no active_action_ then?

Stepping back, why do we need this new condition? Commit message says
```
Since the whole
MaybeDisableScrollConsumption() function only checks for vertical
scroll, I add a if(action == kHistoryNavigation) return at the beginning
of the function, to avoid affecting horizontal scrolls' result.
```

Digging the history a bit, this function `MaybeDisableScrollConsumption` was originally added to guard the case that an intermediate scroll update is against the action indicated by their start position (abort effect), for vertical scrolls specifically. See the diff in crrev.com/c/1249530.
At that time, the function is only called by `WillHandleScrollUpdate` when still `kAwaitingScrollUpdateAck`. `WillHandleScrollUpdate` basically splits a scroll sequence into two parts: (1) before overscroll, it might call change consumption state to disable (by `MaybeDisableScrollConsumption`) and not handle further scroll updates at all, (2) after overscroll, consumes scroll deltas and pass to java.
crrev.com/c/6352218 introduced `MaybeDisableScrollConsumption` call in `OnOverscrolled` but IIUC that only happens once in a scroll sequence when it first crosses the overscroll threshold, so it could conceptually be seen as (1) above.

I feel like `MaybeDisableScrollConsumption` implicitly assumed that there is no on going overscroll active action (hence the `is_pull_to_refresh` and `is_pull_from_bottom_edge` is a guess of what user was trying to do if they eventually overscrolls, instead of checking the OverscrollAction type/ edge which will only be set when they overscroll).

```
when a user performs a valid overscroll for the first time, the status will be
set to kEnabled and active_action_.has_value(). Before releasing
fingers, if a user performs another invalid overscroll, then the status
will be set to kDisabled in MaybeDisableScrollConsumption() function,
while the active_action_ is left uncleared, and thus causing the crash
in line 77.
```
you mentioned this in your commit message, how does user performs another invalid overscroll?

Fuhsin Liao

Actually OnOverscrolled will be called many times even after "it first crosses the overscroll threshold". I think OnOverscrolled will be called only once is the case before you fixed at crrev.com/c/7867154. Now whenever user overscrolls, before users lifting their fingers, the overscroll() function will be continuously called with new accumulated_overscroll values.

Grace Cham

I see, so this function is meant to be a recurring check throughout the scroll sequence before and after overscroll occurred. (Don't really see why crrev.com/c/7867154 will affect this though... That is independent to how overscroll works just determination of scroll update vs end events)

IIUC, prior to this new early return condition, the check means if user has started horizontal overscroll, then (while keeping fingers on scrollpad) started going all directions say drawing circles, the horizontal overscroll will be cancelled if the total accumulated y is larger than x, and the y direction (up/ down) is not consistent with the starting y-position (top/ bottom edge).
I agree with you that early returning for horizontal overscroll is correct in terms of user-facing behavior, since the cancellation conditions are very specific to vertical direction, just not sure if we want to include it in this change that's for fixing the state mismatch. No strong opinion.

Fuhsin Liao

Exactly! I'd like to keep it in this cl so we don't have to review twice if that's okay~!

Line 240, Patchset 6: if (scroll_state_.scroll_consumption_state ==
ScrollConsumptionState::kEnabled) {
Grace Cham . resolved

ditto: maybe use OverscrollRefresh::IsActive()?

Fuhsin Liao

Done

Open in Gerrit

Related details

Attention is currently required from:
  • Grace Cham
  • Wenyu Fu
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: Ifec269e3d95edd9113f26c565bfe4787cc21c618
    Gerrit-Change-Number: 7961740
    Gerrit-PatchSet: 7
    Gerrit-Owner: Fuhsin Liao <fuhsi...@google.com>
    Gerrit-Reviewer: Fuhsin Liao <fuhsi...@google.com>
    Gerrit-Reviewer: Grace Cham <hsc...@chromium.org>
    Gerrit-Reviewer: Jinsuk Kim <jins...@chromium.org>
    Gerrit-Reviewer: Wenyu Fu <wen...@chromium.org>
    Gerrit-Attention: Grace Cham <hsc...@chromium.org>
    Gerrit-Attention: Wenyu Fu <wen...@chromium.org>
    Gerrit-Comment-Date: Wed, 24 Jun 2026 08:45:00 +0000
    satisfied_requirement
    open
    diffy

    Grace Cham (Gerrit)

    unread,
    Jun 24, 2026, 9:28:27 PM (7 hours ago) Jun 24
    to Fuhsin Liao, Jinsuk Kim, Wenyu Fu, Chromium LUCI CQ, chromium...@chromium.org
    Attention needed from Fuhsin Liao and Wenyu Fu

    Grace Cham voted and added 1 comment

    Votes added by Grace Cham

    Code-Review+1

    1 comment

    Patchset-level comments
    File-level comment, Patchset 7 (Latest):
    Grace Cham . resolved

    Thank you~ (Might want to wait for @jins...@chromium.org to take another look before submitting since PS 6 to 7 changed quite a bit?)

    Open in Gerrit

    Related details

    Attention is currently required from:
    • Fuhsin Liao
    • Wenyu Fu
    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: Ifec269e3d95edd9113f26c565bfe4787cc21c618
    Gerrit-Change-Number: 7961740
    Gerrit-PatchSet: 7
    Gerrit-Owner: Fuhsin Liao <fuhsi...@google.com>
    Gerrit-Reviewer: Fuhsin Liao <fuhsi...@google.com>
    Gerrit-Reviewer: Grace Cham <hsc...@chromium.org>
    Gerrit-Reviewer: Jinsuk Kim <jins...@chromium.org>
    Gerrit-Reviewer: Wenyu Fu <wen...@chromium.org>
    Gerrit-Attention: Fuhsin Liao <fuhsi...@google.com>
    Gerrit-Attention: Wenyu Fu <wen...@chromium.org>
    Gerrit-Comment-Date: Thu, 25 Jun 2026 01:27:36 +0000
    Gerrit-HasComments: Yes
    Gerrit-Has-Labels: Yes
    satisfied_requirement
    open
    diffy

    Fuhsin Liao (Gerrit)

    unread,
    1:19 AM (3 hours ago) 1:19 AM
    to Grace Cham, Jinsuk Kim, Wenyu Fu, Chromium LUCI CQ, chromium...@chromium.org
    Attention needed from Jinsuk Kim and Wenyu Fu

    Fuhsin Liao added 1 comment

    Patchset-level comments
    Fuhsin Liao . resolved

    Hi @jins...@chromium.org, the cl has changed quite a bit since last patch, do you want to take a look again? Thanks~!

    Open in Gerrit

    Related details

    Attention is currently required from:
    • Jinsuk Kim
    • Wenyu Fu
    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: Ifec269e3d95edd9113f26c565bfe4787cc21c618
    Gerrit-Change-Number: 7961740
    Gerrit-PatchSet: 7
    Gerrit-Owner: Fuhsin Liao <fuhsi...@google.com>
    Gerrit-Reviewer: Fuhsin Liao <fuhsi...@google.com>
    Gerrit-Reviewer: Grace Cham <hsc...@chromium.org>
    Gerrit-Reviewer: Jinsuk Kim <jins...@chromium.org>
    Gerrit-Reviewer: Wenyu Fu <wen...@chromium.org>
    Gerrit-Attention: Jinsuk Kim <jins...@chromium.org>
    Gerrit-Attention: Wenyu Fu <wen...@chromium.org>
    Gerrit-Comment-Date: Thu, 25 Jun 2026 05:18:51 +0000
    Gerrit-HasComments: Yes
    Gerrit-Has-Labels: No
    satisfied_requirement
    open
    diffy
    Reply all
    Reply to author
    Forward
    0 new messages