Plumb TrackedElement data from Blink to RenderFrameMetadata [chromium/src : main]

0 views
Skip to first unread message

Przemyslaw Szczepaniak (Gerrit)

unread,
Dec 15, 2025, 10:52:27 AM (5 days ago) Dec 15
to Ryan Kalla, Colin Blundell, Chris Fredrickson, Philip Rogers, Erik Chen, Khushal Sagar, Chromium LUCI CQ, AI Code Reviewer, David Bokan, chromium...@chromium.org, Dirk Schulze, Stephen Chenney, blink-re...@chromium.org, blink-rev...@chromium.org, blink-reviews-p...@chromium.org, blink-...@chromium.org, cc-...@chromium.org, drott+bl...@chromium.org, fmalit...@chromium.org, fserb...@chromium.org, ipc-securi...@chromium.org, kinuko...@chromium.org
Attention needed from Khushal Sagar and Philip Rogers

Przemyslaw Szczepaniak added 14 comments

File cc/layers/layer.h
Line 530, Patchset 7: void SetTrackingHighlightBounds(TrackingHighlightBounds bounds);
Khushal Sagar . resolved

TrackedElements? Just to make it clear that this data structure tracks the position of multiple elements.

Przemyslaw Szczepaniak

Done

File cc/mojom/tracking_highlight_bounds.mojom
Line 9, Patchset 7:// NOTE: we use a TrackingHighlightIdBoundsPair instead of a map below due to
// our need to serialize to blink objects, where blink::HashMap only allows a
// very limited set of objects to be used as a key. The pair includes a tracking
Khushal Sagar . resolved

I'm not following this comment. Why can't we just have a map<mojo_base.mojom.Token, TrackingHighlightRectData>?

Przemyslaw Szczepaniak

Will rephrase, it's mimicking existing traits in RegionCapture, which boils down to blink::HashTable not allowing base::Token as a key.

When I try, this is what I get:
```
In file included from gen/cc/mojom/tracking_highlight_bounds.mojom-blink.cc:12:
In file included from gen/cc/mojom/tracking_highlight_bounds.mojom-blink.h:28:
In file included from gen/ui/gfx/geometry/mojom/geometry.mojom-blink.h:29:
In file included from ../../mojo/public/cpp/bindings/lib/wtf_clone_equals_util.h:12:
In file included from ../../third_party/blink/renderer/platform/wtf/hash_map.h:33:
In file included from ../../third_party/blink/renderer/platform/wtf/hash_table.h:44:
../../third_party/blink/renderer/platform/wtf/hash_traits.h:444:29: error: attempt to use a deleted function
444 | return value == Traits::DeletedValue();
| ^
../../third_party/blink/renderer/platform/wtf/hash_traits.h:479:58: note: in instantiation of member function 'blink::internal::HashTraitsDeletedValueHelper<blink::HashTra
its<base::Token>>::IsDeletedValue' requested here
479 | return internal::HashTraitsDeletedValueHelper<Traits>::IsDeletedValue(value);
| ^
../../third_party/blink/renderer/platform/wtf/hash_traits.h:492:10: note: in instantiation of function template specialization 'blink::IsHashTraitsDeletedValue<blink::Hash
Traits<base::Token>, base::Token>' requested here
492 | IsHashTraitsDeletedValue<Traits, T>(value);
| ^
../../third_party/blink/renderer/platform/wtf/hash_table.h:756:12: note: in instantiation of function template specialization 'blink::IsHashTraitsEmptyOrDeletedValue<blink
::HashTraits<base::Token>, base::Token>' requested here
756 | return IsHashTraitsEmptyOrDeletedValue<KeyTraits>(
| ^
../../third_party/blink/renderer/platform/wtf/hash_table.h:1597:14: note: in instantiation of member function 'blink::HashTable<base::Token, blink::KeyValuePair<base::Toke
n, mojo::StructPtr<cc::mojom::blink::TrackingHighlightRectData>>, blink::KeyValuePairExtractor, blink::HashMapValueTraits<blink::HashTraits<base::Token>, blink::HashTraits
<mojo::StructPtr<cc::mojom::blink::TrackingHighlightRectData>>>, blink::HashTraits<base::Token>, blink::PartitionAllocator>::IsEmptyOrDeletedBucket' requested here
1597 | if (!IsEmptyOrDeletedBucket(table[i]))
| ^
../../third_party/blink/renderer/platform/wtf/hash_table.h:660:5: note: in instantiation of member function 'blink::HashTable<base::Token, blink::KeyValuePair<base::Token,
mojo::StructPtr<cc::mojom::blink::TrackingHighlightRectData>>, blink::KeyValuePairExtractor, blink::HashMapValueTraits<blink::HashTraits<base::Token>, blink::HashTraits<m
ojo::StructPtr<cc::mojom::blink::TrackingHighlightRectData>>>, blink::HashTraits<base::Token>, blink::PartitionAllocator>::DeleteAllBucketsAndDeallocate' requested here
660 | DeleteAllBucketsAndDeallocate(table_, table_size_);
| ^
../../third_party/blink/renderer/platform/wtf/hash_map.h:86:7: note: in instantiation of member function 'blink::HashTable<base::Token, blink::KeyValuePair<base::Token, mo
jo::StructPtr<cc::mojom::blink::TrackingHighlightRectData>>, blink::KeyValuePairExtractor, blink::HashMapValueTraits<blink::HashTraits<base::Token>, blink::HashTraits<mojo
::StructPtr<cc::mojom::blink::TrackingHighlightRectData>>>, blink::HashTraits<base::Token>, blink::PartitionAllocator>::~HashTable' requested here
86 | class HashMap {
| ^
../../third_party/blink/renderer/platform/wtf/hash_traits.h:151:12: note: 'DeletedValue' has been explicitly marked deleted here
151 | static T DeletedValue() = delete;
| ^
```
Line 20, Patchset 7: gfx.mojom.Rect bounds;
gfx.mojom.Rect? clip_rect;
Khushal Sagar . unresolved

Do you need both these rects: the completely bounds of the element and the visible subset? I was expecting just the latter, visible area of the element, would be enough.

Przemyslaw Szczepaniak

It might be useful to know if the tracker rectangle is obscured/clipped, we might provide different visual effect of it's partially and fully obscured, having ratio of clipped/clipped rectangles would be useful for that.

File cc/trees/layer_tree_host_impl.cc
Line 2584, Patchset 7: for (const auto* layer : base::Reversed(*active_tree())) {
Khushal Sagar . unresolved

nit: The number of layers is generally small so it matters less but could we do this in the same walk for both region capture and the new tracking?

Przemyslaw Szczepaniak

Sure, I will leave a to-do to merge them in follow-up cl.

Line 2590, Patchset 7: // Manually walk the clip tree to calculate the combined clip in screen
Khushal Sagar . unresolved

We compute each layer's visible rect (as a part of rendering) before sending a frame. So you should be able to use the cached value [here](https://source.chromium.org/chromium/chromium/src/+/main:cc/layers/draw_properties.h;l=52;drc=adf1c0b0a7acf756e039e4203f41018e4bae22d0).

Przemyslaw Szczepaniak

thanks, that simply files a lot of things!

Line 2982, Patchset 7: last_draw_render_frame_metadata_->tracking_highlight_bounds !=
Khushal Sagar . unresolved

this is enabling it for iOS. Is that intentional? I figured this is for desktop only.

Przemyslaw Szczepaniak

it's removed in

File cc/trees/tracking_highlight_bounds.h
Line 24, Patchset 7: std::optional<gfx::Rect> clip_rect;
Khushal Sagar . unresolved

Same thing here, not following the use-case for both clip_rect and bounds instead of just the visible rect.

Przemyslaw Szczepaniak

ack, provided rationale in previous comment. We need both for providing visuals where tracked element is occluded.

File third_party/blink/renderer/core/dom/element.h
Line 978, Patchset 7: // This method may be called at most once. The ID must be non-null.
Khushal Sagar . unresolved

How is this reset when tracking is no longer needed?

Przemyslaw Szczepaniak

ack, added a clear method for TrackingHighlightRect.

File third_party/blink/renderer/core/dom/element.cc
Line 6757, Patchset 7: // The SubCaptureTarget ID needs to be propagated to the paint system.
Khushal Sagar . resolved

nit: Copied comments from region capture. :)

Przemyslaw Szczepaniak

Done

Line 6762, Patchset 7:// If SetRegionCaptureCropId(id) was previously called on `this`,
// returns the non-empty `id` which it previously provided.
// Otherwise, returns a nullptr.
Khushal Sagar . resolved

nit: remove.

Przemyslaw Szczepaniak

Done

File third_party/blink/renderer/platform/graphics/compositing/paint_chunks_to_cc_layer.cc
Line 1534, Patchset 7: std::nullopt);
Khushal Sagar . unresolved

when is this not null?

Przemyslaw Szczepaniak

fixed, it's not optional in recent version

File third_party/blink/renderer/platform/tracking_highlight_rect.h
Line 48, Patchset 7: case TrackingHighlightRectType::kSubsection:
return *rect;
Khushal Sagar . unresolved

This doesn't seem right. The caller is passing the element's painted rect which is computed as a part of painting. But in the subsection case, we return `rect` which was set on the Element by the caller..?

IIUC we're using this when a subsection of the element needs to be highlighted. It's unclear what coordinate space the rect is in. We'll need the paint system to map it into the element's local coordinate space. Also not sure how we deal with element resizes or if it's clipped by an ancestor.

For this change, let's keep things simpler and track the full painted rect for the element. We can add the subset based tracking in a follow up CL.

Przemyslaw Szczepaniak

To clarify, the use case for AI highlight will be primarily the subsection, we will receive a screen space rect, that we want to anchor to underlyng, salient Element. The use cases for subsection here is "arbitrary screen space rectangle that probably has non-zero union with element".

I'm ok to remove it from this cl, but will leave comments for follow-up work.

Line 40, Patchset 7: TrackingHighlightRectType type;
Khushal Sagar . resolved

nit: do you need this? it seems like `rect` being set implies we want to use that subset.

Przemyslaw Szczepaniak

Done

Line 17, Patchset 7:// TrackingHighlightId is a strong alias for base::Token, used to uniquely
Khushal Sagar . unresolved

How about "TrackedElement" instead of "TrackingHighlight". From the renderer's perspective, it's tracking the position of DOM elements. The type of feature that needs this tracking can be in `TrackedElementFeature` but the rest of the code can stay agnostic to it?

See comment above about excluding `TrackingHighlightFeature` for now.

Przemyslaw Szczepaniak

TrackedElement SGTM

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
  • 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: I969c760b6ae2fb090e9be1213f12f6a5f10d6500
Gerrit-Change-Number: 7245693
Gerrit-PatchSet: 10
Gerrit-Owner: Przemyslaw Szczepaniak <pszcze...@google.com>
Gerrit-Reviewer: Khushal Sagar <khusha...@chromium.org>
Gerrit-Reviewer: Przemyslaw Szczepaniak <pszcze...@google.com>
Gerrit-CC: AI Code Reviewer <peep-gen...@system.gserviceaccount.com>
Gerrit-CC: Chris Fredrickson <cfre...@chromium.org>
Gerrit-CC: Colin Blundell <blun...@chromium.org>
Gerrit-CC: David Bokan <bo...@chromium.org>
Gerrit-CC: Dirk Schulze <dsch...@chromium.org>
Gerrit-CC: Erik Chen <erik...@chromium.org>
Gerrit-CC: Philip Rogers <p...@chromium.org>
Gerrit-CC: Ryan Kalla <ryan...@google.com>
Gerrit-CC: Stephen Chenney <sche...@chromium.org>
Gerrit-Attention: Khushal Sagar <khusha...@chromium.org>
Gerrit-Attention: Philip Rogers <p...@chromium.org>
Gerrit-Comment-Date: Mon, 15 Dec 2025 15:52:14 +0000
Gerrit-HasComments: Yes
Gerrit-Has-Labels: No
Comment-In-Reply-To: Khushal Sagar <khusha...@chromium.org>
satisfied_requirement
unsatisfied_requirement
open
diffy

Przemyslaw Szczepaniak (Gerrit)

unread,
Dec 15, 2025, 11:13:05 AM (5 days ago) Dec 15
to Ryan Kalla, Colin Blundell, Chris Fredrickson, Philip Rogers, Erik Chen, Khushal Sagar, Chromium LUCI CQ, AI Code Reviewer, David Bokan, chromium...@chromium.org, Dirk Schulze, Stephen Chenney, blink-re...@chromium.org, blink-rev...@chromium.org, blink-reviews-p...@chromium.org, blink-...@chromium.org, cc-...@chromium.org, drott+bl...@chromium.org, fmalit...@chromium.org, fserb...@chromium.org, ipc-securi...@chromium.org, kinuko...@chromium.org
Attention needed from Khushal Sagar and Philip Rogers

Przemyslaw Szczepaniak added 3 comments

File cc/trees/layer_tree_host_impl.cc
Line 2982, Patchset 7: last_draw_render_frame_metadata_->tracking_highlight_bounds !=
Khushal Sagar . resolved

this is enabling it for iOS. Is that intentional? I figured this is for desktop only.

Przemyslaw Szczepaniak

it's removed in

Przemyslaw Szczepaniak

Done

File third_party/blink/renderer/platform/graphics/compositing/paint_chunks_to_cc_layer.cc
Line 1534, Patchset 7: std::nullopt);
Khushal Sagar . resolved

when is this not null?

Przemyslaw Szczepaniak

fixed, it's not optional in recent version

Przemyslaw Szczepaniak

Done

File third_party/blink/renderer/platform/tracking_highlight_rect.h
Line 17, Patchset 7:// TrackingHighlightId is a strong alias for base::Token, used to uniquely
Khushal Sagar . resolved

How about "TrackedElement" instead of "TrackingHighlight". From the renderer's perspective, it's tracking the position of DOM elements. The type of feature that needs this tracking can be in `TrackedElementFeature` but the rest of the code can stay agnostic to it?

See comment above about excluding `TrackingHighlightFeature` for now.

Przemyslaw Szczepaniak

TrackedElement SGTM

Przemyslaw Szczepaniak

Done

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
  • 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: I969c760b6ae2fb090e9be1213f12f6a5f10d6500
Gerrit-Change-Number: 7245693
Gerrit-PatchSet: 11
Gerrit-Owner: Przemyslaw Szczepaniak <pszcze...@google.com>
Gerrit-Reviewer: Khushal Sagar <khusha...@chromium.org>
Gerrit-Reviewer: Przemyslaw Szczepaniak <pszcze...@google.com>
Gerrit-CC: AI Code Reviewer <peep-gen...@system.gserviceaccount.com>
Gerrit-CC: Chris Fredrickson <cfre...@chromium.org>
Gerrit-CC: Colin Blundell <blun...@chromium.org>
Gerrit-CC: David Bokan <bo...@chromium.org>
Gerrit-CC: Dirk Schulze <dsch...@chromium.org>
Gerrit-CC: Erik Chen <erik...@chromium.org>
Gerrit-CC: Philip Rogers <p...@chromium.org>
Gerrit-CC: Ryan Kalla <ryan...@google.com>
Gerrit-CC: Stephen Chenney <sche...@chromium.org>
Gerrit-Attention: Khushal Sagar <khusha...@chromium.org>
Gerrit-Attention: Philip Rogers <p...@chromium.org>
Gerrit-Comment-Date: Mon, 15 Dec 2025 16:12:51 +0000
Gerrit-HasComments: Yes
Gerrit-Has-Labels: No
Comment-In-Reply-To: Khushal Sagar <khusha...@chromium.org>
Comment-In-Reply-To: Przemyslaw Szczepaniak <pszcze...@google.com>
satisfied_requirement
unsatisfied_requirement
open
diffy

Khushal Sagar (Gerrit)

unread,
Dec 15, 2025, 5:28:27 PM (5 days ago) Dec 15
to Przemyslaw Szczepaniak, Ryan Kalla, Colin Blundell, Chris Fredrickson, Philip Rogers, Erik Chen, Chromium LUCI CQ, AI Code Reviewer, David Bokan, chromium...@chromium.org, Dirk Schulze, Stephen Chenney, blink-re...@chromium.org, blink-rev...@chromium.org, blink-reviews-p...@chromium.org, blink-...@chromium.org, cc-...@chromium.org, drott+bl...@chromium.org, fmalit...@chromium.org, fserb...@chromium.org, ipc-securi...@chromium.org, kinuko...@chromium.org
Attention needed from Philip Rogers and Przemyslaw Szczepaniak

Khushal Sagar added 16 comments

File cc/layers/layer.h
Line 529, Patchset 13 (Latest): // Set or get the tracking highlight region
Khushal Sagar . unresolved

nit: Set or get the tracking region for an element.

File cc/mojom/render_frame_metadata.mojom
Line 89, Patchset 13 (Latest): cc.mojom.TrackedElementBounds tracked_element_bounds;
Khushal Sagar . unresolved

nit: comment please.

File cc/mojom/tracked_element_bounds.mojom
Line 9, Patchset 13 (Latest):// NOTE: we use a TrackedElementIdBoundsPair instead of a map below due to
Khushal Sagar . unresolved

we use a TrackedElementRectData ...

Line 20, Patchset 13 (Latest): gfx.mojom.Rect bounds;
gfx.mojom.Rect visible_bounds;
Khushal Sagar . unresolved

Left a suggestion below for only having `visible_bounds` for now with a comment clarifying what it is.

Line 25, Patchset 13 (Latest):// to a gfx::Rect representing the region of the viewport that should be cropped
// to for tracked elements.
Khushal Sagar . unresolved

viewport where the element is rendered in a frame.

Line 27, Patchset 13 (Latest):// The tracked_element ID and bounds are stored internally in Blink and are
// passed to and tracked by the compositor/viz. If a previously-generated
// tracked_element ID is selected via a client-side API, the compositor uses
// the tracked_element IDs associated with the compositor render passes to
// determine what section of the frame should be used.
Khushal Sagar . unresolved

This comment seems to much implementation detail, can remove it. I also didn't follow what "determine what section of the frame should be used" means.

File cc/mojom/tracking_highlight_bounds.mojom
Line 20, Patchset 7: gfx.mojom.Rect bounds;
gfx.mojom.Rect? clip_rect;
Khushal Sagar . unresolved

Do you need both these rects: the completely bounds of the element and the visible subset? I was expecting just the latter, visible area of the element, would be enough.

Przemyslaw Szczepaniak

It might be useful to know if the tracker rectangle is obscured/clipped, we might provide different visual effect of it's partially and fully obscured, having ratio of clipped/clipped rectangles would be useful for that.

Khushal Sagar

It might be useful to know if the tracker rectangle is obscured/clipped

I want to minimize complexity until we have the details of how it'll be used. Clipping in general can be hard to reason about:

1. It's possible an element's content is clipped by a wrapper element to achieve a visual effect. That clip would be by-design and from the user's perspective they are seeing the full content.

2. The element is clipped by an ancestor scroller. Showing a UI which indicates its clipped could be useful to tell the user there's more content to get to.

You likely want the clip from #2 but not #1. Since this change is already big, let's keep it focused on the geometry which is trivially available in the rendering stack which is `visible_rect` with this comment: "Provides the bounds of the element visible in the frame submitted by the compositor. The bounds are relative to the compositor's viewport. This means for an iframe rendered by a child compositor, the coordinates are relative to this iframe."

________

I like that you mentioned "obscured". :) I don't think we handle occlusion correctly in this patch. Definitely not for the CC side, unsure about the paint side. Occlusion is also tricky so let's defer it

File cc/trees/layer_tree_host_impl.cc
Line 2584, Patchset 7: for (const auto* layer : base::Reversed(*active_tree())) {
Khushal Sagar . unresolved

nit: The number of layers is generally small so it matters less but could we do this in the same walk for both region capture and the new tracking?

Przemyslaw Szczepaniak

Sure, I will leave a to-do to merge them in follow-up cl.

Khushal Sagar

Can we flag guard this until the follow up? I want to avoid a redundant layer walk every frame.

Line 2812, Patchset 13 (Latest): gfx::RectF total_clip_in_screen_space(root_drawable_content_rect);
bool first_clip = true;
for (const auto* current_clip_node =
clip_tree.Node(layer->clip_tree_index());
current_clip_node && current_clip_node->id != kRootPropertyNodeId;
current_clip_node = clip_tree.parent(current_clip_node)) {
gfx::RectF clip_rect_in_target_space = current_clip_node->clip;

const auto* current_transform_node =
transform_tree.Node(current_clip_node->transform_id);
const gfx::Transform& transform_to_screen =
transform_tree.ToScreen(current_transform_node->id);

gfx::RectF clip_in_screen_space = MathUtil::MapClippedRect(
transform_to_screen, clip_rect_in_target_space);

if (first_clip) {
total_clip_in_screen_space = clip_in_screen_space;
first_clip = false;
} else {
total_clip_in_screen_space.Intersect(clip_in_screen_space);
}
}
gfx::Rect clip_in_screen_space_rect =
gfx::ToEnclosingRect(total_clip_in_screen_space);

std::optional<gfx::Rect> optional_clip_rect;
// Only set the optional_clip_rect if it\'s not effectively the full
// viewport.
if (clip_in_screen_space_rect != root_drawable_content_rect) {
optional_clip_rect = clip_in_screen_space_rect;
}
Khushal Sagar . unresolved

why do we still need this clip tree walk?

Line 2862, Patchset 13 (Latest): visible_element_bounds_in_screen_space.Intersect(
root_drawable_content_rect);
Khushal Sagar . unresolved

I'm not sure if this is necessary, `visible_layer_rect` should already consider what part of it is visible in the root surface. So you can use `visible_element_bounds_in_screen_space` directly.

File third_party/blink/renderer/core/dom/element.h
Line 978, Patchset 7: // This method may be called at most once. The ID must be non-null.
Khushal Sagar . unresolved

How is this reset when tracking is no longer needed?

Przemyslaw Szczepaniak

ack, added a clear method for TrackingHighlightRect.

Khushal Sagar

We'll need that method in the Element API too.

File third_party/blink/renderer/core/page/scrolling/scrolling_test.cc
Line 1490, Patchset 13 (Latest):}
Khushal Sagar . unresolved

Clear the element tracking and confirm we're no longer adding it to layers after that.

File third_party/blink/renderer/core/paint/box_fragment_painter.cc
Line 1330, Patchset 7: if (element && element->GetRegionCaptureCropId()) {
paint_info.context.GetPaintController().RecordRegionCaptureData(
*background_client, *(element->GetRegionCaptureCropId()),
ToPixelSnappedRect(paint_rect));
}

if (element && element->GetTrackingHighlightRect()) {
paint_info.context.GetPaintController().RecordTrackingHighlightData(
*background_client, element->GetTrackingHighlightRect()->id,
element->GetTrackingHighlightRect()->GetTrackedRect(
ToPixelSnappedRect(paint_rect)));
}
Khushal Sagar . unresolved

nit: Move this to a helper that we can use below instead of duplicating? Also easier to make sure that every call-site which is plumbing region capture also plumbs this.

Khushal Sagar

ping on this

File third_party/blink/renderer/platform/graphics/paint/paint_controller.cc
Line 198, Patchset 13 (Latest): LOG(ERROR) << "PZS RecordTrackedElementData"
<< highlight_id.value().ToString();
Khushal Sagar . unresolved

nit: Remember to remove before landing this. :)

File third_party/blink/renderer/platform/graphics/paint/tracked_element_data.h
Line 39, Patchset 13 (Latest): gfx::Rect GetTrackedRect(const gfx::Rect full_rect) const {
// TODO: Implement subsection tracking
return full_rect;
}
Khushal Sagar . unresolved

nit: Let's remove this API for now and make it explicit at the call-site that the element's visual rect is being used. We can figure out the exact API as a part of subsection support.

Line 18, Patchset 13 (Latest):// Defines the type of element that is tracked.
enum class TrackedElementFeature {
kAIHighlight,
};
Khushal Sagar . unresolved

Let's remove this for now. We can add this as a part of the next feature that uses this infra.

Open in Gerrit

Related details

Attention is currently required from:
  • Philip Rogers
  • Przemyslaw Szczepaniak
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: I969c760b6ae2fb090e9be1213f12f6a5f10d6500
Gerrit-Change-Number: 7245693
Gerrit-PatchSet: 13
Gerrit-Owner: Przemyslaw Szczepaniak <pszcze...@google.com>
Gerrit-Reviewer: Khushal Sagar <khusha...@chromium.org>
Gerrit-Reviewer: Przemyslaw Szczepaniak <pszcze...@google.com>
Gerrit-CC: AI Code Reviewer <peep-gen...@system.gserviceaccount.com>
Gerrit-CC: Chris Fredrickson <cfre...@chromium.org>
Gerrit-CC: Colin Blundell <blun...@chromium.org>
Gerrit-CC: David Bokan <bo...@chromium.org>
Gerrit-CC: Dirk Schulze <dsch...@chromium.org>
Gerrit-CC: Erik Chen <erik...@chromium.org>
Gerrit-CC: Philip Rogers <p...@chromium.org>
Gerrit-CC: Ryan Kalla <ryan...@google.com>
Gerrit-CC: Stephen Chenney <sche...@chromium.org>
Gerrit-Attention: Philip Rogers <p...@chromium.org>
Gerrit-Attention: Przemyslaw Szczepaniak <pszcze...@google.com>
Gerrit-Comment-Date: Mon, 15 Dec 2025 22:28:16 +0000
satisfied_requirement
unsatisfied_requirement
open
diffy

Przemyslaw Szczepaniak (Gerrit)

unread,
Dec 16, 2025, 11:01:56 AM (4 days ago) Dec 16
to Ryan Kalla, Colin Blundell, Chris Fredrickson, Philip Rogers, Erik Chen, Khushal Sagar, Chromium LUCI CQ, AI Code Reviewer, David Bokan, chromium...@chromium.org, Dirk Schulze, Stephen Chenney, blink-re...@chromium.org, blink-rev...@chromium.org, blink-reviews-p...@chromium.org, blink-...@chromium.org, cc-...@chromium.org, drott+bl...@chromium.org, fmalit...@chromium.org, fserb...@chromium.org, ipc-securi...@chromium.org, kinuko...@chromium.org
Attention needed from Khushal Sagar and Philip Rogers

Przemyslaw Szczepaniak added 15 comments

File cc/layers/layer.h
Line 529, Patchset 13 (Latest): // Set or get the tracking highlight region
Khushal Sagar . resolved

nit: Set or get the tracking region for an element.

Przemyslaw Szczepaniak

Done

File cc/mojom/render_frame_metadata.mojom
Line 89, Patchset 13 (Latest): cc.mojom.TrackedElementBounds tracked_element_bounds;
Khushal Sagar . resolved

nit: comment please.

Przemyslaw Szczepaniak

Done

File cc/mojom/tracked_element_bounds.mojom
Line 9, Patchset 13 (Latest):// NOTE: we use a TrackedElementIdBoundsPair instead of a map below due to
Khushal Sagar . resolved

we use a TrackedElementRectData ...

Przemyslaw Szczepaniak

Done

Line 20, Patchset 13 (Latest): gfx.mojom.Rect bounds;
gfx.mojom.Rect visible_bounds;
Khushal Sagar . resolved

Left a suggestion below for only having `visible_bounds` for now with a comment clarifying what it is.

Przemyslaw Szczepaniak

Acknowledged

Line 25, Patchset 13 (Latest):// to a gfx::Rect representing the region of the viewport that should be cropped
// to for tracked elements.
Khushal Sagar . resolved

viewport where the element is rendered in a frame.

Przemyslaw Szczepaniak

Done

Line 27, Patchset 13 (Latest):// The tracked_element ID and bounds are stored internally in Blink and are
// passed to and tracked by the compositor/viz. If a previously-generated
// tracked_element ID is selected via a client-side API, the compositor uses
// the tracked_element IDs associated with the compositor render passes to
// determine what section of the frame should be used.
Khushal Sagar . resolved

This comment seems to much implementation detail, can remove it. I also didn't follow what "determine what section of the frame should be used" means.

Przemyslaw Szczepaniak

Acknowledged

File cc/mojom/tracking_highlight_bounds.mojom
Line 20, Patchset 7: gfx.mojom.Rect bounds;
gfx.mojom.Rect? clip_rect;
Khushal Sagar . resolved

Do you need both these rects: the completely bounds of the element and the visible subset? I was expecting just the latter, visible area of the element, would be enough.

Przemyslaw Szczepaniak

It might be useful to know if the tracker rectangle is obscured/clipped, we might provide different visual effect of it's partially and fully obscured, having ratio of clipped/clipped rectangles would be useful for that.

Khushal Sagar

It might be useful to know if the tracker rectangle is obscured/clipped

I want to minimize complexity until we have the details of how it'll be used. Clipping in general can be hard to reason about:

1. It's possible an element's content is clipped by a wrapper element to achieve a visual effect. That clip would be by-design and from the user's perspective they are seeing the full content.

2. The element is clipped by an ancestor scroller. Showing a UI which indicates its clipped could be useful to tell the user there's more content to get to.

You likely want the clip from #2 but not #1. Since this change is already big, let's keep it focused on the geometry which is trivially available in the rendering stack which is `visible_rect` with this comment: "Provides the bounds of the element visible in the frame submitted by the compositor. The bounds are relative to the compositor's viewport. This means for an iframe rendered by a child compositor, the coordinates are relative to this iframe."

________

I like that you mentioned "obscured". :) I don't think we handle occlusion correctly in this patch. Definitely not for the CC side, unsure about the paint side. Occlusion is also tricky so let's defer it

Przemyslaw Szczepaniak

Acknowledged

File cc/trees/layer_tree_host_impl.cc
Line 2584, Patchset 7: for (const auto* layer : base::Reversed(*active_tree())) {
Khushal Sagar . unresolved

nit: The number of layers is generally small so it matters less but could we do this in the same walk for both region capture and the new tracking?

Przemyslaw Szczepaniak

Sure, I will leave a to-do to merge them in follow-up cl.

Khushal Sagar

Can we flag guard this until the follow up? I want to avoid a redundant layer walk every frame.

Przemyslaw Szczepaniak

I just realized that capture bounds are captured for CompositorFrameMetadata, while TrackedRegionBounds go for RenderFrameMetadata, combining them in one layer walk would require pulling them out... to ::GenerateCompositorFrame? and then passing as argument to MakeRenderFrameMetadata and MakeCompositorFrameMetadata. Would that make sense?

Khushal Sagar . resolved

why do we still need this clip tree walk?

Przemyslaw Szczepaniak

my mistake, it should be removed.

Line 2862, Patchset 13 (Latest): visible_element_bounds_in_screen_space.Intersect(
root_drawable_content_rect);
Khushal Sagar . resolved

I'm not sure if this is necessary, `visible_layer_rect` should already consider what part of it is visible in the root surface. So you can use `visible_element_bounds_in_screen_space` directly.

Przemyslaw Szczepaniak

Acknowledged

File third_party/blink/renderer/core/dom/element.h
Line 978, Patchset 7: // This method may be called at most once. The ID must be non-null.
Khushal Sagar . resolved

How is this reset when tracking is no longer needed?

Przemyslaw Szczepaniak

ack, added a clear method for TrackingHighlightRect.

Khushal Sagar

We'll need that method in the Element API too.

Przemyslaw Szczepaniak

Done

File third_party/blink/renderer/core/page/scrolling/scrolling_test.cc
Khushal Sagar . resolved

Clear the element tracking and confirm we're no longer adding it to layers after that.

Przemyslaw Szczepaniak

Done

File third_party/blink/renderer/platform/graphics/paint/paint_controller.cc
Line 198, Patchset 13 (Latest): LOG(ERROR) << "PZS RecordTrackedElementData"
<< highlight_id.value().ToString();
Khushal Sagar . resolved

nit: Remember to remove before landing this. :)

Przemyslaw Szczepaniak

Done

File third_party/blink/renderer/platform/graphics/paint/tracked_element_data.h
Line 39, Patchset 13 (Latest): gfx::Rect GetTrackedRect(const gfx::Rect full_rect) const {
// TODO: Implement subsection tracking
return full_rect;
}
Khushal Sagar . resolved

nit: Let's remove this API for now and make it explicit at the call-site that the element's visual rect is being used. We can figure out the exact API as a part of subsection support.

Przemyslaw Szczepaniak

Done

Line 18, Patchset 13 (Latest):// Defines the type of element that is tracked.
enum class TrackedElementFeature {
kAIHighlight,
};
Khushal Sagar . resolved

Let's remove this for now. We can add this as a part of the next feature that uses this infra.

Przemyslaw Szczepaniak

Done

Open in Gerrit

Related details

Attention is currently required from:
  • Khushal Sagar
  • Philip Rogers
Gerrit-Attention: Khushal Sagar <khusha...@chromium.org>
Gerrit-Attention: Philip Rogers <p...@chromium.org>
Gerrit-Comment-Date: Tue, 16 Dec 2025 16:01:38 +0000
satisfied_requirement
unsatisfied_requirement
open
diffy

Przemyslaw Szczepaniak (Gerrit)

unread,
Dec 16, 2025, 11:02:32 AM (4 days ago) Dec 16
to Ryan Kalla, Colin Blundell, Chris Fredrickson, Philip Rogers, Erik Chen, Khushal Sagar, Chromium LUCI CQ, AI Code Reviewer, David Bokan, chromium...@chromium.org, Dirk Schulze, Stephen Chenney, blink-re...@chromium.org, blink-rev...@chromium.org, blink-reviews-p...@chromium.org, blink-...@chromium.org, cc-...@chromium.org, drott+bl...@chromium.org, fmalit...@chromium.org, fserb...@chromium.org, ipc-securi...@chromium.org, kinuko...@chromium.org
Attention needed from Khushal Sagar and Philip Rogers

Przemyslaw Szczepaniak added 4 comments

File cc/trees/layer_tree_host_impl.cc
Line 2590, Patchset 7: // Manually walk the clip tree to calculate the combined clip in screen
Khushal Sagar . resolved

We compute each layer's visible rect (as a part of rendering) before sending a frame. So you should be able to use the cached value [here](https://source.chromium.org/chromium/chromium/src/+/main:cc/layers/draw_properties.h;l=52;drc=adf1c0b0a7acf756e039e4203f41018e4bae22d0).

Przemyslaw Szczepaniak

thanks, that simply files a lot of things!

Przemyslaw Szczepaniak

Done

File third_party/blink/renderer/core/paint/box_fragment_painter.cc
Line 1330, Patchset 7: if (element && element->GetRegionCaptureCropId()) {
paint_info.context.GetPaintController().RecordRegionCaptureData(
*background_client, *(element->GetRegionCaptureCropId()),
ToPixelSnappedRect(paint_rect));
}

if (element && element->GetTrackingHighlightRect()) {
paint_info.context.GetPaintController().RecordTrackingHighlightData(
*background_client, element->GetTrackingHighlightRect()->id,
element->GetTrackingHighlightRect()->GetTrackedRect(
ToPixelSnappedRect(paint_rect)));
}
Khushal Sagar . resolved

nit: Move this to a helper that we can use below instead of duplicating? Also easier to make sure that every call-site which is plumbing region capture also plumbs this.

Khushal Sagar

ping on this

Przemyslaw Szczepaniak

Done

File third_party/blink/renderer/platform/graphics/paint/tracking_highlight_data.h
Line 23, Patchset 1: base::flat_map<TrackingHighlightId, gfx::Rect> map;
AI Code Reviewer . resolved

Blink Style Guide: Prefer blink:: types over STL and base types. 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** | **OK But Won't Fix**: reason | **Later**: 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)_

Przemyslaw Szczepaniak

OK But Won't Fix: HashMap is not happy with strong alias type TrackingHighlightId, attempts to use a deleted function.

Przemyslaw Szczepaniak

Done

File third_party/blink/renderer/platform/tracking_highlight_rect.h
Line 19, Patchset 7:using TrackingHighlightId =
Khushal Sagar . resolved

I don't think you need anything below in this file for this change, just the TrackingHighlightId is enough. It can probably go into tracking_highlight_data.h itself for now. We'll see what needs to be in blink/public when adding the hook for the browser to add/remove this tracking.

Przemyslaw Szczepaniak

Done

Gerrit-Comment-Date: Tue, 16 Dec 2025 16:02:17 +0000
Gerrit-HasComments: Yes
Gerrit-Has-Labels: No
Comment-In-Reply-To: Khushal Sagar <khusha...@chromium.org>
Comment-In-Reply-To: AI Code Reviewer <peep-gen...@system.gserviceaccount.com>
Comment-In-Reply-To: Przemyslaw Szczepaniak <pszcze...@google.com>
satisfied_requirement
unsatisfied_requirement
open
diffy

Khushal Sagar (Gerrit)

unread,
Dec 16, 2025, 4:17:02 PM (4 days ago) Dec 16
to Przemyslaw Szczepaniak, Ryan Kalla, Colin Blundell, Chris Fredrickson, Philip Rogers, Erik Chen, Chromium LUCI CQ, AI Code Reviewer, David Bokan, chromium...@chromium.org, Dirk Schulze, Stephen Chenney, blink-re...@chromium.org, blink-rev...@chromium.org, blink-reviews-p...@chromium.org, blink-...@chromium.org, cc-...@chromium.org, drott+bl...@chromium.org, fmalit...@chromium.org, fserb...@chromium.org, ipc-securi...@chromium.org, kinuko...@chromium.org
Attention needed from Philip Rogers and Przemyslaw Szczepaniak

Khushal Sagar added 8 comments

Patchset-level comments
File-level comment, Patchset 14 (Latest):
Khushal Sagar . unresolved

Can you add a [LayerTreeHostTest](https://source.chromium.org/chromium/chromium/src/+/main:cc/trees/layer_tree_host_unittest.cc;l=164;drc=7666bc1983c2a5b98e5dc6fa6c28f8f53c07d06f). It'll test the e2e flow through CC, setting the tracked rect on a layer and making sure it's on the RenderFrameData.

A few comments below otherwise LG.

File cc/layers/layer.h
Line 529, Patchset 14 (Latest): // Set or get the tracking highlight region
Khushal Sagar . unresolved

nit: Set or get data for tracked elements on this layer. The geometry provided is in layer space.

File cc/trees/layer_tree_host_impl.cc
Line 2584, Patchset 7: for (const auto* layer : base::Reversed(*active_tree())) {
Khushal Sagar . unresolved

nit: The number of layers is generally small so it matters less but could we do this in the same walk for both region capture and the new tracking?

Przemyslaw Szczepaniak

Sure, I will leave a to-do to merge them in follow-up cl.

Khushal Sagar

Can we flag guard this until the follow up? I want to avoid a redundant layer walk every frame.

Przemyslaw Szczepaniak

I just realized that capture bounds are captured for CompositorFrameMetadata, while TrackedRegionBounds go for RenderFrameMetadata, combining them in one layer walk would require pulling them out... to ::GenerateCompositorFrame? and then passing as argument to MakeRenderFrameMetadata and MakeCompositorFrameMetadata. Would that make sense?

Khushal Sagar

Hmmm, another alternative can be to cache a bit indicating if there are any layers with `tracked_element_bounds` on FrameData during the walk [here](https://source.chromium.org/chromium/chromium/src/+/main:cc/trees/layer_tree_host_impl.cc;l=1794;drc=7666bc1983c2a5b98e5dc6fa6c28f8f53c07d06f) and call `CollectTrackedElementBounds` based on that. Seems simpler?

I don't mind the extra walks if there are elements to track, since that will be pretty rare. Just want to avoid adding it when the feature is not being used.

Line 2809, Patchset 14 (Latest): // Set the element data with both the bounds and the optional clip.
Khushal Sagar . unresolved

nit: stale comment.

File cc/trees/render_frame_metadata.h
Line 125, Patchset 14 (Latest): TrackedElementBounds tracked_element_bounds;
Khushal Sagar . unresolved

nit: comment please.

File third_party/blink/renderer/core/paint/box_fragment_painter.cc
Line 3029, Patchset 14 (Latest): if (element && element->GetTrackedElementRect()) {
Khushal Sagar . unresolved

nit: I was actually suggesting using the helper for both region capture and tracked element since the common pattern is to update both at the call-sites.

File third_party/blink/renderer/platform/graphics/paint/paint_chunker.cc
Line 225, Patchset 14 (Latest): const TrackedElementId& highlight_id,
Khushal Sagar . unresolved

nit: tracked_element_id?

File third_party/blink/renderer/platform/graphics/paint/paint_controller.cc
Line 198, Patchset 14 (Latest): LOG(ERROR) << "PZS RecordTrackedElementData"
<< highlight_id.value().ToString();
Khushal Sagar . unresolved

debug logs

Open in Gerrit

Related details

Attention is currently required from:
  • Philip Rogers
  • Przemyslaw Szczepaniak
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: I969c760b6ae2fb090e9be1213f12f6a5f10d6500
Gerrit-Change-Number: 7245693
Gerrit-PatchSet: 14
Gerrit-Owner: Przemyslaw Szczepaniak <pszcze...@google.com>
Gerrit-Reviewer: Khushal Sagar <khusha...@chromium.org>
Gerrit-Reviewer: Przemyslaw Szczepaniak <pszcze...@google.com>
Gerrit-CC: AI Code Reviewer <peep-gen...@system.gserviceaccount.com>
Gerrit-CC: Chris Fredrickson <cfre...@chromium.org>
Gerrit-CC: Colin Blundell <blun...@chromium.org>
Gerrit-CC: David Bokan <bo...@chromium.org>
Gerrit-CC: Dirk Schulze <dsch...@chromium.org>
Gerrit-CC: Erik Chen <erik...@chromium.org>
Gerrit-CC: Philip Rogers <p...@chromium.org>
Gerrit-CC: Ryan Kalla <ryan...@google.com>
Gerrit-CC: Stephen Chenney <sche...@chromium.org>
Gerrit-Attention: Philip Rogers <p...@chromium.org>
Gerrit-Attention: Przemyslaw Szczepaniak <pszcze...@google.com>
Gerrit-Comment-Date: Tue, 16 Dec 2025 21:16:52 +0000
Gerrit-HasComments: Yes
Gerrit-Has-Labels: No
Comment-In-Reply-To: Khushal Sagar <khusha...@chromium.org>
Comment-In-Reply-To: Przemyslaw Szczepaniak <pszcze...@google.com>
satisfied_requirement
unsatisfied_requirement
open
diffy

Przemyslaw Szczepaniak (Gerrit)

unread,
Dec 17, 2025, 9:44:03 AM (3 days ago) Dec 17
to Ryan Kalla, Colin Blundell, Chris Fredrickson, Philip Rogers, Erik Chen, Khushal Sagar, Chromium LUCI CQ, AI Code Reviewer, David Bokan, chromium...@chromium.org, Dirk Schulze, Stephen Chenney, blink-re...@chromium.org, blink-rev...@chromium.org, blink-reviews-p...@chromium.org, blink-...@chromium.org, cc-...@chromium.org, drott+bl...@chromium.org, fmalit...@chromium.org, fserb...@chromium.org, ipc-securi...@chromium.org, kinuko...@chromium.org
Attention needed from Khushal Sagar and Philip Rogers

Przemyslaw Szczepaniak added 7 comments

File cc/layers/layer.h
Line 529, Patchset 14: // Set or get the tracking highlight region
Khushal Sagar . resolved

nit: Set or get data for tracked elements on this layer. The geometry provided is in layer space.

Przemyslaw Szczepaniak

Done

File cc/trees/layer_tree_host_impl.cc
Line 2584, Patchset 7: for (const auto* layer : base::Reversed(*active_tree())) {
Khushal Sagar . resolved

nit: The number of layers is generally small so it matters less but could we do this in the same walk for both region capture and the new tracking?

Przemyslaw Szczepaniak

Sure, I will leave a to-do to merge them in follow-up cl.

Khushal Sagar

Can we flag guard this until the follow up? I want to avoid a redundant layer walk every frame.

Przemyslaw Szczepaniak

I just realized that capture bounds are captured for CompositorFrameMetadata, while TrackedRegionBounds go for RenderFrameMetadata, combining them in one layer walk would require pulling them out... to ::GenerateCompositorFrame? and then passing as argument to MakeRenderFrameMetadata and MakeCompositorFrameMetadata. Would that make sense?

Khushal Sagar

Hmmm, another alternative can be to cache a bit indicating if there are any layers with `tracked_element_bounds` on FrameData during the walk [here](https://source.chromium.org/chromium/chromium/src/+/main:cc/trees/layer_tree_host_impl.cc;l=1794;drc=7666bc1983c2a5b98e5dc6fa6c28f8f53c07d06f) and call `CollectTrackedElementBounds` based on that. Seems simpler?

I don't mind the extra walks if there are elements to track, since that will be pretty rare. Just want to avoid adding it when the feature is not being used.

Przemyslaw Szczepaniak

Done

Line 2809, Patchset 14: // Set the element data with both the bounds and the optional clip.
Khushal Sagar . resolved

nit: stale comment.

Przemyslaw Szczepaniak

Done

File cc/trees/render_frame_metadata.h
Line 125, Patchset 14: TrackedElementBounds tracked_element_bounds;
Khushal Sagar . resolved

nit: comment please.

Przemyslaw Szczepaniak

Done

File third_party/blink/renderer/core/paint/box_fragment_painter.cc
Line 3029, Patchset 14: if (element && element->GetTrackedElementRect()) {
Khushal Sagar . resolved

nit: I was actually suggesting using the helper for both region capture and tracked element since the common pattern is to update both at the call-sites.

Przemyslaw Szczepaniak

Done

File third_party/blink/renderer/platform/graphics/paint/paint_chunker.cc
Line 225, Patchset 14: const TrackedElementId& highlight_id,
Khushal Sagar . resolved

nit: tracked_element_id?

Przemyslaw Szczepaniak

Done

File third_party/blink/renderer/platform/graphics/paint/paint_controller.cc
Line 198, Patchset 14: LOG(ERROR) << "PZS RecordTrackedElementData"
<< highlight_id.value().ToString();
Khushal Sagar . resolved

debug logs

Przemyslaw Szczepaniak

Done

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
  • 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: I969c760b6ae2fb090e9be1213f12f6a5f10d6500
Gerrit-Change-Number: 7245693
Gerrit-PatchSet: 15
Gerrit-Owner: Przemyslaw Szczepaniak <pszcze...@google.com>
Gerrit-Reviewer: Khushal Sagar <khusha...@chromium.org>
Gerrit-Reviewer: Przemyslaw Szczepaniak <pszcze...@google.com>
Gerrit-CC: AI Code Reviewer <peep-gen...@system.gserviceaccount.com>
Gerrit-CC: Chris Fredrickson <cfre...@chromium.org>
Gerrit-CC: Colin Blundell <blun...@chromium.org>
Gerrit-CC: David Bokan <bo...@chromium.org>
Gerrit-CC: Dirk Schulze <dsch...@chromium.org>
Gerrit-CC: Erik Chen <erik...@chromium.org>
Gerrit-CC: Philip Rogers <p...@chromium.org>
Gerrit-CC: Ryan Kalla <ryan...@google.com>
Gerrit-CC: Stephen Chenney <sche...@chromium.org>
Gerrit-Attention: Khushal Sagar <khusha...@chromium.org>
Gerrit-Attention: Philip Rogers <p...@chromium.org>
Gerrit-Comment-Date: Wed, 17 Dec 2025 14:43:49 +0000
satisfied_requirement
unsatisfied_requirement
open
diffy

Przemyslaw Szczepaniak (Gerrit)

unread,
Dec 17, 2025, 9:44:46 AM (3 days ago) Dec 17
to Ryan Kalla, Colin Blundell, Chris Fredrickson, Philip Rogers, Erik Chen, Khushal Sagar, Chromium LUCI CQ, AI Code Reviewer, David Bokan, chromium...@chromium.org, Dirk Schulze, Stephen Chenney, blink-re...@chromium.org, blink-rev...@chromium.org, blink-reviews-p...@chromium.org, blink-...@chromium.org, cc-...@chromium.org, drott+bl...@chromium.org, fmalit...@chromium.org, fserb...@chromium.org, ipc-securi...@chromium.org, kinuko...@chromium.org
Attention needed from Khushal Sagar and Philip Rogers

Przemyslaw Szczepaniak added 3 comments

Patchset-level comments
File-level comment, Patchset 14:
Khushal Sagar . resolved

Can you add a [LayerTreeHostTest](https://source.chromium.org/chromium/chromium/src/+/main:cc/trees/layer_tree_host_unittest.cc;l=164;drc=7666bc1983c2a5b98e5dc6fa6c28f8f53c07d06f). It'll test the e2e flow through CC, setting the tracked rect on a layer and making sure it's on the RenderFrameData.

A few comments below otherwise LG.

Przemyslaw Szczepaniak

Done

File cc/trees/tracking_highlight_bounds.h
Line 24, Patchset 7: std::optional<gfx::Rect> clip_rect;
Khushal Sagar . resolved

Same thing here, not following the use-case for both clip_rect and bounds instead of just the visible rect.

Przemyslaw Szczepaniak

ack, provided rationale in previous comment. We need both for providing visuals where tracked element is occluded.

Przemyslaw Szczepaniak

Done

File third_party/blink/renderer/platform/tracking_highlight_rect.h
Line 48, Patchset 7: case TrackingHighlightRectType::kSubsection:
return *rect;
Khushal Sagar . resolved

This doesn't seem right. The caller is passing the element's painted rect which is computed as a part of painting. But in the subsection case, we return `rect` which was set on the Element by the caller..?

IIUC we're using this when a subsection of the element needs to be highlighted. It's unclear what coordinate space the rect is in. We'll need the paint system to map it into the element's local coordinate space. Also not sure how we deal with element resizes or if it's clipped by an ancestor.

For this change, let's keep things simpler and track the full painted rect for the element. We can add the subset based tracking in a follow up CL.

Przemyslaw Szczepaniak

To clarify, the use case for AI highlight will be primarily the subsection, we will receive a screen space rect, that we want to anchor to underlyng, salient Element. The use cases for subsection here is "arbitrary screen space rectangle that probably has non-zero union with element".

I'm ok to remove it from this cl, but will leave comments for follow-up work.

Przemyslaw Szczepaniak

Done

Gerrit-Comment-Date: Wed, 17 Dec 2025 14:44:33 +0000
satisfied_requirement
unsatisfied_requirement
open
diffy

Philip Rogers (Gerrit)

unread,
Dec 17, 2025, 5:17:33 PM (3 days ago) Dec 17
to Przemyslaw Szczepaniak, Ryan Kalla, Colin Blundell, Chris Fredrickson, Erik Chen, Khushal Sagar, Chromium LUCI CQ, AI Code Reviewer, David Bokan, chromium...@chromium.org, Dirk Schulze, Stephen Chenney, blink-re...@chromium.org, blink-rev...@chromium.org, blink-reviews-p...@chromium.org, blink-...@chromium.org, cc-...@chromium.org, drott+bl...@chromium.org, fmalit...@chromium.org, fserb...@chromium.org, ipc-securi...@chromium.org, kinuko...@chromium.org
Attention needed from Khushal Sagar and Przemyslaw Szczepaniak

Philip Rogers added 2 comments

File third_party/blink/renderer/core/page/scrolling/scrolling_test.cc
Line 1422, Patchset 15 (Latest):TEST_P(ScrollingTest, NonCompositedMainThreadRepaintWithTrackedElement) {
Philip Rogers . unresolved

I think we need some tests in third_party/blink/renderer/core/paint/box_painter_test.cc. I think you don't really care about scrolling (is that true?) and were just copying existing tests, so you can just move these tests to box_painter_test.cc, or add new ones. Alternatively, compositing_test.cc may be another option for end-to-end style tests.

Can you add a test that <span id="highlight">aaaa</span> can be tracked?

File third_party/blink/renderer/platform/graphics/paint/tracked_element_data.h
Line 43, Patchset 15 (Latest): : public GarbageCollected<TrackedElementData> {
Philip Rogers . unresolved

Does this need to be garbage collected? It doesn't have any GC types.

Open in Gerrit

Related details

Attention is currently required from:
  • Khushal Sagar
  • Przemyslaw Szczepaniak
Gerrit-Attention: Przemyslaw Szczepaniak <pszcze...@google.com>
Gerrit-Comment-Date: Wed, 17 Dec 2025 22:17:21 +0000
Gerrit-HasComments: Yes
Gerrit-Has-Labels: No
satisfied_requirement
unsatisfied_requirement
open
diffy

Khushal Sagar (Gerrit)

unread,
Dec 17, 2025, 7:39:17 PM (3 days ago) Dec 17
to Przemyslaw Szczepaniak, Ryan Kalla, Colin Blundell, Chris Fredrickson, Philip Rogers, Erik Chen, Chromium LUCI CQ, AI Code Reviewer, David Bokan, chromium...@chromium.org, Dirk Schulze, Stephen Chenney, blink-re...@chromium.org, blink-rev...@chromium.org, blink-reviews-p...@chromium.org, blink-...@chromium.org, cc-...@chromium.org, drott+bl...@chromium.org, fmalit...@chromium.org, fserb...@chromium.org, ipc-securi...@chromium.org, kinuko...@chromium.org
Attention needed from Przemyslaw Szczepaniak

Khushal Sagar voted and added 7 comments

Votes added by Khushal Sagar

Code-Review+1

7 comments

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

One comment about a behaviour change which I'm assuming is unintentional. LGTM % pdr otherwise.

File cc/trees/layer_tree_host_impl.cc
Line 2800, Patchset 15 (Latest): // TODO: Merge this with CollectRegionCaptureBounds
Khushal Sagar . unresolved

not necessary anymore.

File cc/trees/layer_tree_host_unittest.cc
Line 11859, Patchset 15 (Latest): // Check DelegatedInkMetadata on the CompositorFrameMetadata when the
// compositor frame is submitted.
Khushal Sagar . unresolved

unrelated comment?

Line 11861, Patchset 15 (Latest): void ExpectBounds(const TrackedElementBounds& actual_bounds) {
Khushal Sagar . unresolved

nit: ExpectBoundsOnThread.

These tests get callbacks on multiple threads so just to make it explicit that this one runs on the compositor thread, and shouldn't access state on the main thread.

Line 11882, Patchset 15 (Latest): scoped_refptr<Layer> child_a_;
scoped_refptr<Layer> child_b_;
Khushal Sagar . unresolved

nit: we don't need to cache these as member variables.

Line 11885, Patchset 15 (Latest): std::optional<TrackedElementBounds> expected_bounds_;
Khushal Sagar . unresolved

this is unused.

File third_party/blink/renderer/core/paint/view_painter.cc
Line 98, Patchset 15 (Latest): bool paints_tracking_highlight_and_region_capture_data =
element &&
Khushal Sagar . unresolved

This is changing behaviour. It should be this instead:

```
bool paints_tracking_or_region_capture_data =
element && (element->GetRegionCaptureCropId() || element->GetTrackedElementRect()) &&
```
Open in Gerrit

Related details

Attention is currently required from:
  • Przemyslaw Szczepaniak
Submit Requirements:
    • requirement satisfiedCode-Coverage
    • requirement is not satisfiedCode-Owners
    • requirement is not 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: I969c760b6ae2fb090e9be1213f12f6a5f10d6500
    Gerrit-Change-Number: 7245693
    Gerrit-PatchSet: 15
    Gerrit-Owner: Przemyslaw Szczepaniak <pszcze...@google.com>
    Gerrit-Reviewer: Khushal Sagar <khusha...@chromium.org>
    Gerrit-Reviewer: Przemyslaw Szczepaniak <pszcze...@google.com>
    Gerrit-CC: AI Code Reviewer <peep-gen...@system.gserviceaccount.com>
    Gerrit-CC: Chris Fredrickson <cfre...@chromium.org>
    Gerrit-CC: Colin Blundell <blun...@chromium.org>
    Gerrit-CC: David Bokan <bo...@chromium.org>
    Gerrit-CC: Dirk Schulze <dsch...@chromium.org>
    Gerrit-CC: Erik Chen <erik...@chromium.org>
    Gerrit-CC: Philip Rogers <p...@chromium.org>
    Gerrit-CC: Ryan Kalla <ryan...@google.com>
    Gerrit-CC: Stephen Chenney <sche...@chromium.org>
    Gerrit-Attention: Przemyslaw Szczepaniak <pszcze...@google.com>
    Gerrit-Comment-Date: Thu, 18 Dec 2025 00:39:01 +0000
    Gerrit-HasComments: Yes
    Gerrit-Has-Labels: Yes
    satisfied_requirement
    unsatisfied_requirement
    open
    diffy
    Reply all
    Reply to author
    Forward
    0 new messages