Extend TrackedElementRect to support sub-rectangle tracking [chromium/src : main]

0 views
Skip to first unread message

Przemyslaw Szczepaniak (Gerrit)

unread,
Jan 12, 2026, 6:37:02 AM (3 days ago) Jan 12
to Stephen Chenney, David Bokan, chromium...@chromium.org, Dirk Schulze, kinuko...@chromium.org, cc-...@chromium.org, blink-re...@chromium.org, drott+bl...@chromium.org, blink-...@chromium.org, blink-revi...@chromium.org, fmalit...@chromium.org, fserb...@chromium.org, ipc-securi...@chromium.org, blink-rev...@chromium.org, blink-reviews-p...@chromium.org, zol...@webkit.org

Przemyslaw Szczepaniak has uploaded the change for review

Commit message

Extend TrackedElementRect to support sub-rectangle tracking

This change allows tracking a specific sub-region of an element instead
of its entire bounds.

- Added SubRect struct to TrackedElementRect to hold a relative region
and an 'intersect_with_element_rect' flag.
- Introduced TrackedElementRect::GetEffectiveBounds() to handle
coordinate calculations and optional clipping.
- Updated BoxPainter, BoxFragmentPainter and InlineBoxFragmentPainter
to use the new sub-rectangle logic during paint recording.
- Added unit tests to verify sub-rectangle tracking with and without
intersection with the element bounds.

Change diff


Change information

Files:
  • M third_party/blink/renderer/core/exported/web_plugin_container_impl.cc
  • M third_party/blink/renderer/core/paint/box_fragment_painter.cc
  • M third_party/blink/renderer/core/paint/box_fragment_painter_test.cc
  • M third_party/blink/renderer/core/paint/box_painter.cc
  • M third_party/blink/renderer/core/paint/inline_box_fragment_painter.cc
  • M third_party/blink/renderer/platform/graphics/paint/tracked_element_data.cc
  • M third_party/blink/renderer/platform/graphics/paint/tracked_element_data.h
Change size: M
Delta: 7 files changed, 105 insertions(+), 8 deletions(-)
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: newchange
Gerrit-Project: chromium/src
Gerrit-Branch: main
Gerrit-Change-Id: Ib087fc8263df38623c60e3a5e8efa4d5939ae410
Gerrit-Change-Number: 7451579
Gerrit-PatchSet: 1
Gerrit-Owner: Przemyslaw Szczepaniak <pszcze...@google.com>
Gerrit-CC: David Bokan <bo...@chromium.org>
Gerrit-CC: Dirk Schulze <dsch...@chromium.org>
Gerrit-CC: Stephen Chenney <sche...@chromium.org>
satisfied_requirement
unsatisfied_requirement
open
diffy

AI Code Reviewer (Gerrit)

unread,
Jan 12, 2026, 6:39:20 AM (3 days ago) Jan 12
to Przemyslaw Szczepaniak, David Bokan, chromium...@chromium.org, Dirk Schulze, Stephen Chenney, blink-re...@chromium.org, blink-revi...@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, zol...@webkit.org

AI Code Reviewer added 2 comments

File third_party/blink/renderer/platform/graphics/paint/tracked_element_data.h
Line 41, Patchset 1 (Latest): bool intersect_with_element_rect) {
AI Code Reviewer . unresolved

Blink Style Guide: Prefer enums or StrongAliases to bare bools for function parameters. To improve readability at the call site, consider using a base::StrongAlias<class IntersectWithElementRectTag, bool> or an enum instead of a bare bool for 'intersect_with_element_rect'.

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)_

Line 24, Patchset 1 (Latest): bool intersect_with_element_rect = true;
AI Code Reviewer . unresolved

nit: Blink Style Guide: Precede boolean values with words like “is” and “did”. Consider renaming 'intersect_with_element_rect' to 'should_intersect_with_element_rect' (or similar) to clearly indicate it is a boolean flag.

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)_

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 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: Ib087fc8263df38623c60e3a5e8efa4d5939ae410
    Gerrit-Change-Number: 7451579
    Gerrit-PatchSet: 1
    Gerrit-Owner: Przemyslaw Szczepaniak <pszcze...@google.com>
    Gerrit-CC: AI Code Reviewer <peep-gen...@system.gserviceaccount.com>
    Gerrit-CC: David Bokan <bo...@chromium.org>
    Gerrit-CC: Dirk Schulze <dsch...@chromium.org>
    Gerrit-CC: Stephen Chenney <sche...@chromium.org>
    Gerrit-Comment-Date: Mon, 12 Jan 2026 11:39:15 +0000
    Gerrit-HasComments: Yes
    Gerrit-Has-Labels: No
    satisfied_requirement
    unsatisfied_requirement
    open
    diffy

    Przemyslaw Szczepaniak (Gerrit)

    unread,
    Jan 12, 2026, 8:52:43 AM (3 days ago) Jan 12
    to Stephen Chenney, David Bokan, chromium...@chromium.org, Dirk Schulze, kinuko...@chromium.org, cc-...@chromium.org, blink-re...@chromium.org, drott+bl...@chromium.org, blink-...@chromium.org, blink-revi...@chromium.org, fmalit...@chromium.org, fserb...@chromium.org, ipc-securi...@chromium.org, blink-rev...@chromium.org, blink-reviews-p...@chromium.org, zol...@webkit.org

    Przemyslaw Szczepaniak has uploaded the change for review

    Commit message

    Extend TrackedElementRect to support sub-rectangle tracking

    This change allows tracking a specific sub-region of an element instead
    of its entire bounds.

    - Added SubRect struct to TrackedElementRect to hold a relative region
    and an 'intersect_with_element_rect' flag.
    - Introduced TrackedElementRect::GetEffectiveBounds() to handle
    coordinate calculations and optional clipping.
    - Updated BoxPainter, BoxFragmentPainter and InlineBoxFragmentPainter
    to use the new sub-rectangle logic during paint recording.
    - Added unit tests to verify sub-rectangle tracking with and without
    intersection with the element bounds.

    Change diff


    Change information

    Files:
    • M third_party/blink/renderer/core/exported/web_plugin_container_impl.cc
    • M third_party/blink/renderer/core/paint/box_fragment_painter.cc
    • M third_party/blink/renderer/core/paint/box_fragment_painter_test.cc
    • M third_party/blink/renderer/core/paint/box_painter.cc
    • M third_party/blink/renderer/core/paint/inline_box_fragment_painter.cc
    • M third_party/blink/renderer/platform/graphics/paint/tracked_element_data.cc
    • M third_party/blink/renderer/platform/graphics/paint/tracked_element_data.h
    Change size: M
    Delta: 7 files changed, 110 insertions(+), 8 deletions(-)
    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: newchange
      Gerrit-Project: chromium/src
      Gerrit-Branch: main
      Gerrit-Change-Id: I7fa95236870d0bc9a7b2e991da030862b0ead04c
      Gerrit-Change-Number: 7451382
      Gerrit-PatchSet: 1
      Gerrit-Owner: Przemyslaw Szczepaniak <pszcze...@google.com>
      satisfied_requirement
      unsatisfied_requirement
      open
      diffy

      Przemyslaw Szczepaniak (Gerrit)

      unread,
      Jan 12, 2026, 8:54:44 AM (3 days ago) Jan 12
      to Philip Rogers, Khushal Sagar, AI Code Reviewer, David Bokan, chromium...@chromium.org, Dirk Schulze, Stephen Chenney, blink-re...@chromium.org, blink-revi...@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, zol...@webkit.org

      Przemyslaw Szczepaniak 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: Ib087fc8263df38623c60e3a5e8efa4d5939ae410
      Gerrit-Change-Number: 7451579
      Gerrit-PatchSet: 1
      Gerrit-Owner: Przemyslaw Szczepaniak <pszcze...@google.com>
      Gerrit-Reviewer: Khushal Sagar <khusha...@chromium.org>
      Gerrit-Reviewer: Philip Rogers <p...@chromium.org>
      Gerrit-CC: AI Code Reviewer <peep-gen...@system.gserviceaccount.com>
      satisfied_requirement
      unsatisfied_requirement
      open
      diffy

      AI Code Reviewer (Gerrit)

      unread,
      Jan 12, 2026, 8:57:19 AM (3 days ago) Jan 12
      to Przemyslaw Szczepaniak, Philip Rogers, Khushal Sagar, David Bokan, chromium...@chromium.org, Dirk Schulze, Stephen Chenney, blink-re...@chromium.org, blink-revi...@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, zol...@webkit.org
      Attention needed from Khushal Sagar and Philip Rogers

      AI Code Reviewer added 1 comment

      File third_party/blink/renderer/platform/graphics/paint/tracked_element_data.h
      Line 38, Patchset 1 (Latest): static std::unique_ptr<TrackedElementRect> CreateFull(TrackedElementId id) {
      AI Code Reviewer . unresolved

      Blink Style Guide: Don't mix Create () factory methods and public constructors in one class. Since this struct has public constructors, please remove these `Create` methods and use `std::make_unique<TrackedElementRect>(...)` directly at the call sites.

      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)_

      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: I7fa95236870d0bc9a7b2e991da030862b0ead04c
      Gerrit-Change-Number: 7451382
      Gerrit-PatchSet: 1
      Gerrit-Owner: Przemyslaw Szczepaniak <pszcze...@google.com>
      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: David Bokan <bo...@chromium.org>
      Gerrit-CC: Dirk Schulze <dsch...@chromium.org>
      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, 12 Jan 2026 13:57:16 +0000
      Gerrit-HasComments: Yes
      Gerrit-Has-Labels: No
      satisfied_requirement
      unsatisfied_requirement
      open
      diffy

      Philip Rogers (Gerrit)

      unread,
      Jan 12, 2026, 2:29:03 PM (2 days ago) Jan 12
      to Przemyslaw Szczepaniak, AI Code Reviewer, Khushal Sagar, David Bokan, chromium...@chromium.org, Dirk Schulze, Stephen Chenney, blink-re...@chromium.org, blink-revi...@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, zol...@webkit.org
      Attention needed from Khushal Sagar and Przemyslaw Szczepaniak

      Philip Rogers added 6 comments

      Commit Message
      Line 20, Patchset 1 (Latest):
      Philip Rogers . unresolved

      Pease add Bug: 459385624 to keep everything connected.

      File third_party/blink/renderer/core/paint/box_fragment_painter.cc
      Line 3025, Patchset 1 (Latest): gfx::Rect rect = tracked_element_rect->GetEffectiveBounds(
      Philip Rogers . unresolved

      Should we move the call to GetEffectiveBounds down into

      File third_party/blink/renderer/core/paint/inline_box_fragment_painter.cc
      Line 169, Patchset 1 (Latest): paint_info.context.GetPaintController().RecordTrackedElementData(
      Philip Rogers . unresolved

      Should we move the call to GetEffectiveBounds down into RecordTrackedElementData?

      File third_party/blink/renderer/platform/graphics/paint/tracked_element_data.h
      Line 38, Patchset 1 (Latest): static std::unique_ptr<TrackedElementRect> CreateFull(TrackedElementId id) {
      AI Code Reviewer . unresolved

      Blink Style Guide: Don't mix Create () factory methods and public constructors in one class. Since this struct has public constructors, please remove these `Create` methods and use `std::make_unique<TrackedElementRect>(...)` directly at the call sites.

      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)_

      Philip Rogers

      I agree with AI Code Reviewer, can we just have one create function?

      Line 27, Patchset 1 (Latest): gfx::Rect region;
      Philip Rogers . unresolved

      Region is a type which is a collection of rects, so this could be confusing. Can you rename this region -> rect?

      Line 18, Patchset 1 (Latest):// Represents a single tracked element, currently it tracks full element
      Philip Rogers . unresolved

      Please update this comment

      Open in Gerrit

      Related details

      Attention is currently required from:
      • Khushal Sagar
      • 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: I7fa95236870d0bc9a7b2e991da030862b0ead04c
      Gerrit-Change-Number: 7451382
      Gerrit-PatchSet: 1
      Gerrit-Owner: Przemyslaw Szczepaniak <pszcze...@google.com>
      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: David Bokan <bo...@chromium.org>
      Gerrit-CC: Dirk Schulze <dsch...@chromium.org>
      Gerrit-CC: Stephen Chenney <sche...@chromium.org>
      Gerrit-Attention: Khushal Sagar <khusha...@chromium.org>
      Gerrit-Attention: Przemyslaw Szczepaniak <pszcze...@google.com>
      Gerrit-Comment-Date: Mon, 12 Jan 2026 19:28:52 +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

      Khushal Sagar (Gerrit)

      unread,
      Jan 13, 2026, 2:20:10 AM (yesterday) Jan 13
      to Przemyslaw Szczepaniak, AI Code Reviewer, Philip Rogers, David Bokan, chromium...@chromium.org, Dirk Schulze, Stephen Chenney, blink-re...@chromium.org, blink-revi...@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, zol...@webkit.org
      Attention needed from Przemyslaw Szczepaniak

      Khushal Sagar added 2 comments

      File third_party/blink/renderer/platform/graphics/paint/tracked_element_data.h
      Khushal Sagar . unresolved

      we should add a comment to clarify what this `region` is relative to. @p...@chromium.org any suggestions?

      Since this is calculated using the geometry in APC, it will be based on the visible_bounding_box computed [here](https://source.chromium.org/chromium/chromium/src/+/main:third_party/blink/renderer/modules/content_extraction/ai_page_content_agent.cc;l=116;drc=f3b299d131a2d94c2bc1cae88e703f62880cf60d). This patch is assuming that the visible_bounding_box is in the same coordinate space as visual_rect. Is that assumption correct? If so, what's the canonical way to refer to this coordinate space in the code..?

      Line 24, Patchset 1 (Latest): kIntersectWithElementRect,
      kNoIntersection,
      Khushal Sagar . unresolved

      Do we need both these cases right now? I'm assuming this sub-rect should always be a subset of the element's painted bounds. I'm not sure what we should be doing if the element is resized such that it's no longer a subset. But in that case the subset is probably incorrect anyway, it's relative to the element's previous painted size.

      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 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: I7fa95236870d0bc9a7b2e991da030862b0ead04c
      Gerrit-Change-Number: 7451382
      Gerrit-PatchSet: 1
      Gerrit-Owner: Przemyslaw Szczepaniak <pszcze...@google.com>
      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: David Bokan <bo...@chromium.org>
      Gerrit-CC: Dirk Schulze <dsch...@chromium.org>
      Gerrit-CC: Stephen Chenney <sche...@chromium.org>
      Gerrit-Attention: Przemyslaw Szczepaniak <pszcze...@google.com>
      Gerrit-Comment-Date: Tue, 13 Jan 2026 07:19:59 +0000
      Gerrit-HasComments: Yes
      Gerrit-Has-Labels: No
      satisfied_requirement
      unsatisfied_requirement
      open
      diffy

      Przemyslaw Szczepaniak (Gerrit)

      unread,
      Jan 13, 2026, 11:39:28 AM (yesterday) Jan 13
      to Stephen Chenney, David Bokan, chromium...@chromium.org, Dirk Schulze, kinuko...@chromium.org, cc-...@chromium.org, blink-re...@chromium.org, drott+bl...@chromium.org, blink-...@chromium.org, blink-revi...@chromium.org, fmalit...@chromium.org, fserb...@chromium.org, ipc-securi...@chromium.org, blink-rev...@chromium.org, blink-reviews-p...@chromium.org, zol...@webkit.org

      Przemyslaw Szczepaniak has uploaded the change for review

      Commit message

      Extend TrackedElementRect to support sub-rectangle tracking

      This change allows tracking a specific sub-region of an element instead
      of its entire bounds.

      - Added SubRect struct to TrackedElementRect to hold a relative region
      and an 'intersect_with_element_rect' flag.
      - Introduced TrackedElementRect::GetEffectiveBounds() to handle
      coordinate calculations and optional clipping.
      - Updated BoxPainter, BoxFragmentPainter and InlineBoxFragmentPainter
      to use the new sub-rectangle logic during paint recording.
      - Added unit tests to verify sub-rectangle tracking with and without
      intersection with the element bounds.

      Change diff


      Change information

      Files:
      • M third_party/blink/renderer/core/exported/web_plugin_container_impl.cc
      • M third_party/blink/renderer/core/page/scrolling/scrolling_test.cc
      • M third_party/blink/renderer/core/paint/box_fragment_painter.cc
      • M third_party/blink/renderer/core/paint/box_fragment_painter_test.cc
      • M third_party/blink/renderer/core/paint/box_painter.cc
      • M third_party/blink/renderer/core/paint/inline_box_fragment_painter.cc
      • M third_party/blink/renderer/platform/graphics/paint/paint_controller.cc
      • M third_party/blink/renderer/platform/graphics/paint/paint_controller.h
      • M third_party/blink/renderer/platform/graphics/paint/paint_controller_test.cc
      • M third_party/blink/renderer/platform/graphics/paint/tracked_element_data.cc
      • M third_party/blink/renderer/platform/graphics/paint/tracked_element_data.h
      Change size: M
      Delta: 11 files changed, 129 insertions(+), 24 deletions(-)
      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: newchange
        Gerrit-Project: chromium/src
        Gerrit-Branch: main
        Gerrit-Change-Id: I1f75165ff7a2acaca8ed24387b293c85e344106b
        Gerrit-Change-Number: 7460752
        Gerrit-PatchSet: 1
        Gerrit-Owner: Przemyslaw Szczepaniak <pszcze...@google.com>
        satisfied_requirement
        unsatisfied_requirement
        open
        diffy

        Przemyslaw Szczepaniak (Gerrit)

        unread,
        Jan 13, 2026, 11:46:05 AM (yesterday) Jan 13
        to David Bokan, chromium...@chromium.org, Dirk Schulze, Stephen Chenney, blink-re...@chromium.org, blink-revi...@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, zol...@webkit.org

        Przemyslaw Szczepaniak abandoned this change.

        View Change

        Abandoned dup

        Przemyslaw Szczepaniak abandoned this change

        Related details

        Attention set is empty
        Submit Requirements:
        • requirement satisfiedCode-Coverage
        • 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: abandon
        satisfied_requirement
        unsatisfied_requirement
        open
        diffy

        Przemyslaw Szczepaniak (Gerrit)

        unread,
        4:34 AM (19 hours ago) 4:34 AM
        to AI Code Reviewer, Philip Rogers, Khushal Sagar, David Bokan, chromium...@chromium.org, Dirk Schulze, Stephen Chenney, blink-re...@chromium.org, blink-revi...@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, zol...@webkit.org
        Attention needed from Khushal Sagar and Philip Rogers

        Przemyslaw Szczepaniak added 9 comments

        Patchset-level comments
        File-level comment, Patchset 2 (Latest):
        Przemyslaw Szczepaniak . resolved

        Right, I would love to update revised version, but 'git cl upload --no-squish' for 2 dependant cls seems to hate the idea of adding Change-Id to the latter cl. It generates new cl for every invocation, will probably have to wait for the base cl to be submitted?

        Commit Message
        Line 20, Patchset 1:
        Philip Rogers . resolved

        Pease add Bug: 459385624 to keep everything connected.

        Przemyslaw Szczepaniak

        Done

        File third_party/blink/renderer/core/paint/box_fragment_painter.cc
        Line 3025, Patchset 1: gfx::Rect rect = tracked_element_rect->GetEffectiveBounds(
        Philip Rogers . resolved

        Should we move the call to GetEffectiveBounds down into

        Przemyslaw Szczepaniak

        Done

        File third_party/blink/renderer/core/paint/inline_box_fragment_painter.cc
        Line 169, Patchset 1: paint_info.context.GetPaintController().RecordTrackedElementData(
        Philip Rogers . resolved

        Should we move the call to GetEffectiveBounds down into RecordTrackedElementData?

        Przemyslaw Szczepaniak

        Done

        File third_party/blink/renderer/platform/graphics/paint/tracked_element_data.h
        Line 38, Patchset 1: static std::unique_ptr<TrackedElementRect> CreateFull(TrackedElementId id) {
        AI Code Reviewer . resolved

        Blink Style Guide: Don't mix Create () factory methods and public constructors in one class. Since this struct has public constructors, please remove these `Create` methods and use `std::make_unique<TrackedElementRect>(...)` directly at the call sites.

        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)_

        Philip Rogers

        I agree with AI Code Reviewer, can we just have one create function?

        Przemyslaw Szczepaniak

        Done

        Line 27, Patchset 1: gfx::Rect region;
        Philip Rogers . resolved

        Region is a type which is a collection of rects, so this could be confusing. Can you rename this region -> rect?

        Przemyslaw Szczepaniak

        Done

        Line 27, Patchset 1: gfx::Rect region;
        Khushal Sagar . unresolved

        we should add a comment to clarify what this `region` is relative to. @p...@chromium.org any suggestions?

        Since this is calculated using the geometry in APC, it will be based on the visible_bounding_box computed [here](https://source.chromium.org/chromium/chromium/src/+/main:third_party/blink/renderer/modules/content_extraction/ai_page_content_agent.cc;l=116;drc=f3b299d131a2d94c2bc1cae88e703f62880cf60d). This patch is assuming that the visible_bounding_box is in the same coordinate space as visual_rect. Is that assumption correct? If so, what's the canonical way to refer to this coordinate space in the code..?

        Przemyslaw Szczepaniak

        just to clarify the purpose of this field - we're going to have the rect in screen space coordinates, and then try to map it against elements, as seen in the APC.

        Line 24, Patchset 1: kIntersectWithElementRect,
        kNoIntersection,
        Khushal Sagar . resolved

        Do we need both these cases right now? I'm assuming this sub-rect should always be a subset of the element's painted bounds. I'm not sure what we should be doing if the element is resized such that it's no longer a subset. But in that case the subset is probably incorrect anyway, it's relative to the element's previous painted size.

        Przemyslaw Szczepaniak

        I would prefer to keep no-intersection it as an "escape hatch" option if we find that the intersection is not working correctly.

        Line 18, Patchset 1:// Represents a single tracked element, currently it tracks full element
        Philip Rogers . resolved

        Please update this comment

        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: I7fa95236870d0bc9a7b2e991da030862b0ead04c
        Gerrit-Change-Number: 7451382
        Gerrit-PatchSet: 2
        Gerrit-Owner: Przemyslaw Szczepaniak <pszcze...@google.com>
        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: David Bokan <bo...@chromium.org>
        Gerrit-CC: Dirk Schulze <dsch...@chromium.org>
        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, 14 Jan 2026 09:33:57 +0000
        Gerrit-HasComments: Yes
        Gerrit-Has-Labels: No
        Comment-In-Reply-To: Khushal Sagar <khusha...@chromium.org>
        Comment-In-Reply-To: Philip Rogers <p...@chromium.org>
        satisfied_requirement
        unsatisfied_requirement
        open
        diffy

        Przemyslaw Szczepaniak (Gerrit)

        unread,
        8:40 AM (15 hours ago) 8:40 AM
        to AI Code Reviewer, Philip Rogers, Khushal Sagar, David Bokan, chromium...@chromium.org, Dirk Schulze, Stephen Chenney, blink-re...@chromium.org, blink-revi...@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, zol...@webkit.org
        Attention needed from Khushal Sagar and Philip Rogers

        Przemyslaw Szczepaniak added 1 comment

        Patchset-level comments
        Przemyslaw Szczepaniak . resolved

        Right, I would love to update revised version, but 'git cl upload --no-squish' for 2 dependant cls seems to hate the idea of adding Change-Id to the latter cl. It generates new cl for every invocation, will probably have to wait for the base cl to be submitted?

        Przemyslaw Szczepaniak

        tried to generate a valid change-id for this one, but something is borked, best I could do is the new change with change-id: https://chromium-review.googlesource.com/c/chromium/src/+/7464882 , can we move the review there?

        Gerrit-Comment-Date: Wed, 14 Jan 2026 13:40:44 +0000
        Gerrit-HasComments: Yes
        Gerrit-Has-Labels: No
        Comment-In-Reply-To: Przemyslaw Szczepaniak <pszcze...@google.com>
        satisfied_requirement
        unsatisfied_requirement
        open
        diffy

        Przemyslaw Szczepaniak (Gerrit)

        unread,
        10:27 AM (13 hours ago) 10:27 AM
        to AI Code Reviewer, Philip Rogers, Khushal Sagar, David Bokan, chromium...@chromium.org, Dirk Schulze, Stephen Chenney, blink-re...@chromium.org, blink-revi...@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, zol...@webkit.org
        Attention needed from Khushal Sagar and Philip Rogers

        Przemyslaw Szczepaniak added 1 comment

        Patchset-level comments
        Przemyslaw Szczepaniak . resolved

        Right, I would love to update revised version, but 'git cl upload --no-squish' for 2 dependant cls seems to hate the idea of adding Change-Id to the latter cl. It generates new cl for every invocation, will probably have to wait for the base cl to be submitted?

        Przemyslaw Szczepaniak

        tried to generate a valid change-id for this one, but something is borked, best I could do is the new change with change-id: https://chromium-review.googlesource.com/c/chromium/src/+/7464882 , can we move the review there?

        Przemyslaw Szczepaniak

        Ignore previous messages, git cl patch into branch made it generated correct change Id, I pulled the other cl into this one.

        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: I7fa95236870d0bc9a7b2e991da030862b0ead04c
        Gerrit-Change-Number: 7451382
        Gerrit-PatchSet: 4
        Gerrit-Owner: Przemyslaw Szczepaniak <pszcze...@google.com>
        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: David Bokan <bo...@chromium.org>
        Gerrit-CC: Dirk Schulze <dsch...@chromium.org>
        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, 14 Jan 2026 15:27:26 +0000
        satisfied_requirement
        unsatisfied_requirement
        open
        diffy

        Przemyslaw Szczepaniak (Gerrit)

        unread,
        10:28 AM (13 hours ago) 10:28 AM
        to Philip Rogers, Khushal Sagar, David Bokan, chromium...@chromium.org, Dirk Schulze, Stephen Chenney, blink-rev...@chromium.org, blink-reviews-p...@chromium.org, blink-...@chromium.org, drott+bl...@chromium.org, fmalit...@chromium.org, fserb...@chromium.org, kinuko...@chromium.org

        Przemyslaw Szczepaniak abandoned this change.

        View Change

        Abandoned

        Przemyslaw Szczepaniak abandoned this change

        Related details

        Attention set is empty
        Submit Requirements:
        • requirement satisfiedCode-Coverage
        • 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: abandon
        Gerrit-Project: chromium/src
        Gerrit-Branch: main
        Gerrit-Change-Id: I394e91b5da6aa3b0313a1c18567316a7e61c9a59
        Gerrit-Change-Number: 7464882
        Gerrit-PatchSet: 7
        Gerrit-Owner: Przemyslaw Szczepaniak <pszcze...@google.com>
        Gerrit-Reviewer: Khushal Sagar <khusha...@chromium.org>
        Gerrit-Reviewer: Philip Rogers <p...@chromium.org>
        satisfied_requirement
        unsatisfied_requirement
        open
        diffy

        Philip Rogers (Gerrit)

        unread,
        5:38 PM (6 hours ago) 5:38 PM
        to Przemyslaw Szczepaniak, AI Code Reviewer, Khushal Sagar, David Bokan, chromium...@chromium.org, Dirk Schulze, Stephen Chenney, blink-re...@chromium.org, blink-revi...@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, zol...@webkit.org
        Attention needed from Khushal Sagar and Przemyslaw Szczepaniak

        Philip Rogers voted and added 5 comments

        Votes added by Philip Rogers

        Code-Review+1

        5 comments

        Patchset-level comments
        File-level comment, Patchset 4 (Latest):
        Philip Rogers . resolved

        LGTM

        File third_party/blink/renderer/core/paint/box_fragment_painter.cc
        Line 3027, Patchset 4 (Latest):
        Philip Rogers . unresolved

        remove extra ainewlines

        Line 3029, Patchset 4 (Latest):
        Philip Rogers . unresolved

        ditto here

        File third_party/blink/renderer/platform/graphics/paint/tracked_element_data.h
        Line 38, Patchset 4 (Latest): TrackedElementRect(TrackedElementId id,
        Philip Rogers . unresolved

        Please fix this WARNING reported by ClangTidy: check: google-explicit-constructor

        constructors that are callable with a single...

        check: google-explicit-constructor

        constructors that are callable with a single argument must be marked explicit to avoid unintentional implicit conversions (https://clang.llvm.org/extra/clang-tidy/checks/google/explicit-constructor.html)

        (Note: You can add `Skip-Clang-Tidy-Checks: google-explicit-constructor` footer to the CL description to skip the check)

        (Lint observed on `linux-clang-tidy-rel`, but not on `android-clang-tidy-rel`)

        Line 23, Patchset 4 (Latest): // While tracking the rectangle, the output is intesection of specified
        Philip Rogers . unresolved

        Please fix this WARNING reported by Spellchecker: "intesection" is a possible misspelling of "intersection".

        To bypass Spellcheck...

        "intesection" is a possible misspelling of "intersection".

        To bypass Spellchecker, add a footer with DISABLE_SPELLCHECKER

        Open in Gerrit

        Related details

        Attention is currently required from:
        • Khushal Sagar
        • Przemyslaw Szczepaniak
        Submit Requirements:
        • requirement satisfiedCode-Coverage
        • requirement 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: I7fa95236870d0bc9a7b2e991da030862b0ead04c
        Gerrit-Change-Number: 7451382
        Gerrit-PatchSet: 4
        Gerrit-Owner: Przemyslaw Szczepaniak <pszcze...@google.com>
        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: David Bokan <bo...@chromium.org>
        Gerrit-CC: Dirk Schulze <dsch...@chromium.org>
        Gerrit-CC: Stephen Chenney <sche...@chromium.org>
        Gerrit-Attention: Khushal Sagar <khusha...@chromium.org>
        Gerrit-Attention: Przemyslaw Szczepaniak <pszcze...@google.com>
        Gerrit-Comment-Date: Wed, 14 Jan 2026 22:37:52 +0000
        Gerrit-HasComments: Yes
        Gerrit-Has-Labels: Yes
        satisfied_requirement
        unsatisfied_requirement
        open
        diffy

        Khushal Sagar (Gerrit)

        unread,
        7:45 PM (3 hours ago) 7:45 PM
        to Przemyslaw Szczepaniak, Philip Rogers, AI Code Reviewer, David Bokan, chromium...@chromium.org, Dirk Schulze, Stephen Chenney, blink-re...@chromium.org, blink-revi...@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, zol...@webkit.org
        Attention needed from Przemyslaw Szczepaniak

        Khushal Sagar voted and added 1 comment

        Votes added by Khushal Sagar

        Code-Review+1

        1 comment

        File third_party/blink/renderer/platform/graphics/paint/tracked_element_data.h
        Line 27, Patchset 1: gfx::Rect region;
        Khushal Sagar . unresolved

        we should add a comment to clarify what this `region` is relative to. @p...@chromium.org any suggestions?

        Since this is calculated using the geometry in APC, it will be based on the visible_bounding_box computed [here](https://source.chromium.org/chromium/chromium/src/+/main:third_party/blink/renderer/modules/content_extraction/ai_page_content_agent.cc;l=116;drc=f3b299d131a2d94c2bc1cae88e703f62880cf60d). This patch is assuming that the visible_bounding_box is in the same coordinate space as visual_rect. Is that assumption correct? If so, what's the canonical way to refer to this coordinate space in the code..?

        Przemyslaw Szczepaniak

        just to clarify the purpose of this field - we're going to have the rect in screen space coordinates, and then try to map it against elements, as seen in the APC.

        Khushal Sagar

        Using APC to map from screen space coordinates to a subrect in the element makes sense. There's differences in coordinate spaces between APC and paint, APC works in layout/hit-testing space while paint will include visual effects (like shadow on a box). We'll have to figure out how to deal with this when writing the mapping.

        The code in GetEffectiveBounds is making an assumption about the coordinate space for rect. That's why I was suggesting being explicit about it. Maybe `paint_subset` with a comment: "A subset relative to this element's visual/painted rect. The visual rect includes all effects from the element like shadow, filter etc." @p...@chromium.org can confirm that I got this right.

        Open in Gerrit

        Related details

        Attention is currently required from:
        • Przemyslaw Szczepaniak
        Submit Requirements:
          • requirement satisfiedCode-Coverage
          • requirement satisfiedCode-Owners
          • requirement satisfiedCode-Review
          • requirement is not satisfiedNo-Unresolved-Comments
          • requirement satisfiedReview-Enforcement
          Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. DiffyGerrit
          Gerrit-MessageType: comment
          Gerrit-Project: chromium/src
          Gerrit-Branch: main
          Gerrit-Change-Id: I7fa95236870d0bc9a7b2e991da030862b0ead04c
          Gerrit-Change-Number: 7451382
          Gerrit-PatchSet: 4
          Gerrit-Owner: Przemyslaw Szczepaniak <pszcze...@google.com>
          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: David Bokan <bo...@chromium.org>
          Gerrit-CC: Dirk Schulze <dsch...@chromium.org>
          Gerrit-CC: Stephen Chenney <sche...@chromium.org>
          Gerrit-Attention: Przemyslaw Szczepaniak <pszcze...@google.com>
          Gerrit-Comment-Date: Thu, 15 Jan 2026 00:45:33 +0000
          Gerrit-HasComments: Yes
          Gerrit-Has-Labels: Yes
          Comment-In-Reply-To: Khushal Sagar <khusha...@chromium.org>
          Comment-In-Reply-To: Przemyslaw Szczepaniak <pszcze...@google.com>
          satisfied_requirement
          unsatisfied_requirement
          open
          diffy
          Reply all
          Reply to author
          Forward
          0 new messages