Fix scroll marker updates during Find on Page [chromium/src : main]

0 views
Skip to first unread message

Daniil Sakhapov (Gerrit)

unread,
Jun 30, 2026, 6:54:52 AM (11 days ago) Jun 30
to chromium...@chromium.org, David A, Robert Flack, Chromium LUCI CQ, android-bu...@system.gserviceaccount.com, blink-...@chromium.org, blink-re...@chromium.org
Attention needed from David A and Robert Flack

Daniil Sakhapov voted and added 3 comments

Votes added by Daniil Sakhapov

Commit-Queue+1

3 comments

Patchset-level comments
File-level comment, Patchset 1:
Robert Flack . resolved

Adding @awogb...@chromium.org who initially wrote this to review.

Daniil Sakhapov

Done

Commit Message
Line 22, Patchset 1:TAG=agy
Robert Flack . resolved

What is this?
Also, do you have an associated bug?

Daniil Sakhapov

tag to mark that I used AI assistance with this CL.
added bug as well.

File third_party/blink/renderer/core/scroll/scroll_into_view_util.cc
Line 348, Patchset 1: Node* target_node = box.GetNode();
David A . unresolved

Hmm should this be `box` or `current_box`? I think `box` is the original thing that a scrollIntoView was requested on, while `current_box` is the current thing within the scroll ancestry that we want to scroll into view.

Daniil Sakhapov

Yeah, you're right. Using only box was causing us to pin markers from other groups because we didn't check which group we are currently scrolling.

But we can't just use current_box either, because we need to find marker for target box, not for the container itself.

So I updated FindScrollMarkerForTargetedScroll to also take group. We still start searching from box, but we stop at the container and only return marker if it belongs to the group we are currently processing.

Open in Gerrit

Related details

Attention is currently required from:
  • David A
  • 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: Id761ab0e0cd56bd1e434d83bd98a9932a4734fe6
Gerrit-Change-Number: 8003639
Gerrit-PatchSet: 2
Gerrit-Owner: Daniil Sakhapov <sakh...@chromium.org>
Gerrit-Reviewer: Daniil Sakhapov <sakh...@chromium.org>
Gerrit-Reviewer: David A <awogb...@chromium.org>
Gerrit-Reviewer: Robert Flack <fla...@chromium.org>
Gerrit-Attention: David A <awogb...@chromium.org>
Gerrit-Attention: Robert Flack <fla...@chromium.org>
Gerrit-Comment-Date: Tue, 30 Jun 2026 10:54:34 +0000
Gerrit-HasComments: Yes
Gerrit-Has-Labels: Yes
Comment-In-Reply-To: David A <awogb...@chromium.org>
Comment-In-Reply-To: Robert Flack <fla...@chromium.org>
satisfied_requirement
unsatisfied_requirement
open
diffy

Robert Flack (Gerrit)

unread,
Jun 30, 2026, 1:46:34 PM (11 days ago) Jun 30
to Daniil Sakhapov, chromium...@chromium.org, David A, Chromium LUCI CQ, android-bu...@system.gserviceaccount.com, blink-...@chromium.org, blink-re...@chromium.org
Attention needed from Daniil Sakhapov and David A

Robert Flack added 1 comment

File third_party/blink/renderer/core/scroll/scroll_into_view_util.cc
Line 348, Patchset 1: Node* target_node = box.GetNode();
David A . unresolved

Hmm should this be `box` or `current_box`? I think `box` is the original thing that a scrollIntoView was requested on, while `current_box` is the current thing within the scroll ancestry that we want to scroll into view.

Daniil Sakhapov

Yeah, you're right. Using only box was causing us to pin markers from other groups because we didn't check which group we are currently scrolling.

But we can't just use current_box either, because we need to find marker for target box, not for the container itself.

So I updated FindScrollMarkerForTargetedScroll to also take group. We still start searching from box, but we stop at the container and only return marker if it belongs to the group we are currently processing.

Robert Flack

I don't think we would have this problem of finding the scroll marker to pin if this was implemented the way that was specified in the [resolution](https://github.com/w3c/csswg-drafts/issues/10738#issuecomment-2489046785):

RESOLVED: Adopt proposal in https://github.com/w3c/csswg-drafts/issues/10738#issuecomment-2448204794 to anchor to identified elements

In particular, each ancestor scrollable area should set the last targeted element to current_box (or box) and then trigger [step 3 of the marker update algorithm](https://www.w3.org/TR/css-overflow-5/#active-scroll-marker:~:text=If%20scroller%20has%20a%20non%2Dnull%20current%20scroll%20target):

3. If scroller has a non-null current scroll target
Let active be the first item in targets encountered by a reverse tree order walk starting from the current scroll target, or the first item in tree order in targets if no target is found in the previous walk.

Rather than adding additional complexity to "pin" and "unpin" markers I would prefer to see the specified fix of having scrollable areas track the last scrolled element and using that as the starting point when updating the active marker.

Open in Gerrit

Related details

Attention is currently required from:
  • Daniil Sakhapov
  • David A
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: Id761ab0e0cd56bd1e434d83bd98a9932a4734fe6
Gerrit-Change-Number: 8003639
Gerrit-PatchSet: 2
Gerrit-Owner: Daniil Sakhapov <sakh...@chromium.org>
Gerrit-Reviewer: Daniil Sakhapov <sakh...@chromium.org>
Gerrit-Reviewer: David A <awogb...@chromium.org>
Gerrit-Reviewer: Robert Flack <fla...@chromium.org>
Gerrit-Attention: David A <awogb...@chromium.org>
Gerrit-Attention: Daniil Sakhapov <sakh...@chromium.org>
Gerrit-Comment-Date: Tue, 30 Jun 2026 17:46:28 +0000
Gerrit-HasComments: Yes
Gerrit-Has-Labels: No
Comment-In-Reply-To: David A <awogb...@chromium.org>
Comment-In-Reply-To: Daniil Sakhapov <sakh...@chromium.org>
satisfied_requirement
unsatisfied_requirement
open
diffy

Daniil Sakhapov (Gerrit)

unread,
Jul 6, 2026, 6:50:13 AM (5 days ago) Jul 6
to chromium...@chromium.org, David A, Robert Flack, Chromium LUCI CQ, android-bu...@system.gserviceaccount.com, blink-...@chromium.org, blink-re...@chromium.org
Attention needed from David A and Robert Flack

Daniil Sakhapov voted and added 1 comment

Votes added by Daniil Sakhapov

Commit-Queue+1

1 comment

File third_party/blink/renderer/core/scroll/scroll_into_view_util.cc
Line 348, Patchset 1: Node* target_node = box.GetNode();
David A . unresolved

Hmm should this be `box` or `current_box`? I think `box` is the original thing that a scrollIntoView was requested on, while `current_box` is the current thing within the scroll ancestry that we want to scroll into view.

Daniil Sakhapov

Yeah, you're right. Using only box was causing us to pin markers from other groups because we didn't check which group we are currently scrolling.

But we can't just use current_box either, because we need to find marker for target box, not for the container itself.

So I updated FindScrollMarkerForTargetedScroll to also take group. We still start searching from box, but we stop at the container and only return marker if it belongs to the group we are currently processing.

Robert Flack

I don't think we would have this problem of finding the scroll marker to pin if this was implemented the way that was specified in the [resolution](https://github.com/w3c/csswg-drafts/issues/10738#issuecomment-2489046785):

RESOLVED: Adopt proposal in https://github.com/w3c/csswg-drafts/issues/10738#issuecomment-2448204794 to anchor to identified elements

In particular, each ancestor scrollable area should set the last targeted element to current_box (or box) and then trigger [step 3 of the marker update algorithm](https://www.w3.org/TR/css-overflow-5/#active-scroll-marker:~:text=If%20scroller%20has%20a%20non%2Dnull%20current%20scroll%20target):

3. If scroller has a non-null current scroll target
Let active be the first item in targets encountered by a reverse tree order walk starting from the current scroll target, or the first item in tree order in targets if no target is found in the previous walk.

Rather than adding additional complexity to "pin" and "unpin" markers I would prefer to see the specified fix of having scrollable areas track the last scrolled element and using that as the starting point when updating the active marker.

Daniil Sakhapov

I agree with your direction, but I don't have any more time to spend on this, unfortunetly.
So that this bug will have to stay until a proper fix is landed then.

Open in Gerrit

Related details

Attention is currently required from:
  • David A
  • 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: Id761ab0e0cd56bd1e434d83bd98a9932a4734fe6
Gerrit-Change-Number: 8003639
Gerrit-PatchSet: 2
Gerrit-Owner: Daniil Sakhapov <sakh...@chromium.org>
Gerrit-Reviewer: Daniil Sakhapov <sakh...@chromium.org>
Gerrit-Reviewer: David A <awogb...@chromium.org>
Gerrit-Reviewer: Robert Flack <fla...@chromium.org>
Gerrit-Attention: David A <awogb...@chromium.org>
Gerrit-Attention: Robert Flack <fla...@chromium.org>
Gerrit-Comment-Date: Mon, 06 Jul 2026 10:49:57 +0000
Gerrit-HasComments: Yes
Gerrit-Has-Labels: Yes
Comment-In-Reply-To: David A <awogb...@chromium.org>
Comment-In-Reply-To: Daniil Sakhapov <sakh...@chromium.org>
Comment-In-Reply-To: Robert Flack <fla...@chromium.org>
satisfied_requirement
unsatisfied_requirement
open
diffy

Robert Flack (Gerrit)

unread,
Jul 6, 2026, 12:52:18 PM (5 days ago) Jul 6
to Daniil Sakhapov, chromium...@chromium.org, David A, Chromium LUCI CQ, android-bu...@system.gserviceaccount.com, blink-...@chromium.org, blink-re...@chromium.org
Attention needed from Daniil Sakhapov and David A

Robert Flack added 1 comment

File third_party/blink/renderer/core/scroll/scroll_into_view_util.cc
Line 348, Patchset 1: Node* target_node = box.GetNode();
David A . unresolved

Hmm should this be `box` or `current_box`? I think `box` is the original thing that a scrollIntoView was requested on, while `current_box` is the current thing within the scroll ancestry that we want to scroll into view.

Daniil Sakhapov

Yeah, you're right. Using only box was causing us to pin markers from other groups because we didn't check which group we are currently scrolling.

But we can't just use current_box either, because we need to find marker for target box, not for the container itself.

So I updated FindScrollMarkerForTargetedScroll to also take group. We still start searching from box, but we stop at the container and only return marker if it belongs to the group we are currently processing.

Robert Flack

I don't think we would have this problem of finding the scroll marker to pin if this was implemented the way that was specified in the [resolution](https://github.com/w3c/csswg-drafts/issues/10738#issuecomment-2489046785):

RESOLVED: Adopt proposal in https://github.com/w3c/csswg-drafts/issues/10738#issuecomment-2448204794 to anchor to identified elements

In particular, each ancestor scrollable area should set the last targeted element to current_box (or box) and then trigger [step 3 of the marker update algorithm](https://www.w3.org/TR/css-overflow-5/#active-scroll-marker:~:text=If%20scroller%20has%20a%20non%2Dnull%20current%20scroll%20target):

3. If scroller has a non-null current scroll target
Let active be the first item in targets encountered by a reverse tree order walk starting from the current scroll target, or the first item in tree order in targets if no target is found in the previous walk.

Rather than adding additional complexity to "pin" and "unpin" markers I would prefer to see the specified fix of having scrollable areas track the last scrolled element and using that as the starting point when updating the active marker.

Daniil Sakhapov

I agree with your direction, but I don't have any more time to spend on this, unfortunetly.
So that this bug will have to stay until a proper fix is landed then.

Robert Flack

I'm okay with landing this bugfix, as long as the complexity is limited to some moved code and the additional logic in this block. However, I think we should leave a TODO referencing https://crbug.com/380062280 to remove this code once the targeted element is properly tracked.

However, this needs to start the search from the previous current_box, otherwise you won't find the correct pinned marker for nested scrollers.

E.g.

```html
<style>
#a, #b {
scroll-marker-group: after;
}
#b::scroll-marker, #c::scroll-marker {
content: "Marker";
}
</style>
<div id=a>
<div id=b>
<div id=c></div>
</div>
</div>
<script>
document.querySelector('#c').scrollIntoView();
</script>
```

In this case, we should pin #c for the group in #b, and pin #b for the group in #a.

Open in Gerrit

Related details

Attention is currently required from:
  • Daniil Sakhapov
  • David A
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: Id761ab0e0cd56bd1e434d83bd98a9932a4734fe6
Gerrit-Change-Number: 8003639
Gerrit-PatchSet: 2
Gerrit-Owner: Daniil Sakhapov <sakh...@chromium.org>
Gerrit-Reviewer: Daniil Sakhapov <sakh...@chromium.org>
Gerrit-Reviewer: David A <awogb...@chromium.org>
Gerrit-Reviewer: Robert Flack <fla...@chromium.org>
Gerrit-Attention: David A <awogb...@chromium.org>
Gerrit-Attention: Daniil Sakhapov <sakh...@chromium.org>
Gerrit-Comment-Date: Mon, 06 Jul 2026 16:52:08 +0000
Gerrit-HasComments: Yes
Gerrit-Has-Labels: No
satisfied_requirement
unsatisfied_requirement
open
diffy

Daniil Sakhapov (Gerrit)

unread,
12:02 PM (2 hours ago) 12:02 PM
to chromium...@chromium.org, David A, Robert Flack, Chromium LUCI CQ, android-bu...@system.gserviceaccount.com, blink-revie...@chromium.org, blink-...@chromium.org, blink-re...@chromium.org
Attention needed from David A and Robert Flack

Daniil Sakhapov added 1 comment

File third_party/blink/renderer/core/scroll/scroll_into_view_util.cc
Line 348, Patchset 1: Node* target_node = box.GetNode();
David A . resolved
Daniil Sakhapov

Done

Open in Gerrit

Related details

Attention is currently required from:
  • David A
  • Robert Flack
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: Id761ab0e0cd56bd1e434d83bd98a9932a4734fe6
    Gerrit-Change-Number: 8003639
    Gerrit-PatchSet: 4
    Gerrit-Owner: Daniil Sakhapov <sakh...@chromium.org>
    Gerrit-Reviewer: Daniil Sakhapov <sakh...@chromium.org>
    Gerrit-Reviewer: David A <awogb...@chromium.org>
    Gerrit-Reviewer: Robert Flack <fla...@chromium.org>
    Gerrit-Attention: David A <awogb...@chromium.org>
    Gerrit-Attention: Robert Flack <fla...@chromium.org>
    Gerrit-Comment-Date: Sat, 11 Jul 2026 16:02:02 +0000
    satisfied_requirement
    unsatisfied_requirement
    open
    diffy
    Reply all
    Reply to author
    Forward
    0 new messages