Refine APC Geometry Pipeline [chromium/src : main]

0 views
Skip to first unread message

Aaron Leventhal (Gerrit)

unread,
Sep 24, 2025, 1:27:11 PMSep 24
to srirama chandra sekhar, AyeAye, Khushal Sagar, AI Code Reviewer, Chromium LUCI CQ, chromium...@chromium.org, feature-me...@chromium.org, blink-rev...@chromium.org, eric.c...@apple.com, blink-revi...@chromium.org, zol...@webkit.org, blink-rev...@chromium.org, aleventh...@chromium.org, blink-...@chromium.org, mfoltz...@chromium.org
Attention needed from Khushal Sagar

Aaron Leventhal voted and added 2 comments

Votes added by Aaron Leventhal

Commit-Queue+1

2 comments

File third_party/blink/renderer/modules/content_extraction/ai_page_content_agent.h
Line 176, Patchset 21: HashSet<DOMNodeId, IntWithZeroKeyHashTraits<DOMNodeId>>
Aaron Leventhal . resolved

I got errors that base::flat_set/flat_map are not allowed in blink.

File third_party/blink/renderer/modules/content_extraction/ai_page_content_agent.cc
Line 114, Patchset 12:namespace {
Khushal Sagar . resolved

nit: Isn't this already in anonymous namespace? why do need another one?

Aaron Leventhal

Done

Open in Gerrit

Related details

Attention is currently required from:
  • Khushal Sagar
Submit Requirements:
  • requirement satisfiedCode-Coverage
  • requirement is not satisfiedCode-Owners
  • requirement is not satisfiedCode-Review
  • requirement is not satisfiedNo-Unresolved-Comments
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: If3505139595576ef9525d776570a2fff1bfc2913
Gerrit-Change-Number: 6940625
Gerrit-PatchSet: 24
Gerrit-Owner: Aaron Leventhal <aleve...@chromium.org>
Gerrit-Reviewer: Aaron Leventhal <aleve...@chromium.org>
Gerrit-Reviewer: Khushal Sagar <khusha...@chromium.org>
Gerrit-CC: AI Code Reviewer <peep-gen...@system.gserviceaccount.com>
Gerrit-CC: srirama chandra sekhar <srir...@samsung.com>
Gerrit-Attention: Khushal Sagar <khusha...@chromium.org>
Gerrit-Comment-Date: Wed, 24 Sep 2025 17:27:06 +0000
Gerrit-HasComments: Yes
Gerrit-Has-Labels: Yes
Comment-In-Reply-To: Khushal Sagar <khusha...@chromium.org>
satisfied_requirement
unsatisfied_requirement
open
diffy

Philip Rogers (Gerrit)

unread,
Sep 24, 2025, 2:41:54 PMSep 24
to Aaron Leventhal, srirama chandra sekhar, AyeAye, Khushal Sagar, AI Code Reviewer, Chromium LUCI CQ, chromium...@chromium.org, feature-me...@chromium.org, blink-rev...@chromium.org, eric.c...@apple.com, blink-revi...@chromium.org, zol...@webkit.org, blink-rev...@chromium.org, aleventh...@chromium.org, blink-...@chromium.org, mfoltz...@chromium.org
Attention needed from Aaron Leventhal and Khushal Sagar

Philip Rogers added 1 comment

Commit Message
Line 12, Patchset 26 (Latest):Why both hit test rects and fragments are needed:
Philip Rogers . unresolved

This approach of supporting both codepaths leads to a lot of complexity, which I would like to avoid. Can we avoid having two? What is the usecase for needing the hit test rect for out-of-viewport elements? If there is a need for this, WDYT of doing a second hit test that includes areas outside the viewport, so that you can re-use the new hit-test-region code for both of these usecases?

Open in Gerrit

Related details

Attention is currently required from:
  • Aaron Leventhal
  • Khushal Sagar
Submit Requirements:
  • requirement satisfiedCode-Coverage
  • requirement is not satisfiedCode-Owners
  • requirement is not satisfiedCode-Review
  • requirement is not satisfiedNo-Unresolved-Comments
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: If3505139595576ef9525d776570a2fff1bfc2913
Gerrit-Change-Number: 6940625
Gerrit-PatchSet: 26
Gerrit-Owner: Aaron Leventhal <aleve...@chromium.org>
Gerrit-Reviewer: Aaron Leventhal <aleve...@chromium.org>
Gerrit-Reviewer: Khushal Sagar <khusha...@chromium.org>
Gerrit-Reviewer: Philip Rogers <p...@chromium.org>
Gerrit-CC: AI Code Reviewer <peep-gen...@system.gserviceaccount.com>
Gerrit-CC: srirama chandra sekhar <srir...@samsung.com>
Gerrit-Attention: Aaron Leventhal <aleve...@chromium.org>
Gerrit-Attention: Khushal Sagar <khusha...@chromium.org>
Gerrit-Comment-Date: Wed, 24 Sep 2025 18:41:43 +0000
Gerrit-HasComments: Yes
Gerrit-Has-Labels: No
satisfied_requirement
unsatisfied_requirement
open
diffy

Aaron Leventhal (Gerrit)

unread,
Sep 24, 2025, 3:23:03 PMSep 24
to Philip Rogers, srirama chandra sekhar, AyeAye, Khushal Sagar, AI Code Reviewer, Chromium LUCI CQ, chromium...@chromium.org, feature-me...@chromium.org, blink-rev...@chromium.org, eric.c...@apple.com, blink-revi...@chromium.org, zol...@webkit.org, blink-rev...@chromium.org, aleventh...@chromium.org, blink-...@chromium.org, mfoltz...@chromium.org
Attention needed from Khushal Sagar and Philip Rogers

Aaron Leventhal added 1 comment

Commit Message
Line 12, Patchset 26 (Latest):Why both hit test rects and fragments are needed:
Philip Rogers . unresolved

This approach of supporting both codepaths leads to a lot of complexity, which I would like to avoid. Can we avoid having two? What is the usecase for needing the hit test rect for out-of-viewport elements? If there is a need for this, WDYT of doing a second hit test that includes areas outside the viewport, so that you can re-use the new hit-test-region code for both of these usecases?

Aaron Leventhal

Hi PDR, thanks for taking a look — the intent behind keeping both paths is:

**Hit-test rects aren’t always available:**

The list-based sweep only emits geometry for nodes it touches while walking the current frame: actionable elements in the viewport. We still have to emit geometry for:

  • structural containers that don’t paint on their own
  • off-screen nodes when actionable mode is disabled, see performance concerns below
  • the accessibility-focused node in non-actionable mode

In all of those cases there simply isn’t a hit-test rect to reuse, so we fall back to the fragment path to keep coverage for the whole tree. Dropping the fragment path would make those nodes lose geometry entirely.

**Running a second “full page” hit test is expensive:**

It’s possibly doable (and we are sketching a flag for experimenting with it), but it changes the performance characteristics because it is a second paint traversal. The fragment path already gives us geometry for every rendered object; the hit-test pass is just an optimization to reuse the exact click footprint (and z-order) for actionable nodes in view. Doing an extra page-wide pass to cover everything would double the cost without buying more coverage than we already get from fragments.

The resulting structure is:
```
if (actionable hit-test produced a rect for this node)
reuse it
else
build from fragments
```

That’s the minimum complexity I found that maintains full coverage with controllable costs.

Open in Gerrit

Related details

Attention is currently required from:
  • Khushal Sagar
  • Philip Rogers
Submit Requirements:
  • requirement satisfiedCode-Coverage
  • requirement is not satisfiedCode-Owners
  • requirement is not satisfiedCode-Review
  • requirement is not satisfiedNo-Unresolved-Comments
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: If3505139595576ef9525d776570a2fff1bfc2913
Gerrit-Change-Number: 6940625
Gerrit-PatchSet: 26
Gerrit-Owner: Aaron Leventhal <aleve...@chromium.org>
Gerrit-Reviewer: Aaron Leventhal <aleve...@chromium.org>
Gerrit-Reviewer: Khushal Sagar <khusha...@chromium.org>
Gerrit-Reviewer: Philip Rogers <p...@chromium.org>
Gerrit-CC: AI Code Reviewer <peep-gen...@system.gserviceaccount.com>
Gerrit-CC: srirama chandra sekhar <srir...@samsung.com>
Gerrit-Attention: Khushal Sagar <khusha...@chromium.org>
Gerrit-Attention: Philip Rogers <p...@chromium.org>
Gerrit-Comment-Date: Wed, 24 Sep 2025 19:22:58 +0000
Gerrit-HasComments: Yes
Gerrit-Has-Labels: No
Comment-In-Reply-To: Philip Rogers <p...@chromium.org>
satisfied_requirement
unsatisfied_requirement
open
diffy

Philip Rogers (Gerrit)

unread,
Sep 24, 2025, 3:50:00 PMSep 24
to Aaron Leventhal, srirama chandra sekhar, AyeAye, Khushal Sagar, AI Code Reviewer, Chromium LUCI CQ, chromium...@chromium.org, feature-me...@chromium.org, blink-rev...@chromium.org, eric.c...@apple.com, blink-revi...@chromium.org, zol...@webkit.org, blink-rev...@chromium.org, aleventh...@chromium.org, blink-...@chromium.org, mfoltz...@chromium.org
Attention needed from Aaron Leventhal and Khushal Sagar

Philip Rogers added 1 comment

Commit Message
Line 12, Patchset 26 (Latest):Why both hit test rects and fragments are needed:
Philip Rogers . unresolved

This approach of supporting both codepaths leads to a lot of complexity, which I would like to avoid. Can we avoid having two? What is the usecase for needing the hit test rect for out-of-viewport elements? If there is a need for this, WDYT of doing a second hit test that includes areas outside the viewport, so that you can re-use the new hit-test-region code for both of these usecases?

Aaron Leventhal

Hi PDR, thanks for taking a look — the intent behind keeping both paths is:

**Hit-test rects aren’t always available:**

The list-based sweep only emits geometry for nodes it touches while walking the current frame: actionable elements in the viewport. We still have to emit geometry for:

  • structural containers that don’t paint on their own
  • off-screen nodes when actionable mode is disabled, see performance concerns below
  • the accessibility-focused node in non-actionable mode

In all of those cases there simply isn’t a hit-test rect to reuse, so we fall back to the fragment path to keep coverage for the whole tree. Dropping the fragment path would make those nodes lose geometry entirely.

**Running a second “full page” hit test is expensive:**

It’s possibly doable (and we are sketching a flag for experimenting with it), but it changes the performance characteristics because it is a second paint traversal. The fragment path already gives us geometry for every rendered object; the hit-test pass is just an optimization to reuse the exact click footprint (and z-order) for actionable nodes in view. Doing an extra page-wide pass to cover everything would double the cost without buying more coverage than we already get from fragments.

The resulting structure is:
```
if (actionable hit-test produced a rect for this node)
reuse it
else
build from fragments
```

That’s the minimum complexity I found that maintains full coverage with controllable costs.

Philip Rogers

Hit-test rects aren’t always available

Can you help me understand the usecase for needing the hit test rect for an out-of-viewport element?

Let's call the two codepaths "hit test rects" and "geometry-mapped rects". We discussed before how approaches other than "hit test rects" will be wrong in common cases, including outlines. What is the solution for this problem with "geometry-mapped rects"?

Running a second “full page” hit test is expensive

Is this true? At an extremely high level, "hit test rects" is O(|fragments|), and "geometry-mapped rects" is O(|fragments| * |tree depth|).

Open in Gerrit

Related details

Attention is currently required from:
  • Aaron Leventhal
  • Khushal Sagar
Submit Requirements:
  • requirement satisfiedCode-Coverage
  • requirement is not satisfiedCode-Owners
  • requirement is not satisfiedCode-Review
  • requirement is not satisfiedNo-Unresolved-Comments
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: If3505139595576ef9525d776570a2fff1bfc2913
Gerrit-Change-Number: 6940625
Gerrit-PatchSet: 26
Gerrit-Owner: Aaron Leventhal <aleve...@chromium.org>
Gerrit-Reviewer: Aaron Leventhal <aleve...@chromium.org>
Gerrit-Reviewer: Khushal Sagar <khusha...@chromium.org>
Gerrit-Reviewer: Philip Rogers <p...@chromium.org>
Gerrit-CC: AI Code Reviewer <peep-gen...@system.gserviceaccount.com>
Gerrit-CC: srirama chandra sekhar <srir...@samsung.com>
Gerrit-Attention: Aaron Leventhal <aleve...@chromium.org>
Gerrit-Attention: Khushal Sagar <khusha...@chromium.org>
Gerrit-Comment-Date: Wed, 24 Sep 2025 19:49:49 +0000
Gerrit-HasComments: Yes
Gerrit-Has-Labels: No
Comment-In-Reply-To: Aaron Leventhal <aleve...@chromium.org>
Comment-In-Reply-To: Philip Rogers <p...@chromium.org>
satisfied_requirement
unsatisfied_requirement
open
diffy

Khushal Sagar (Gerrit)

unread,
Sep 24, 2025, 5:53:18 PMSep 24
to Aaron Leventhal, Philip Rogers, srirama chandra sekhar, AyeAye, AI Code Reviewer, Chromium LUCI CQ, chromium...@chromium.org, feature-me...@chromium.org, blink-rev...@chromium.org, eric.c...@apple.com, blink-revi...@chromium.org, zol...@webkit.org, blink-rev...@chromium.org, aleventh...@chromium.org, blink-...@chromium.org, mfoltz...@chromium.org
Attention needed from Aaron Leventhal

Khushal Sagar added 4 comments

Patchset-level comments
File-level comment, Patchset 26 (Latest):
Khushal Sagar . resolved

Can discuss more when we meet later.

File third_party/blink/renderer/core/layout/hit_test_request.h
Line 99, Patchset 26 (Latest): static HitTestGeometry ForRegion(const cc::Region& region) {
Khushal Sagar . unresolved

Is this the API used when the node has multiple fragments?

Line 79, Patchset 26 (Latest): class HitTestGeometry {
Khushal Sagar . unresolved

what's the coordinate space of the geometry? can you add a comment.

File third_party/blink/renderer/modules/content_extraction/ai_page_content_agent.cc
Line 124, Patchset 26 (Latest):bool ShouldUseHitTestGeometry(
Khushal Sagar . unresolved

Overall feedback, we should use the hit testing algorithm as the source of truth for `visible_bounding_box` instead of any custom logic here. It makes it much easier to ensure what we use here stays aligned with hit testing. This is assuming the hit testing approach satisfies the following:

  • Doesn't incorrectly include outline and floating descendants.
  • Can provide separate rects for each fragment instead of a union.

Given the above, I'm not following why we need this use to be conditional. The calculation for `visible_bounding_box` should always be able to rely on the hit test geometry. The same way `document_scoped_z_order` relies on it for occlusion.

I was thinking about the case of anonymous layout objects. Since there's no node we likely don't get the hit test callback in those cases? But that means z order has the same issue and we're already ignoring such ContentNodes.

Nodes which are not visited by the hit testing algorithm will have an empty `visible_bounding_box` which is correct by design.

_____

Separately for elements outside the viewport for which we're providing `outer_bounding_box`. If we can derive that from hit testing too, that's great. But could we move that to a separate patch since this data is being used by an experimental feature? Fixing the `visible_bounding_box`, both cases where it currently includes content which isn't painted and the fact that we don't have fragments, will fix what's being used in production.

Open in Gerrit

Related details

Attention is currently required from:
  • Aaron Leventhal
Submit Requirements:
  • requirement satisfiedCode-Coverage
  • requirement is not satisfiedCode-Owners
  • requirement is not satisfiedCode-Review
  • requirement is not satisfiedNo-Unresolved-Comments
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: If3505139595576ef9525d776570a2fff1bfc2913
Gerrit-Change-Number: 6940625
Gerrit-PatchSet: 26
Gerrit-Owner: Aaron Leventhal <aleve...@chromium.org>
Gerrit-Reviewer: Aaron Leventhal <aleve...@chromium.org>
Gerrit-Reviewer: Khushal Sagar <khusha...@chromium.org>
Gerrit-Reviewer: Philip Rogers <p...@chromium.org>
Gerrit-CC: AI Code Reviewer <peep-gen...@system.gserviceaccount.com>
Gerrit-CC: srirama chandra sekhar <srir...@samsung.com>
Gerrit-Attention: Aaron Leventhal <aleve...@chromium.org>
Gerrit-Comment-Date: Wed, 24 Sep 2025 21:53:07 +0000
Gerrit-HasComments: Yes
Gerrit-Has-Labels: No
satisfied_requirement
unsatisfied_requirement
open
diffy

Aaron Leventhal (Gerrit)

unread,
Oct 17, 2025, 5:16:01 PM (2 days ago) Oct 17
to Philip Rogers, srirama chandra sekhar, AyeAye, Khushal Sagar, AI Code Reviewer, Chromium LUCI CQ, chromium...@chromium.org, feature-me...@chromium.org, blink-rev...@chromium.org, eric.c...@apple.com, blink-revi...@chromium.org, zol...@webkit.org, blink-rev...@chromium.org, aleventh...@chromium.org, blink-...@chromium.org, mfoltz...@chromium.org

Aaron Leventhal abandoned this change

Related details

Attention set is empty
Submit Requirements:
  • requirement satisfiedCode-Coverage
  • 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: abandon
Gerrit-Project: chromium/src
Gerrit-Branch: main
Gerrit-Change-Id: If3505139595576ef9525d776570a2fff1bfc2913
Gerrit-Change-Number: 6940625
Gerrit-PatchSet: 27
satisfied_requirement
unsatisfied_requirement
open
diffy
Reply all
Reply to author
Forward
0 new messages