Refactor ElasticOverscrollController to store entries in a base::flat_map [chromium/src : main]

0 views
Skip to first unread message

Free Debreuil (Gerrit)

unread,
Oct 14, 2025, 12:02:59 PM (yesterday) Oct 14
to AI Code Reviewer, Chromium LUCI CQ, chromium...@chromium.org, blink-...@chromium.org, cc-...@chromium.org, kinuko...@chromium.org

Free Debreuil added 2 comments

File third_party/blink/renderer/platform/widget/input/elastic_overscroll_controller.h
Line 233, Patchset 1:
AI Code Reviewer . resolved

Blink Style Guide: Prefer blink:: types over STL and base types. Since ordering of entries does not appear to be a requirement, please use `WTF::HashMap` instead of `base::flat_map`.

_To keep this interaction as brief and non-intrusive as possible, please consider responding with one of following options:
**Done** | **Won't fix**: reason | **b/<bug_id>** | **Invalid:** reason

This comment was generated by [Experimental Blink C++ Code Review Agent](http://go/blink-c++-code-review-agent).AI reviews can sometimes be inaccurate; We appreciate your 🙏 feedback 🙏 to help us improve.[File a bug](http://go/blink-c++-code-review-agent-feedback) | [Provide feedback on chat](https://chat.google.com/room/AAQA0zhQHe0?cls=4) | [Opt-out](https://ganpati2.corp.google.com/group/peep-genai-blink-agent-optout.prod)_

Free Debreuil

Done

Line 115, Patchset 1: return helper_->ScrollBounds(element_id);
AI Code Reviewer . resolved

Blink Style Guide: Naming - Use 'CamelCase' for all function names. Please rename `scroll_velocity` to `ScrollVelocity`. This also applies to the other new getters on lines 118 and 121.

_To keep this interaction as brief and non-intrusive as possible, please consider responding with one of following options:
**Done** | **Won't fix**: reason | **b/<bug_id>** | **Invalid:** reason

This comment was generated by [Experimental Blink C++ Code Review Agent](http://go/blink-c++-code-review-agent).AI reviews can sometimes be inaccurate; We appreciate your 🙏 feedback 🙏 to help us improve.[File a bug](http://go/blink-c++-code-review-agent-feedback) | [Provide feedback on chat](https://chat.google.com/room/AAQA0zhQHe0?cls=4) | [Opt-out](https://ganpati2.corp.google.com/group/peep-genai-blink-agent-optout.prod)_

Free Debreuil

Done

Open in Gerrit

Related details

Attention set is empty
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: I1a5ad8fbcbe3d3f3ee6602b70ea83dfa480fbd55
Gerrit-Change-Number: 7028594
Gerrit-PatchSet: 12
Gerrit-Owner: Free Debreuil <freede...@google.com>
Gerrit-Reviewer: Free Debreuil <freede...@google.com>
Gerrit-CC: AI Code Reviewer <peep-gen...@system.gserviceaccount.com>
Gerrit-Comment-Date: Tue, 14 Oct 2025 16:02:25 +0000
Gerrit-HasComments: Yes
Gerrit-Has-Labels: No
Comment-In-Reply-To: AI Code Reviewer <peep-gen...@system.gserviceaccount.com>
satisfied_requirement
unsatisfied_requirement
open
diffy

Free Debreuil (Gerrit)

unread,
Oct 14, 2025, 12:07:47 PM (yesterday) Oct 14
to Robert Flack, Vladimir Levin, AI Code Reviewer, Chromium LUCI CQ, chromium...@chromium.org, blink-...@chromium.org, cc-...@chromium.org, kinuko...@chromium.org
Attention needed from Robert Flack and Vladimir Levin

Free Debreuil added 1 comment

Patchset-level comments
File-level comment, Patchset 13 (Latest):
Free Debreuil . resolved

PTAL :)

Open in Gerrit

Related details

Attention is currently required from:
  • Robert Flack
  • Vladimir Levin
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: I1a5ad8fbcbe3d3f3ee6602b70ea83dfa480fbd55
Gerrit-Change-Number: 7028594
Gerrit-PatchSet: 13
Gerrit-Owner: Free Debreuil <freede...@google.com>
Gerrit-Reviewer: Free Debreuil <freede...@google.com>
Gerrit-Reviewer: Robert Flack <fla...@chromium.org>
Gerrit-Reviewer: Vladimir Levin <vmp...@chromium.org>
Gerrit-Attention: Robert Flack <fla...@chromium.org>
Gerrit-Attention: Vladimir Levin <vmp...@chromium.org>
Gerrit-Comment-Date: Tue, 14 Oct 2025 16:07:40 +0000
Gerrit-HasComments: Yes
Gerrit-Has-Labels: No
satisfied_requirement
unsatisfied_requirement
open
diffy

Free Debreuil (Gerrit)

unread,
Oct 14, 2025, 12:08:05 PM (yesterday) Oct 14
to Robert Flack, Vladimir Levin, AI Code Reviewer, Chromium LUCI CQ, chromium...@chromium.org, blink-...@chromium.org, cc-...@chromium.org, kinuko...@chromium.org
Gerrit-Comment-Date: Tue, 14 Oct 2025 16:07:58 +0000
Gerrit-HasComments: Yes
Gerrit-Has-Labels: No
satisfied_requirement
unsatisfied_requirement
open
diffy

Vladimir Levin (Gerrit)

unread,
10:19 AM (11 hours ago) 10:19 AM
to Free Debreuil, Robert Flack, AI Code Reviewer, Chromium LUCI CQ, chromium...@chromium.org, blink-...@chromium.org, cc-...@chromium.org, kinuko...@chromium.org
Attention needed from Free Debreuil and Robert Flack

Vladimir Levin added 4 comments

File third_party/blink/renderer/platform/widget/input/elastic_overscroll_controller.h
Line 207, Patchset 16 (Latest): OverscrollEntry& EntryMutable();
Vladimir Levin . unresolved

nit: I'd name this something like GetOrCreateEntry()

Line 108, Patchset 16 (Latest): gfx::Size ScrollBounds() const;
Vladimir Levin . unresolved

I'd add a TODO to add element id into these (and below as well I think)

Line 92, Patchset 16 (Latest): // called and momentum_animation_start_time. Using this information, the
Vladimir Levin . unresolved

nit if you wrap the variable names in backticks (`) in comments, then they will get linkified in codesearch as well

File third_party/blink/renderer/platform/widget/input/elastic_overscroll_controller_bezier.cc
Line 91, Patchset 16 (Latest): fabs(ScrollVelocity().x()) > kIgnoreForwardBounceVelocityThreshold
Vladimir Levin . unresolved

This presumably would do a find on a map for each invocation. In general, all of the getters are likely not going to be used in isolation (ie if I get Foo(element_id) then I'll also get Bar(element_id)).

I think a better pattern would be similar to what you have for EntryMutable(), but named something like const Entry& GetEntry(ElementId). Then all of these functions can get the entry once and use whatever they need from it

Open in Gerrit

Related details

Attention is currently required from:
  • Free Debreuil
  • Robert Flack
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: I1a5ad8fbcbe3d3f3ee6602b70ea83dfa480fbd55
    Gerrit-Change-Number: 7028594
    Gerrit-PatchSet: 16
    Gerrit-Owner: Free Debreuil <freede...@google.com>
    Gerrit-Reviewer: Free Debreuil <freede...@google.com>
    Gerrit-Reviewer: Robert Flack <fla...@chromium.org>
    Gerrit-Reviewer: Vladimir Levin <vmp...@chromium.org>
    Gerrit-CC: AI Code Reviewer <peep-gen...@system.gserviceaccount.com>
    Gerrit-Attention: Free Debreuil <freede...@google.com>
    Gerrit-Attention: Robert Flack <fla...@chromium.org>
    Gerrit-Comment-Date: Wed, 15 Oct 2025 14:19:03 +0000
    Gerrit-HasComments: Yes
    Gerrit-Has-Labels: No
    satisfied_requirement
    unsatisfied_requirement
    open
    diffy

    Robert Flack (Gerrit)

    unread,
    10:59 AM (10 hours ago) 10:59 AM
    to Free Debreuil, Vladimir Levin, AI Code Reviewer, Chromium LUCI CQ, chromium...@chromium.org, blink-...@chromium.org, cc-...@chromium.org, kinuko...@chromium.org
    Attention needed from Free Debreuil

    Robert Flack added 2 comments

    File third_party/blink/renderer/platform/widget/input/elastic_overscroll_controller.h
    Line 207, Patchset 16: OverscrollEntry& EntryMutable();
    Vladimir Levin . unresolved

    nit: I'd name this something like GetOrCreateEntry()

    Robert Flack

    Or EnsureEntry is common elsewhere.

    Line 108, Patchset 16: gfx::Size ScrollBounds() const;
    Vladimir Levin . unresolved

    I'd add a TODO to add element id into these (and below as well I think)

    Robert Flack

    Rather than parameterize all of the methods it may be easier and less verbose if OverscrollEntry was a class with the relevant methods on it. Then consumers could get the entry for the scroller they care about and update it accordingly.

    Open in Gerrit

    Related details

    Attention is currently required from:
    • Free Debreuil
    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: I1a5ad8fbcbe3d3f3ee6602b70ea83dfa480fbd55
    Gerrit-Change-Number: 7028594
    Gerrit-PatchSet: 16
    Gerrit-Owner: Free Debreuil <freede...@google.com>
    Gerrit-Reviewer: Free Debreuil <freede...@google.com>
    Gerrit-Reviewer: Robert Flack <fla...@chromium.org>
    Gerrit-Reviewer: Vladimir Levin <vmp...@chromium.org>
    Gerrit-CC: AI Code Reviewer <peep-gen...@system.gserviceaccount.com>
    Gerrit-Attention: Free Debreuil <freede...@google.com>
    Gerrit-Comment-Date: Wed, 15 Oct 2025 14:59:27 +0000
    Gerrit-HasComments: Yes
    Gerrit-Has-Labels: No
    Comment-In-Reply-To: Vladimir Levin <vmp...@chromium.org>
    satisfied_requirement
    unsatisfied_requirement
    open
    diffy

    Free Debreuil (Gerrit)

    unread,
    3:15 PM (6 hours ago) 3:15 PM
    to Robert Flack, Vladimir Levin, AI Code Reviewer, Chromium LUCI CQ, chromium...@chromium.org, blink-...@chromium.org, cc-...@chromium.org, kinuko...@chromium.org
    Attention needed from Robert Flack and Vladimir Levin

    Free Debreuil voted and added 2 comments

    Votes added by Free Debreuil

    Commit-Queue+1

    2 comments

    File third_party/blink/renderer/platform/widget/input/elastic_overscroll_controller.h
    Line 108, Patchset 16: gfx::Size ScrollBounds() const;
    Vladimir Levin . unresolved

    I'd add a TODO to add element id into these (and below as well I think)

    Robert Flack

    Rather than parameterize all of the methods it may be easier and less verbose if OverscrollEntry was a class with the relevant methods on it. Then consumers could get the entry for the scroller they care about and update it accordingly.

    Free Debreuil

    That could work yes - there is currently a split where some of the functionality is accessed through an entry in the `ElasticOverscrollController` and some through `ScrollElasticityHelper`.

    Would it be reasonable to add a method on `ElasticOverscrollController`:
    ```
    const OverscrollEntry& GetEntry() const;
    ```
    then access the per entry directly off of the struct?

    The `OverscrollEntry` is currently a struct - it's possible it could re-route the `ScrollElasticityHelper` methods as well (nicer API) but that possibly would require duplication of the `ScrollElasticityHelper` pointer per entry, or an additional class that acts like a reference? (maybe there's another way to structure though that I'm not thinking of) 😊

    Line 92, Patchset 16: // called and momentum_animation_start_time. Using this information, the
    Vladimir Levin . unresolved

    nit if you wrap the variable names in backticks (`) in comments, then they will get linkified in codesearch as well

    Free Debreuil

    updated :)

    Open in Gerrit

    Related details

    Attention is currently required from:
    • Robert Flack
    • Vladimir Levin
    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: I1a5ad8fbcbe3d3f3ee6602b70ea83dfa480fbd55
    Gerrit-Change-Number: 7028594
    Gerrit-PatchSet: 18
    Gerrit-Owner: Free Debreuil <freede...@google.com>
    Gerrit-Reviewer: Free Debreuil <freede...@google.com>
    Gerrit-Reviewer: Robert Flack <fla...@chromium.org>
    Gerrit-Reviewer: Vladimir Levin <vmp...@chromium.org>
    Gerrit-CC: AI Code Reviewer <peep-gen...@system.gserviceaccount.com>
    Gerrit-Attention: Robert Flack <fla...@chromium.org>
    Gerrit-Attention: Vladimir Levin <vmp...@chromium.org>
    Gerrit-Comment-Date: Wed, 15 Oct 2025 19:15:39 +0000
    Gerrit-HasComments: Yes
    Gerrit-Has-Labels: Yes
    Comment-In-Reply-To: Robert Flack <fla...@chromium.org>
    Comment-In-Reply-To: Vladimir Levin <vmp...@chromium.org>
    satisfied_requirement
    unsatisfied_requirement
    open
    diffy

    Free Debreuil (Gerrit)

    unread,
    3:16 PM (6 hours ago) 3:16 PM
    to Robert Flack, Vladimir Levin, AI Code Reviewer, Chromium LUCI CQ, chromium...@chromium.org, blink-...@chromium.org, cc-...@chromium.org, kinuko...@chromium.org
    Attention needed from Robert Flack and Vladimir Levin

    Free Debreuil added 1 comment

    File third_party/blink/renderer/platform/widget/input/elastic_overscroll_controller.h
    Line 92, Patchset 16: // called and momentum_animation_start_time. Using this information, the
    Vladimir Levin . resolved

    nit if you wrap the variable names in backticks (`) in comments, then they will get linkified in codesearch as well

    Free Debreuil

    updated :)

    Free Debreuil

    Done

    Gerrit-Comment-Date: Wed, 15 Oct 2025 19:16:11 +0000
    Gerrit-HasComments: Yes
    Gerrit-Has-Labels: No
    Comment-In-Reply-To: Free Debreuil <freede...@google.com>
    Comment-In-Reply-To: Vladimir Levin <vmp...@chromium.org>
    satisfied_requirement
    unsatisfied_requirement
    open
    diffy
    Reply all
    Reply to author
    Forward
    0 new messages