Recompute offset-path transform when containing block resizes [chromium/src : main]

1 view
Skip to first unread message

Wangsong Jin (Gerrit)

unread,
Jun 4, 2026, 1:07:09 PMJun 4
to Chromium LUCI CQ, android-bu...@system.gserviceaccount.com, chromium...@chromium.org, blink-revi...@chromium.org, blink-revie...@chromium.org, blink-...@chromium.org, jmedle...@chromium.org, kinuko...@chromium.org, zol...@webkit.org
Attention needed from Wangsong Jin

Message from Wangsong Jin

Set Ready For Review

Open in Gerrit

Related details

Attention is currently required from:
  • Wangsong Jin
Submit Requirements:
  • requirement satisfiedCode-Coverage
  • requirement is not satisfiedCode-Owners
  • requirement is not satisfiedCode-Review
  • requirement is not satisfiedReview-Enforcement
Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. DiffyGerrit
Gerrit-MessageType: comment
Gerrit-Project: chromium/src
Gerrit-Branch: main
Gerrit-Change-Id: Iba55090a47ac38c931b0d28ee90c94c0d0def2d1
Gerrit-Change-Number: 7896208
Gerrit-PatchSet: 4
Gerrit-Owner: Wangsong Jin <wangs...@microsoft.com>
Gerrit-Reviewer: Wangsong Jin <wangs...@microsoft.com>
Gerrit-Attention: Wangsong Jin <wangs...@microsoft.com>
Gerrit-Comment-Date: Thu, 04 Jun 2026 17:06:53 +0000
Gerrit-HasComments: No
Gerrit-Has-Labels: No
satisfied_requirement
unsatisfied_requirement
open
diffy

Wangsong Jin (Gerrit)

unread,
Jun 24, 2026, 2:03:43 PMJun 24
to Philip Rogers, Ian Kilpatrick, Claire Chambers, Olga Gerchikov, Chromium LUCI CQ, android-bu...@system.gserviceaccount.com, chromium...@chromium.org, blink-rev...@chromium.org, blink-rev...@chromium.org, blink-revi...@chromium.org, blink-revie...@chromium.org, blink-...@chromium.org, jmedle...@chromium.org, kinuko...@chromium.org, zol...@webkit.org
Attention needed from Claire Chambers and Philip Rogers

Wangsong Jin added 9 comments

Patchset-level comments
File-level comment, Patchset 9:
Philip Rogers . unresolved

I think PaintLayer::UpdateTransform is also stale in this scenario.

Is the spec clear on this behavior? Is offset-path the only transform property that depends on ancestor size like this, or are there others?

Wangsong Jin

Is the spec clear on this behavior?

Per CSS Motion Path §2.1, the <coord-box> reference box is "from the element that establishes the containing block for this element," (https://drafts.csswg.org/motion-1/#offset-path-property) so a containing block resize should trigger recomputation.
Does that address your spec question, or is there a specific aspect of the behavior defined in this change that you think the spec is unclear on?

Wangsong Jin

I think PaintLayer::UpdateTransform is also stale in this scenario.

Good catch! I've added an explicit `UpdateTransform()` call to keep the cached matrix in sync, along with a unit test that confirms the test fails without it.

File-level comment, Patchset 9:
Philip Rogers . resolved

Could we use a descendant dependent flag (see: UpdateDescendantDependentFlags and has_fixed_position_descendant_)? These flags are updated prior to pre-paint / property tree building. Would it be any better to save and detect size changes and issue invalidations from there?

Wangsong Jin

Thanks for the suggestion! I've updated the CL to follow that approach — invalidation is now deferred to `UpdateDescendantDependentFlags()`, and a `has_offset_path_descendant_`  flag on `PaintLayer` (following the `has_fixed_position_descendant_`  pattern) gates the scheduling in `SizeChanged()`. This avoids the tree walk during layout.

File third_party/blink/renderer/core/layout/layout_box.cc
Line 2355, Patchset 9: InvalidateDescendantOffsetPaths();
Ian Kilpatrick . resolved

This is to slow to do a full tree walk within SizeChanged, should this be moved elsewhere?

Wangsong Jin

Yep, moved to `UpdateDescendantDependentFlags()`

Line 2362, Patchset 9:static bool OffsetPathDependsOnContainingBlock(
Claire Chambers . resolved

This should be a direct instance method of `OffsetPathOperation`, to facilitate re-use and avoid polluting layout classes.

Wangsong Jin

Thanks. I've added `OffsetPathOperation::DependsOnContainingBlock()` as a virtual method, with overrides on each subclass (`ShapeOffsetPathOperation`, `CoordBoxOffsetPathOperation`, `ReferenceOffsetPathOperation`).

Line 2378, Patchset 9:void LayoutBox::InvalidateDescendantOffsetPaths() {
Claire Chambers . unresolved

Are you sure that a `LayoutInline` is never used as a container? I did some brief testing, and was able to get the apparent travel paths of an offset-path to change by adjusting the font size of the box.

Wangsong Jin

`ContainingBlock()` returns `LayoutBlock*` , and `InclusiveContainingBlock()`  explicitly skips LayoutInline and walks up to the nearest `LayoutBlock`. So a `LayoutInline` shouldn't act as the containing block for `offset-path` resolution. I think the `font-size` change you saw affecting the travel path was likely because the inline's content reflow caused its enclosing `LayoutBlock` to resize.

Line 2388, Patchset 9: const auto* offset_path = descendant->StyleRef().OffsetPath();
Claire Chambers . resolved

The control flow of this function is a little weird.

You should be checking `descendant->MayContainOffsetPath()` first as that will also rule out `descendant` itself containing `offset-path`. This would allow you to go to the else early, skipping one check. It also makes it easier to read, becoming...


```
if(descendant->MayContainOffsetPath()) {
... core logic ...
} else {
// Skip subtrees that cannot contain offset-path elements.
descendant = descendant->NextInPreOrderAfterChildren(this);
}
Wangsong Jin

I've removed the DOM tree walk and `MayContainOffsetPath` entirely. The invalidation now happens in `UpdateDescendantDependentFlags()`.

Line 2390, Patchset 9: OffsetPathDependsOnContainingBlock(*offset_path) &&
Claire Chambers . resolved

I feel like this should also be checked before setting the flag. You'll also have to check it here, to avoid over-invalidation, but less flag setting = less walking = more happy web platform engineers :)

Wangsong Jin

Done

Line 2391, Patchset 9: descendant->ContainingBlock() == this) {
Claire Chambers . resolved

It would be more complicated, but you could likely make this walk more efficient by incorporating WHAT kind of containing block this is. If this is, say, an absolute containing block, and you go down two children, and you find another absolute containing block, you know that no children will ever use you as an absolute containing block, as the deepest element takes precedence.

This is convenient because these values are cached in bitfields, it's a relatively cheap lookup. E.g. `can_contain_absolute_position_objects_`. This could help you abort deep tree walks early.

Wangsong Jin

Thanks for the suggestion! This is less relevant now since we no longer do a DOM tree walk in latest update.

File third_party/blink/renderer/core/layout/layout_object.cc
Line 575, Patchset 9:void LayoutObject::MarkMayContainOffsetPath() {
for (LayoutObject* runner = this; runner && !runner->MayContainOffsetPath();
runner = runner->Parent()) {
runner->SetSelfMayContainOffsetPath();
}
}
Claire Chambers . resolved

It's marginal, but I think this should also be gated behind the killswitch.

Wangsong Jin

Resolved this. This logic is removed.

Open in Gerrit

Related details

Attention is currently required from:
  • Claire Chambers
  • 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: Iba55090a47ac38c931b0d28ee90c94c0d0def2d1
    Gerrit-Change-Number: 7896208
    Gerrit-PatchSet: 13
    Gerrit-Owner: Wangsong Jin <wangs...@microsoft.com>
    Gerrit-Reviewer: Claire Chambers <clcha...@microsoft.com>
    Gerrit-Reviewer: Olga Gerchikov <gerc...@microsoft.com>
    Gerrit-Reviewer: Wangsong Jin <wangs...@microsoft.com>
    Gerrit-CC: Ian Kilpatrick <ikilp...@google.com>
    Gerrit-CC: Philip Rogers <p...@chromium.org>
    Gerrit-Attention: Philip Rogers <p...@chromium.org>
    Gerrit-Attention: Claire Chambers <clcha...@microsoft.com>
    Gerrit-Comment-Date: Wed, 24 Jun 2026 18:03:26 +0000
    Gerrit-HasComments: Yes
    Gerrit-Has-Labels: No
    Comment-In-Reply-To: Ian Kilpatrick <ikilp...@google.com>
    Comment-In-Reply-To: Philip Rogers <p...@chromium.org>
    Comment-In-Reply-To: Wangsong Jin <wangs...@microsoft.com>
    Comment-In-Reply-To: Claire Chambers <clcha...@microsoft.com>
    satisfied_requirement
    unsatisfied_requirement
    open
    diffy

    Ian Kilpatrick (Gerrit)

    unread,
    Jun 24, 2026, 2:08:39 PMJun 24
    to Wangsong Jin, Philip Rogers, Ian Kilpatrick, Claire Chambers, Olga Gerchikov, Chromium LUCI CQ, android-bu...@system.gserviceaccount.com, chromium...@chromium.org, blink-rev...@chromium.org, blink-rev...@chromium.org, blink-revi...@chromium.org, blink-revie...@chromium.org, blink-...@chromium.org, jmedle...@chromium.org, kinuko...@chromium.org, zol...@webkit.org
    Attention needed from Claire Chambers, Philip Rogers and Wangsong Jin

    Ian Kilpatrick added 1 comment

    File third_party/blink/renderer/core/layout/layout_box.cc
    Line 2352, Patchset 13 (Latest): PaintLayer* layer = HasLayer() ? Layer() : EnclosingLayer();
    Ian Kilpatrick . unresolved

    This still might be too slow - (i'll kick of some pinpoints). Can the invalidation be moved to pre-paint or elsewhere?

    (This is called multiple times per layout and is very performance sensitive).

    Open in Gerrit

    Related details

    Attention is currently required from:
    • Claire Chambers
    • Philip Rogers
    • Wangsong Jin
    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: Iba55090a47ac38c931b0d28ee90c94c0d0def2d1
    Gerrit-Change-Number: 7896208
    Gerrit-PatchSet: 13
    Gerrit-Owner: Wangsong Jin <wangs...@microsoft.com>
    Gerrit-Reviewer: Claire Chambers <clcha...@microsoft.com>
    Gerrit-Reviewer: Olga Gerchikov <gerc...@microsoft.com>
    Gerrit-Reviewer: Wangsong Jin <wangs...@microsoft.com>
    Gerrit-CC: Ian Kilpatrick <ikilp...@chromium.org>
    Gerrit-CC: Ian Kilpatrick <ikilp...@google.com>
    Gerrit-CC: Philip Rogers <p...@chromium.org>
    Gerrit-Attention: Philip Rogers <p...@chromium.org>
    Gerrit-Attention: Wangsong Jin <wangs...@microsoft.com>
    Gerrit-Attention: Claire Chambers <clcha...@microsoft.com>
    Gerrit-Comment-Date: Wed, 24 Jun 2026 18:08:22 +0000
    Gerrit-HasComments: Yes
    Gerrit-Has-Labels: No
    satisfied_requirement
    unsatisfied_requirement
    open
    diffy

    Wangsong Jin (Gerrit)

    unread,
    Jun 24, 2026, 2:54:28 PMJun 24
    to Ian Kilpatrick, Philip Rogers, Ian Kilpatrick, Claire Chambers, Olga Gerchikov, Chromium LUCI CQ, android-bu...@system.gserviceaccount.com, chromium...@chromium.org, blink-rev...@chromium.org, blink-rev...@chromium.org, blink-revi...@chromium.org, blink-revie...@chromium.org, blink-...@chromium.org, jmedle...@chromium.org, kinuko...@chromium.org, zol...@webkit.org
    Attention needed from Ian Kilpatrick

    Wangsong Jin added 1 comment

    File third_party/blink/renderer/core/layout/layout_box.cc
    Line 2352, Patchset 13 (Latest): PaintLayer* layer = HasLayer() ? Layer() : EnclosingLayer();
    Ian Kilpatrick . unresolved

    This still might be too slow - (i'll kick of some pinpoints). Can the invalidation be moved to pre-paint or elsewhere?

    (This is called multiple times per layout and is very performance sensitive).

    Wangsong Jin

    Thanks for starting the pinpoints! If the overhead is non-trivial or worth the benefit, we should do that. Let's see the result first.

    Open in Gerrit

    Related details

    Attention is currently required from:
    • Ian Kilpatrick
    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: Iba55090a47ac38c931b0d28ee90c94c0d0def2d1
    Gerrit-Change-Number: 7896208
    Gerrit-PatchSet: 13
    Gerrit-Owner: Wangsong Jin <wangs...@microsoft.com>
    Gerrit-Reviewer: Claire Chambers <clcha...@microsoft.com>
    Gerrit-Reviewer: Olga Gerchikov <gerc...@microsoft.com>
    Gerrit-Reviewer: Wangsong Jin <wangs...@microsoft.com>
    Gerrit-CC: Ian Kilpatrick <ikilp...@chromium.org>
    Gerrit-CC: Ian Kilpatrick <ikilp...@google.com>
    Gerrit-CC: Philip Rogers <p...@chromium.org>
    Gerrit-Attention: Ian Kilpatrick <ikilp...@chromium.org>
    Gerrit-Comment-Date: Wed, 24 Jun 2026 18:54:07 +0000
    Gerrit-HasComments: Yes
    Gerrit-Has-Labels: No
    Comment-In-Reply-To: Ian Kilpatrick <ikilp...@chromium.org>
    satisfied_requirement
    unsatisfied_requirement
    open
    diffy

    chromeperf@appspot.gserviceaccount.com (Gerrit)

    unread,
    Jun 24, 2026, 3:28:18 PMJun 24
    to Wangsong Jin, Ian Kilpatrick, Philip Rogers, Ian Kilpatrick, Claire Chambers, Olga Gerchikov, Chromium LUCI CQ, android-bu...@system.gserviceaccount.com, chromium...@chromium.org, blink-rev...@chromium.org, blink-rev...@chromium.org, blink-revi...@chromium.org, blink-revie...@chromium.org, blink-...@chromium.org, jmedle...@chromium.org, kinuko...@chromium.org, zol...@webkit.org
    Attention needed from Ian Kilpatrick and Wangsong Jin

    Message from chrom...@appspot.gserviceaccount.com

    📍 Job mac-m4-mini-perf/speedometer3 complete.

    See results at: https://pinpoint-dot-chromeperf.appspot.com/job/12a15589c90000

    Open in Gerrit

    Related details

    Attention is currently required from:
    • Ian Kilpatrick
    • Wangsong Jin
    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: Iba55090a47ac38c931b0d28ee90c94c0d0def2d1
    Gerrit-Change-Number: 7896208
    Gerrit-PatchSet: 13
    Gerrit-Owner: Wangsong Jin <wangs...@microsoft.com>
    Gerrit-Reviewer: Claire Chambers <clcha...@microsoft.com>
    Gerrit-Reviewer: Olga Gerchikov <gerc...@microsoft.com>
    Gerrit-Reviewer: Wangsong Jin <wangs...@microsoft.com>
    Gerrit-CC: Ian Kilpatrick <ikilp...@chromium.org>
    Gerrit-CC: Ian Kilpatrick <ikilp...@google.com>
    Gerrit-CC: Philip Rogers <p...@chromium.org>
    Gerrit-Attention: Ian Kilpatrick <ikilp...@chromium.org>
    Gerrit-Attention: Wangsong Jin <wangs...@microsoft.com>
    Gerrit-Comment-Date: Wed, 24 Jun 2026 19:27:55 +0000
    Gerrit-HasComments: No
    Gerrit-Has-Labels: No
    satisfied_requirement
    unsatisfied_requirement
    open
    diffy

    Wangsong Jin (Gerrit)

    unread,
    Jun 24, 2026, 4:31:28 PMJun 24
    to chrom...@appspot.gserviceaccount.com, Ian Kilpatrick, Philip Rogers, Ian Kilpatrick, Claire Chambers, Olga Gerchikov, Chromium LUCI CQ, android-bu...@system.gserviceaccount.com, chromium...@chromium.org, blink-rev...@chromium.org, blink-rev...@chromium.org, blink-revi...@chromium.org, blink-revie...@chromium.org, blink-...@chromium.org, jmedle...@chromium.org, kinuko...@chromium.org, zol...@webkit.org
    Attention needed from Ian Kilpatrick

    Wangsong Jin added 1 comment

    File third_party/blink/renderer/core/layout/layout_box.cc
    Line 2352, Patchset 13 (Latest): PaintLayer* layer = HasLayer() ? Layer() : EnclosingLayer();
    Ian Kilpatrick . unresolved

    This still might be too slow - (i'll kick of some pinpoints). Can the invalidation be moved to pre-paint or elsewhere?

    (This is called multiple times per layout and is very performance sensitive).

    Wangsong Jin

    Thanks for starting the pinpoints! If the overhead is non-trivial or worth the benefit, we should do that. Let's see the result first.

    Wangsong Jin

    The pinpoint is green https://pinpoint-dot-chromeperf.appspot.com/job/12a15589c90000. If we still have concerns about resize performance when offset-path is present on the page, I think there’s an opportunity to move this logic into pre-paint. I’ll post the PatchSet.

    Open in Gerrit

    Related details

    Attention is currently required from:
    • Ian Kilpatrick
    Gerrit-Comment-Date: Wed, 24 Jun 2026 20:31:12 +0000
    Gerrit-HasComments: Yes
    Gerrit-Has-Labels: No
    Comment-In-Reply-To: Ian Kilpatrick <ikilp...@chromium.org>
    Comment-In-Reply-To: Wangsong Jin <wangs...@microsoft.com>
    satisfied_requirement
    unsatisfied_requirement
    open
    diffy

    Wangsong Jin (Gerrit)

    unread,
    Jun 24, 2026, 5:59:37 PMJun 24
    to chrom...@appspot.gserviceaccount.com, Ian Kilpatrick, Philip Rogers, Ian Kilpatrick, Claire Chambers, Olga Gerchikov, Chromium LUCI CQ, android-bu...@system.gserviceaccount.com, chromium...@chromium.org, blink-rev...@chromium.org, blink-rev...@chromium.org, blink-revi...@chromium.org, blink-revie...@chromium.org, blink-...@chromium.org, jmedle...@chromium.org, kinuko...@chromium.org, zol...@webkit.org
    Attention needed from Ian Kilpatrick

    Wangsong Jin added 1 comment

    File third_party/blink/renderer/core/layout/layout_box.cc
    Line 2352, Patchset 13: PaintLayer* layer = HasLayer() ? Layer() : EnclosingLayer();
    Ian Kilpatrick . unresolved

    This still might be too slow - (i'll kick of some pinpoints). Can the invalidation be moved to pre-paint or elsewhere?

    (This is called multiple times per layout and is very performance sensitive).

    Wangsong Jin

    Thanks for starting the pinpoints! If the overhead is non-trivial or worth the benefit, we should do that. Let's see the result first.

    Wangsong Jin

    The pinpoint is green https://pinpoint-dot-chromeperf.appspot.com/job/12a15589c90000. If we still have concerns about resize performance when offset-path is present on the page, I think there’s an opportunity to move this logic into pre-paint. I’ll post the PatchSet.

    Wangsong Jin

    Hi Ian, in the latest PatchSet 14, I moved all invalidation out of layout resize to pre-paint anyway. We detect CB resize in `PaintPropertyTreeBuilder::UpdateForSelf()`  by comparing `StitchedSize()` vs `PreviousSize()`. The  HasOffsetPathDescendant()  flag on PaintLayer still serves as a cheap guard to skip the descendant walk for boxes without offset-path children. Do you prefer this approach?

    Also cc @p...@chromium.org — would appreciate a quick glance at the overall approach to make sure we're on the right track.

    Open in Gerrit

    Related details

    Attention is currently required from:
    • Ian Kilpatrick
    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: Iba55090a47ac38c931b0d28ee90c94c0d0def2d1
    Gerrit-Change-Number: 7896208
    Gerrit-PatchSet: 14
    Gerrit-Owner: Wangsong Jin <wangs...@microsoft.com>
    Gerrit-Reviewer: Claire Chambers <clcha...@microsoft.com>
    Gerrit-Reviewer: Olga Gerchikov <gerc...@microsoft.com>
    Gerrit-Reviewer: Wangsong Jin <wangs...@microsoft.com>
    Gerrit-CC: Ian Kilpatrick <ikilp...@chromium.org>
    Gerrit-CC: Ian Kilpatrick <ikilp...@google.com>
    Gerrit-CC: Philip Rogers <p...@chromium.org>
    Gerrit-Attention: Ian Kilpatrick <ikilp...@chromium.org>
    Gerrit-Comment-Date: Wed, 24 Jun 2026 21:59:23 +0000
    satisfied_requirement
    unsatisfied_requirement
    open
    diffy

    chromeperf@appspot.gserviceaccount.com (Gerrit)

    unread,
    Jun 25, 2026, 4:30:32 PM (13 days ago) Jun 25
    to Wangsong Jin, Ian Kilpatrick, Philip Rogers, Ian Kilpatrick, Claire Chambers, Olga Gerchikov, Chromium LUCI CQ, android-bu...@system.gserviceaccount.com, chromium...@chromium.org, blink-rev...@chromium.org, blink-rev...@chromium.org, blink-revi...@chromium.org, blink-revie...@chromium.org, blink-...@chromium.org, jmedle...@chromium.org, kinuko...@chromium.org, zol...@webkit.org
    Attention needed from Ian Kilpatrick and Wangsong Jin

    Message from chrom...@appspot.gserviceaccount.com

    📍 Job mac-m4-mini-perf/speedometer3 complete.

    See results at: https://pinpoint-dot-chromeperf.appspot.com/job/1417c761c90000

    Open in Gerrit

    Related details

    Attention is currently required from:
    • Ian Kilpatrick
    • Wangsong Jin
    Gerrit-Attention: Wangsong Jin <wangs...@microsoft.com>
    Gerrit-Comment-Date: Thu, 25 Jun 2026 20:30:20 +0000
    Gerrit-HasComments: No
    Gerrit-Has-Labels: No
    satisfied_requirement
    unsatisfied_requirement
    open
    diffy

    Wangsong Jin (Gerrit)

    unread,
    Jun 25, 2026, 5:54:16 PM (13 days ago) Jun 25
    to chrom...@appspot.gserviceaccount.com, Ian Kilpatrick, Philip Rogers, Ian Kilpatrick, Claire Chambers, Olga Gerchikov, Chromium LUCI CQ, android-bu...@system.gserviceaccount.com, chromium...@chromium.org, blink-rev...@chromium.org, blink-rev...@chromium.org, blink-revi...@chromium.org, blink-revie...@chromium.org, blink-...@chromium.org, jmedle...@chromium.org, kinuko...@chromium.org, zol...@webkit.org
    Attention needed from Ian Kilpatrick

    Wangsong Jin added 1 comment

    File third_party/blink/renderer/core/layout/layout_box.cc
    Line 2352, Patchset 13: PaintLayer* layer = HasLayer() ? Layer() : EnclosingLayer();
    Ian Kilpatrick . unresolved

    This still might be too slow - (i'll kick of some pinpoints). Can the invalidation be moved to pre-paint or elsewhere?

    (This is called multiple times per layout and is very performance sensitive).

    Wangsong Jin

    Thanks for starting the pinpoints! If the overhead is non-trivial or worth the benefit, we should do that. Let's see the result first.

    Wangsong Jin

    The pinpoint is green https://pinpoint-dot-chromeperf.appspot.com/job/12a15589c90000. If we still have concerns about resize performance when offset-path is present on the page, I think there’s an opportunity to move this logic into pre-paint. I’ll post the PatchSet.

    Wangsong Jin

    Hi Ian, in the latest PatchSet 14, I moved all invalidation out of layout resize to pre-paint anyway. We detect CB resize in `PaintPropertyTreeBuilder::UpdateForSelf()`  by comparing `StitchedSize()` vs `PreviousSize()`. The  HasOffsetPathDescendant()  flag on PaintLayer still serves as a cheap guard to skip the descendant walk for boxes without offset-path children. Do you prefer this approach?

    Also cc @p...@chromium.org — would appreciate a quick glance at the overall approach to make sure we're on the right track.

    Wangsong Jin

    Hi Ian — I just noticed Philip is OOF until July 6. I think the layout-resize perf concern is now addressed (invalidation moved to pre-paint). Aside from that, do you feel good about the overall approach in general? If anything structural needs changing, I'm happy to address it before we go further. And feel free to let me know if I should cc another owner to keep things moving. Thank you!

    Open in Gerrit

    Related details

    Attention is currently required from:
    • Ian Kilpatrick
    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: Iba55090a47ac38c931b0d28ee90c94c0d0def2d1
    Gerrit-Change-Number: 7896208
    Gerrit-PatchSet: 15
    Gerrit-Owner: Wangsong Jin <wangs...@microsoft.com>
    Gerrit-Reviewer: Claire Chambers <clcha...@microsoft.com>
    Gerrit-Reviewer: Olga Gerchikov <gerc...@microsoft.com>
    Gerrit-Reviewer: Wangsong Jin <wangs...@microsoft.com>
    Gerrit-CC: Ian Kilpatrick <ikilp...@chromium.org>
    Gerrit-CC: Ian Kilpatrick <ikilp...@google.com>
    Gerrit-CC: Philip Rogers <p...@chromium.org>
    Gerrit-Attention: Ian Kilpatrick <ikilp...@chromium.org>
    Gerrit-Comment-Date: Thu, 25 Jun 2026 21:54:02 +0000
    satisfied_requirement
    unsatisfied_requirement
    open
    diffy

    chromeperf@appspot.gserviceaccount.com (Gerrit)

    unread,
    Jun 28, 2026, 7:37:08 AM (11 days ago) Jun 28
    to Wangsong Jin, Ian Kilpatrick, Philip Rogers, Ian Kilpatrick, Claire Chambers, Olga Gerchikov, Chromium LUCI CQ, android-bu...@system.gserviceaccount.com, chromium...@chromium.org, blink-rev...@chromium.org, blink-rev...@chromium.org, blink-revi...@chromium.org, blink-revie...@chromium.org, blink-...@chromium.org, jmedle...@chromium.org, kinuko...@chromium.org, zol...@webkit.org
    Attention needed from Ian Kilpatrick and Wangsong Jin

    Message from chrom...@appspot.gserviceaccount.com

    📍 Job linux-perf/blink_perf.layout complete.

    See results at: https://pinpoint-dot-chromeperf.appspot.com/job/12bb1a1dc90000

    Open in Gerrit

    Related details

    Attention is currently required from:
    • Ian Kilpatrick
    • Wangsong Jin
    Gerrit-Attention: Wangsong Jin <wangs...@microsoft.com>
    Gerrit-Comment-Date: Sun, 28 Jun 2026 11:36:55 +0000
    Gerrit-HasComments: No
    Gerrit-Has-Labels: No
    satisfied_requirement
    unsatisfied_requirement
    open
    diffy

    Wangsong Jin (Gerrit)

    unread,
    Jul 7, 2026, 5:39:51 PM (yesterday) Jul 7
    to Ian Kilpatrick, chrom...@appspot.gserviceaccount.com, Ian Kilpatrick, Philip Rogers, Claire Chambers, Olga Gerchikov, Chromium LUCI CQ, android-bu...@system.gserviceaccount.com, chromium...@chromium.org, blink-rev...@chromium.org, blink-rev...@chromium.org, blink-revi...@chromium.org, blink-revie...@chromium.org, blink-...@chromium.org, jmedle...@chromium.org, kinuko...@chromium.org, zol...@webkit.org
    Attention needed from Ian Kilpatrick and Ian Kilpatrick

    Wangsong Jin added 1 comment

    Patchset-level comments
    File-level comment, Patchset 15 (Latest):
    Wangsong Jin . resolved

    Hi Ian, would appreciate a quick look when you have a chance. Thanks!

    Open in Gerrit

    Related details

    Attention is currently required from:
    • Ian Kilpatrick
    • Ian Kilpatrick
    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: Iba55090a47ac38c931b0d28ee90c94c0d0def2d1
    Gerrit-Change-Number: 7896208
    Gerrit-PatchSet: 15
    Gerrit-Owner: Wangsong Jin <wangs...@microsoft.com>
    Gerrit-Reviewer: Claire Chambers <clcha...@microsoft.com>
    Gerrit-Reviewer: Ian Kilpatrick <ikilp...@google.com>
    Gerrit-Reviewer: Olga Gerchikov <gerc...@microsoft.com>
    Gerrit-Reviewer: Wangsong Jin <wangs...@microsoft.com>
    Gerrit-CC: Ian Kilpatrick <ikilp...@chromium.org>
    Gerrit-Attention: Ian Kilpatrick <ikilp...@google.com>
    Gerrit-Attention: Ian Kilpatrick <ikilp...@chromium.org>
    Gerrit-Comment-Date: Tue, 07 Jul 2026 21:39:36 +0000
    Gerrit-HasComments: Yes
    Gerrit-Has-Labels: No
    satisfied_requirement
    unsatisfied_requirement
    open
    diffy

    Ian Kilpatrick (Gerrit)

    unread,
    Jul 7, 2026, 6:45:45 PM (yesterday) Jul 7
    to Wangsong Jin, Philip Rogers, chrom...@appspot.gserviceaccount.com, Claire Chambers, Olga Gerchikov, Chromium LUCI CQ, android-bu...@system.gserviceaccount.com, chromium...@chromium.org, blink-rev...@chromium.org, blink-rev...@chromium.org, blink-revi...@chromium.org, blink-revie...@chromium.org, blink-...@chromium.org, jmedle...@chromium.org, kinuko...@chromium.org, zol...@webkit.org
    Attention needed from Philip Rogers and Wangsong Jin

    Ian Kilpatrick added 4 comments

    File third_party/blink/renderer/core/paint/paint_property_tree_builder.cc
    Line 4470, Patchset 15 (Latest): for (LayoutObject* descendant = object_.SlowFirstChild(); descendant;
    Ian Kilpatrick . unresolved

    is this really any descendant or just "child"?

    Line 4470, Patchset 15 (Latest): for (LayoutObject* descendant = object_.SlowFirstChild(); descendant;
    Ian Kilpatrick . unresolved

    box

    Line 4471, Patchset 15 (Latest): descendant = descendant->NextInPreOrder(&object_)) {
    Ian Kilpatrick . unresolved

    Why does this need NextInPreOrder?

    Line 4476, Patchset 15 (Latest): descendant->ContainingBlock() != box) {
    Ian Kilpatrick . unresolved

    What about a structure like:

    ```
    <div style="position: relative;">
    <div>
    <div style="position: absolute; offset-path: blah;"></div>
    </div>
    </div>
    ```
    Open in Gerrit

    Related details

    Attention is currently required from:
    • Philip Rogers
    • Wangsong Jin
    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: Iba55090a47ac38c931b0d28ee90c94c0d0def2d1
    Gerrit-Change-Number: 7896208
    Gerrit-PatchSet: 15
    Gerrit-Owner: Wangsong Jin <wangs...@microsoft.com>
    Gerrit-Reviewer: Claire Chambers <clcha...@microsoft.com>
    Gerrit-Reviewer: Ian Kilpatrick <ikilp...@chromium.org>
    Gerrit-Reviewer: Olga Gerchikov <gerc...@microsoft.com>
    Gerrit-Reviewer: Philip Rogers <p...@chromium.org>
    Gerrit-Reviewer: Wangsong Jin <wangs...@microsoft.com>
    Gerrit-Attention: Philip Rogers <p...@chromium.org>
    Gerrit-Attention: Wangsong Jin <wangs...@microsoft.com>
    Gerrit-Comment-Date: Tue, 07 Jul 2026 22:45:29 +0000
    Gerrit-HasComments: Yes
    Gerrit-Has-Labels: No
    satisfied_requirement
    unsatisfied_requirement
    open
    diffy

    Wangsong Jin (Gerrit)

    unread,
    Jul 7, 2026, 8:06:41 PM (yesterday) Jul 7
    to Philip Rogers, Ian Kilpatrick, chrom...@appspot.gserviceaccount.com, Claire Chambers, Olga Gerchikov, Chromium LUCI CQ, android-bu...@system.gserviceaccount.com, chromium...@chromium.org, blink-rev...@chromium.org, blink-rev...@chromium.org, blink-revi...@chromium.org, blink-revie...@chromium.org, blink-...@chromium.org, jmedle...@chromium.org, kinuko...@chromium.org, zol...@webkit.org
    Attention needed from Ian Kilpatrick and Philip Rogers

    Wangsong Jin added 8 comments

    Patchset-level comments
    Philip Rogers . resolved

    I think PaintLayer::UpdateTransform is also stale in this scenario.

    Is the spec clear on this behavior? Is offset-path the only transform property that depends on ancestor size like this, or are there others?

    Wangsong Jin

    Is the spec clear on this behavior?

    Per CSS Motion Path §2.1, the <coord-box> reference box is "from the element that establishes the containing block for this element," (https://drafts.csswg.org/motion-1/#offset-path-property) so a containing block resize should trigger recomputation.
    Does that address your spec question, or is there a specific aspect of the behavior defined in this change that you think the spec is unclear on?

    Wangsong Jin

    I think PaintLayer::UpdateTransform is also stale in this scenario.

    Good catch! I've added an explicit `UpdateTransform()` call to keep the cached matrix in sync, along with a unit test that confirms the test fails without it.

    Wangsong Jin

    Done

    File-level comment, Patchset 17 (Latest):
    Wangsong Jin . resolved

    Thanks for taking a look, Ian!

    File third_party/blink/renderer/core/layout/layout_box.cc
    Line 2352, Patchset 13: PaintLayer* layer = HasLayer() ? Layer() : EnclosingLayer();
    Ian Kilpatrick . resolved

    This still might be too slow - (i'll kick of some pinpoints). Can the invalidation be moved to pre-paint or elsewhere?

    (This is called multiple times per layout and is very performance sensitive).

    Wangsong Jin

    Thanks for starting the pinpoints! If the overhead is non-trivial or worth the benefit, we should do that. Let's see the result first.

    Wangsong Jin

    The pinpoint is green https://pinpoint-dot-chromeperf.appspot.com/job/12a15589c90000. If we still have concerns about resize performance when offset-path is present on the page, I think there’s an opportunity to move this logic into pre-paint. I’ll post the PatchSet.

    Wangsong Jin

    Hi Ian, in the latest PatchSet 14, I moved all invalidation out of layout resize to pre-paint anyway. We detect CB resize in `PaintPropertyTreeBuilder::UpdateForSelf()`  by comparing `StitchedSize()` vs `PreviousSize()`. The  HasOffsetPathDescendant()  flag on PaintLayer still serves as a cheap guard to skip the descendant walk for boxes without offset-path children. Do you prefer this approach?

    Also cc @p...@chromium.org — would appreciate a quick glance at the overall approach to make sure we're on the right track.

    Wangsong Jin

    Hi Ian — I just noticed Philip is OOF until July 6. I think the layout-resize perf concern is now addressed (invalidation moved to pre-paint). Aside from that, do you feel good about the overall approach in general? If anything structural needs changing, I'm happy to address it before we go further. And feel free to let me know if I should cc another owner to keep things moving. Thank you!

    Wangsong Jin

    Done

    Line 2378, Patchset 9:void LayoutBox::InvalidateDescendantOffsetPaths() {
    Claire Chambers . resolved

    Are you sure that a `LayoutInline` is never used as a container? I did some brief testing, and was able to get the apparent travel paths of an offset-path to change by adjusting the font size of the box.

    Wangsong Jin

    `ContainingBlock()` returns `LayoutBlock*` , and `InclusiveContainingBlock()`  explicitly skips LayoutInline and walks up to the nearest `LayoutBlock`. So a `LayoutInline` shouldn't act as the containing block for `offset-path` resolution. I think the `font-size` change you saw affecting the travel path was likely because the inline's content reflow caused its enclosing `LayoutBlock` to resize.

    Wangsong Jin

    Done

    File third_party/blink/renderer/core/paint/paint_property_tree_builder.cc
    Line 4470, Patchset 15: for (LayoutObject* descendant = object_.SlowFirstChild(); descendant;
    Ian Kilpatrick . resolved

    is this really any descendant or just "child"?

    Wangsong Jin

    We want to walk all descendants here — the offset-path element might not be a direct child of its CB (e.g., there could be a non-positioned intermediate div in between, like in your example). Traversing only direct children would miss those cases.

    Line 4470, Patchset 15: for (LayoutObject* descendant = object_.SlowFirstChild(); descendant;
    Ian Kilpatrick . resolved

    box

    Wangsong Jin

    Marked as resolved.

    Line 4471, Patchset 15: descendant = descendant->NextInPreOrder(&object_)) {
    Ian Kilpatrick . resolved

    Why does this need NextInPreOrder?

    Wangsong Jin

    Similar reason as above. `NextInPreOrder` walks the full subtree to find any non-direct offset-path descendant that needs to be updated.

    Line 4476, Patchset 15: descendant->ContainingBlock() != box) {
    Ian Kilpatrick . resolved

    What about a structure like:

    ```
    <div style="position: relative;">
    <div>
    <div style="position: absolute; offset-path: blah;"></div>
    </div>
    </div>
    ```
    Wangsong Jin

    Yes, this is the nested case we handle. We've added a WPT test `offset-path-containing-block-resize-nested-absolute.html` which covers this structure.

    Open in Gerrit

    Related details

    Attention is currently required from:
    • Ian Kilpatrick
    • Philip Rogers
    Submit Requirements:
      • requirement satisfiedCode-Coverage
      • requirement is not satisfiedCode-Owners
      • requirement is not satisfiedCode-Review
      • requirement is not satisfiedReview-Enforcement
      Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. DiffyGerrit
      Gerrit-MessageType: comment
      Gerrit-Project: chromium/src
      Gerrit-Branch: main
      Gerrit-Change-Id: Iba55090a47ac38c931b0d28ee90c94c0d0def2d1
      Gerrit-Change-Number: 7896208
      Gerrit-PatchSet: 17
      Gerrit-Owner: Wangsong Jin <wangs...@microsoft.com>
      Gerrit-Reviewer: Claire Chambers <clcha...@microsoft.com>
      Gerrit-Reviewer: Ian Kilpatrick <ikilp...@chromium.org>
      Gerrit-Reviewer: Olga Gerchikov <gerc...@microsoft.com>
      Gerrit-Reviewer: Philip Rogers <p...@chromium.org>
      Gerrit-Reviewer: Wangsong Jin <wangs...@microsoft.com>
      Gerrit-Attention: Philip Rogers <p...@chromium.org>
      Gerrit-Attention: Ian Kilpatrick <ikilp...@chromium.org>
      Gerrit-Comment-Date: Wed, 08 Jul 2026 00:06:28 +0000
      Gerrit-HasComments: Yes
      Gerrit-Has-Labels: No
      Comment-In-Reply-To: Philip Rogers <p...@chromium.org>
      Comment-In-Reply-To: Ian Kilpatrick <ikilp...@chromium.org>
      Comment-In-Reply-To: Wangsong Jin <wangs...@microsoft.com>
      Comment-In-Reply-To: Claire Chambers <clcha...@microsoft.com>
      satisfied_requirement
      unsatisfied_requirement
      open
      diffy

      chromeperf@appspot.gserviceaccount.com (Gerrit)

      unread,
      3:14 PM (5 hours ago) 3:14 PM
      to Wangsong Jin, Philip Rogers, Ian Kilpatrick, Claire Chambers, Olga Gerchikov, Chromium LUCI CQ, android-bu...@system.gserviceaccount.com, chromium...@chromium.org, blink-rev...@chromium.org, blink-rev...@chromium.org, blink-revi...@chromium.org, blink-revie...@chromium.org, blink-...@chromium.org, jmedle...@chromium.org, kinuko...@chromium.org, zol...@webkit.org
      Attention needed from Ian Kilpatrick, Philip Rogers and Wangsong Jin

      Message from chrom...@appspot.gserviceaccount.com

      📍 Job linux-perf/blink_perf.layout complete.

      See results at: https://pinpoint-dot-chromeperf.appspot.com/job/1645a55fc90000

      Open in Gerrit

      Related details

      Attention is currently required from:
      • Ian Kilpatrick
      • Philip Rogers
      • Wangsong Jin
      Gerrit-Attention: Wangsong Jin <wangs...@microsoft.com>
      Gerrit-Comment-Date: Wed, 08 Jul 2026 19:14:30 +0000
      Gerrit-HasComments: No
      Gerrit-Has-Labels: No
      satisfied_requirement
      unsatisfied_requirement
      open
      diffy

      chromeperf@appspot.gserviceaccount.com (Gerrit)

      unread,
      3:53 PM (5 hours ago) 3:53 PM
      to Wangsong Jin, Philip Rogers, Ian Kilpatrick, Claire Chambers, Olga Gerchikov, Chromium LUCI CQ, android-bu...@system.gserviceaccount.com, chromium...@chromium.org, blink-rev...@chromium.org, blink-rev...@chromium.org, blink-revi...@chromium.org, blink-revie...@chromium.org, blink-...@chromium.org, jmedle...@chromium.org, kinuko...@chromium.org, zol...@webkit.org
      Attention needed from Ian Kilpatrick, Philip Rogers and Wangsong Jin

      Message from chrom...@appspot.gserviceaccount.com

      😿 Job linux-perf/blink_perf.layout failed.

      See results at: https://pinpoint-dot-chromeperf.appspot.com/job/1351ee90290000

      Gerrit-Comment-Date: Wed, 08 Jul 2026 19:52:58 +0000
      Gerrit-HasComments: No
      Gerrit-Has-Labels: No
      satisfied_requirement
      unsatisfied_requirement
      open
      diffy

      Ian Kilpatrick (Gerrit)

      unread,
      4:09 PM (5 hours ago) 4:09 PM
      to Wangsong Jin, Philip Rogers, chrom...@appspot.gserviceaccount.com, Claire Chambers, Olga Gerchikov, Chromium LUCI CQ, android-bu...@system.gserviceaccount.com, chromium...@chromium.org, blink-rev...@chromium.org, blink-rev...@chromium.org, blink-revi...@chromium.org, blink-revie...@chromium.org, blink-...@chromium.org, jmedle...@chromium.org, kinuko...@chromium.org, zol...@webkit.org
      Attention needed from Philip Rogers and Wangsong Jin

      Ian Kilpatrick added 1 comment

      File third_party/blink/renderer/core/paint/paint_property_tree_builder.cc
      Line 4471, Patchset 15: descendant = descendant->NextInPreOrder(&object_)) {
      Ian Kilpatrick . unresolved

      Why does this need NextInPreOrder?

      Wangsong Jin

      Similar reason as above. `NextInPreOrder` walks the full subtree to find any non-direct offset-path descendant that needs to be updated.

      Ian Kilpatrick

      Ok - yeah I don't think we should land this approach. These full tree traversals are very much a performance footgun for developers. (e.g. it looks like if we have an offset-path on every element on the page this goes to being quadratic or worse performance wise). We are basically trading one correctness but for a performance bug.

      Stepping back a bit - ideally we should be reworking how transforms are computed.

      E.g. The issue is that ComputedStyle::ApplyTransform is taking a LayoutBox, and then walking up the containing-block chain to grab (potentially) stale data, then we are sporadically recomputing it elsewhere.

      Instead we should change ComputedStyle::ApplyTransform by removing the LayoutBox argument, and replacing it with (at least) a std::optional<PhysicalRect> (its position in the container in additional to whatever other input data we need). We can omit this argument when we are passing in kExcludeMotionPath for example.

      Then there are two different callpaths.

      In PaintLayer::UpdateTransform we should store the previous cached value of the PhysicalRect/etc next to the transform so we can update it as-is.

      We introduce a new PaintLayer::UpdateTransform(std::optional<InputForMotionPathWhateverThatIs>);

      This will compare the new input to the old (stored beside the transform) - then update if needed.

      We add this call to perhaps - GetTransformForChildFragment for example. But I'll need to think on this a little.

      Additionally the UpdateTransform call within LocationChanged should be removed.

      I know this is a lot - but this will prevent future issues.

      Open in Gerrit

      Related details

      Attention is currently required from:
      • Philip Rogers
      • Wangsong Jin
      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: Iba55090a47ac38c931b0d28ee90c94c0d0def2d1
        Gerrit-Change-Number: 7896208
        Gerrit-PatchSet: 17
        Gerrit-Owner: Wangsong Jin <wangs...@microsoft.com>
        Gerrit-Reviewer: Claire Chambers <clcha...@microsoft.com>
        Gerrit-Reviewer: Ian Kilpatrick <ikilp...@chromium.org>
        Gerrit-Reviewer: Olga Gerchikov <gerc...@microsoft.com>
        Gerrit-Reviewer: Philip Rogers <p...@chromium.org>
        Gerrit-Reviewer: Wangsong Jin <wangs...@microsoft.com>
        Gerrit-Attention: Philip Rogers <p...@chromium.org>
        Gerrit-Attention: Wangsong Jin <wangs...@microsoft.com>
        Gerrit-Comment-Date: Wed, 08 Jul 2026 20:08:45 +0000
        Gerrit-HasComments: Yes
        Gerrit-Has-Labels: No
        satisfied_requirement
        unsatisfied_requirement
        open
        diffy

        Wangsong Jin (Gerrit)

        unread,
        7:48 PM (1 hour ago) 7:48 PM
        to Philip Rogers, Ian Kilpatrick, chrom...@appspot.gserviceaccount.com, Claire Chambers, Olga Gerchikov, Chromium LUCI CQ, android-bu...@system.gserviceaccount.com, chromium...@chromium.org, blink-rev...@chromium.org, blink-rev...@chromium.org, blink-revi...@chromium.org, blink-revie...@chromium.org, blink-...@chromium.org, jmedle...@chromium.org, kinuko...@chromium.org, zol...@webkit.org
        Attention needed from Ian Kilpatrick and Philip Rogers

        Wangsong Jin added 1 comment

        File third_party/blink/renderer/core/paint/paint_property_tree_builder.cc
        Line 4471, Patchset 15: descendant = descendant->NextInPreOrder(&object_)) {
        Ian Kilpatrick . unresolved

        Why does this need NextInPreOrder?

        Wangsong Jin

        Similar reason as above. `NextInPreOrder` walks the full subtree to find any non-direct offset-path descendant that needs to be updated.

        Ian Kilpatrick

        Ok - yeah I don't think we should land this approach. These full tree traversals are very much a performance footgun for developers. (e.g. it looks like if we have an offset-path on every element on the page this goes to being quadratic or worse performance wise). We are basically trading one correctness but for a performance bug.

        Stepping back a bit - ideally we should be reworking how transforms are computed.

        E.g. The issue is that ComputedStyle::ApplyTransform is taking a LayoutBox, and then walking up the containing-block chain to grab (potentially) stale data, then we are sporadically recomputing it elsewhere.

        Instead we should change ComputedStyle::ApplyTransform by removing the LayoutBox argument, and replacing it with (at least) a std::optional<PhysicalRect> (its position in the container in additional to whatever other input data we need). We can omit this argument when we are passing in kExcludeMotionPath for example.

        Then there are two different callpaths.

        In PaintLayer::UpdateTransform we should store the previous cached value of the PhysicalRect/etc next to the transform so we can update it as-is.

        We introduce a new PaintLayer::UpdateTransform(std::optional<InputForMotionPathWhateverThatIs>);

        This will compare the new input to the old (stored beside the transform) - then update if needed.

        We add this call to perhaps - GetTransformForChildFragment for example. But I'll need to think on this a little.

        Additionally the UpdateTransform call within LocationChanged should be removed.

        I know this is a lot - but this will prevent future issues.

        Wangsong Jin

        Thanks for the detailed proposal. When I was working through the nested case, I had a sense that something wasn't quite right with the data flow, but I couldn't put my finger on what the cause was. Your proposed direction of having each element detect when its own motion path input has changed makes sense to me, which avoids the tree traversal cost.

        I took a closer look and the refactor has a pretty wide surface area. To be honest, I don't have much experience with the transform computation pipeline, so I'm probably not the best person to drive this. I worry it'd end up taking more of your review time than if someone with more context took it on. But if you're okay with that trade-off, I'm very happy to pick this up incrementally with your input along the way, just a heads up I have other priorities so it might move slowly. Either way works for me, let me know how you'd like to proceed.

        Also, if the refactor won't be in place for a while, should we land a scoped fix that only handles direct children? That would cover the most common cases without the deep tree traversal concern.

        Open in Gerrit

        Related details

        Attention is currently required from:
        • Ian Kilpatrick
        • Philip Rogers
        Gerrit-Attention: Ian Kilpatrick <ikilp...@chromium.org>
        Gerrit-Comment-Date: Wed, 08 Jul 2026 23:47:34 +0000
        satisfied_requirement
        unsatisfied_requirement
        open
        diffy
        Reply all
        Reply to author
        Forward
        0 new messages