[animation-trigger] Don't update attachments if layout is needed [chromium/src : main]

0 views
Skip to first unread message

David Awogbemila (Gerrit)

unread,
Dec 17, 2025, 11:22:13 AM (3 days ago) Dec 17
to Anders Hartvoll Ruud, Chromium LUCI CQ, Menard, Alexis, David Bokan, chromium...@chromium.org, Olga Gerchikov, apavlo...@chromium.org, blink-revie...@chromium.org, blink-re...@chromium.org, blink-revi...@chromium.org, blink-rev...@chromium.org, blink-revie...@chromium.org, blink-...@chromium.org
Attention needed from Anders Hartvoll Ruud

David Awogbemila added 1 comment

Patchset-level comments
File-level comment, Patchset 1 (Latest):
David Awogbemila . unresolved

Hey Anders, ptal. I've tried to incorporate `PostLayoutSnapShotClient` into `TimelineTrigger` so we now get that second chance to update an element's style during the same lifecycle update where the attachment is done.

Seems to work fine when testing manually but when writing tests we seem to sometimes have style updates without lifecycle updates (unless I'm judging the situation wrong) so we sometimes need to force the lifecycle update before checking for the style change side effect in the test.

Open in Gerrit

Related details

Attention is currently required from:
  • Anders Hartvoll Ruud
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: I3c94efb90e7a9338afe2173f0aa57e81016ed8d2
Gerrit-Change-Number: 7265794
Gerrit-PatchSet: 1
Gerrit-Owner: David Awogbemila <awogb...@chromium.org>
Gerrit-Reviewer: Anders Hartvoll Ruud <and...@chromium.org>
Gerrit-Reviewer: David Awogbemila <awogb...@chromium.org>
Gerrit-CC: David Bokan <bo...@chromium.org>
Gerrit-CC: Menard, Alexis <alexis...@intel.com>
Gerrit-CC: Olga Gerchikov <gerc...@microsoft.com>
Gerrit-Attention: Anders Hartvoll Ruud <and...@chromium.org>
Gerrit-Comment-Date: Wed, 17 Dec 2025 16:22:07 +0000
Gerrit-HasComments: Yes
Gerrit-Has-Labels: No
satisfied_requirement
unsatisfied_requirement
open
diffy

Anders Hartvoll Ruud (Gerrit)

unread,
Dec 17, 2025, 1:55:37 PM (3 days ago) Dec 17
to David Awogbemila, Chromium LUCI CQ, Menard, Alexis, David Bokan, chromium...@chromium.org, Olga Gerchikov, apavlo...@chromium.org, blink-revie...@chromium.org, blink-re...@chromium.org, blink-revi...@chromium.org, blink-rev...@chromium.org, blink-revie...@chromium.org, blink-...@chromium.org
Attention needed from David Awogbemila

Anders Hartvoll Ruud added 3 comments

File third_party/blink/renderer/core/animation/timeline_trigger.cc
Line 131, Patchset 1: : PostLayoutSnapshotClient(timeline ? timeline->GetDocument()->GetFrame()
Anders Hartvoll Ruud . unresolved

I was wondering: Timelines seem to be aware of their associated triggers (`AnimationTimeline::triggers_`). It could maybe be an option to let `ScrollSnapshotTimelines` update the states of their triggers as well?

Line 330, Patchset 1: DynamicTo<ScrollSnapshotTimeline>(timeline_.Get())->UpdateSnapshot();
Anders Hartvoll Ruud . unresolved

This would cause the `ScrollSnapshotTimeline` to be updated _twice_, in a random order (`ScrollSnapshotTimeline` are also `PostLayoutSnapshotClient`s). We need to guarantee that a second update within the same snapshot round has no effect, somehow.

Line 332, Patchset 1: return Update();
Anders Hartvoll Ruud . unresolved

1. If we update the state here (and we should), we should not _also_ update the state in `UpdateAnimationTiming`.

2. Doesn't that mean we would also _trip_ the trigger here? I don't have the full picture, but deciding to start an animation may be weird as a "final action" after layout is done already? With the caveat that I don't have the full picture of how everything works, it seems more natural to do this part in `UpdateAnimationTiming` as we do currently. So basically, I think we should split update-state and perform-action into two things that can happen at two different times.

2b. By default, I think we should mark the trigger-attached animations for needs-animation-recalc, and then have `CalculateAnimationUpdate` (or similar) queue the triggers actions on the `CSSAnimationUpdate`, but that's another story.

Open in Gerrit

Related details

Attention is currently required from:
  • David Awogbemila
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: I3c94efb90e7a9338afe2173f0aa57e81016ed8d2
Gerrit-Change-Number: 7265794
Gerrit-PatchSet: 2
Gerrit-Owner: David Awogbemila <awogb...@chromium.org>
Gerrit-Reviewer: Anders Hartvoll Ruud <and...@chromium.org>
Gerrit-Reviewer: David Awogbemila <awogb...@chromium.org>
Gerrit-CC: David Bokan <bo...@chromium.org>
Gerrit-CC: Menard, Alexis <alexis...@intel.com>
Gerrit-CC: Olga Gerchikov <gerc...@microsoft.com>
Gerrit-Attention: David Awogbemila <awogb...@chromium.org>
Gerrit-Comment-Date: Wed, 17 Dec 2025 18:55:19 +0000
Gerrit-HasComments: Yes
Gerrit-Has-Labels: No
satisfied_requirement
unsatisfied_requirement
open
diffy

David Awogbemila (Gerrit)

unread,
Dec 18, 2025, 9:53:36 PM (2 days ago) Dec 18
to Anders Hartvoll Ruud, Chromium LUCI CQ, Menard, Alexis, David Bokan, chromium...@chromium.org, Olga Gerchikov, apavlo...@chromium.org, blink-revie...@chromium.org, blink-re...@chromium.org, blink-revi...@chromium.org, blink-rev...@chromium.org, blink-revie...@chromium.org, blink-...@chromium.org
Attention needed from Anders Hartvoll Ruud

David Awogbemila added 3 comments

File third_party/blink/renderer/core/animation/timeline_trigger.cc
Line 131, Patchset 1: : PostLayoutSnapshotClient(timeline ? timeline->GetDocument()->GetFrame()
Anders Hartvoll Ruud . resolved

I was wondering: Timelines seem to be aware of their associated triggers (`AnimationTimeline::triggers_`). It could maybe be an option to let `ScrollSnapshotTimelines` update the states of their triggers as well?

David Awogbemila

Done

Line 330, Patchset 1: DynamicTo<ScrollSnapshotTimeline>(timeline_.Get())->UpdateSnapshot();
Anders Hartvoll Ruud . resolved

This would cause the `ScrollSnapshotTimeline` to be updated _twice_, in a random order (`ScrollSnapshotTimeline` are also `PostLayoutSnapshotClient`s). We need to guarantee that a second update within the same snapshot round has no effect, somehow.

David Awogbemila

Acknowledged

Line 332, Patchset 1: return Update();
Anders Hartvoll Ruud . unresolved

1. If we update the state here (and we should), we should not _also_ update the state in `UpdateAnimationTiming`.

2. Doesn't that mean we would also _trip_ the trigger here? I don't have the full picture, but deciding to start an animation may be weird as a "final action" after layout is done already? With the caveat that I don't have the full picture of how everything works, it seems more natural to do this part in `UpdateAnimationTiming` as we do currently. So basically, I think we should split update-state and perform-action into two things that can happen at two different times.

2b. By default, I think we should mark the trigger-attached animations for needs-animation-recalc, and then have `CalculateAnimationUpdate` (or similar) queue the triggers actions on the `CSSAnimationUpdate`, but that's another story.

David Awogbemila

Okay, I've split the logic up into `UpdateState` and `UpdateAnimations`.

Open in Gerrit

Related details

Attention is currently required from:
  • Anders Hartvoll Ruud
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: I3c94efb90e7a9338afe2173f0aa57e81016ed8d2
Gerrit-Change-Number: 7265794
Gerrit-PatchSet: 5
Gerrit-Owner: David Awogbemila <awogb...@chromium.org>
Gerrit-Reviewer: Anders Hartvoll Ruud <and...@chromium.org>
Gerrit-Reviewer: David Awogbemila <awogb...@chromium.org>
Gerrit-CC: David Bokan <bo...@chromium.org>
Gerrit-CC: Menard, Alexis <alexis...@intel.com>
Gerrit-CC: Olga Gerchikov <gerc...@microsoft.com>
Gerrit-Attention: Anders Hartvoll Ruud <and...@chromium.org>
Gerrit-Comment-Date: Fri, 19 Dec 2025 02:53:25 +0000
Gerrit-HasComments: Yes
Gerrit-Has-Labels: No
Comment-In-Reply-To: Anders Hartvoll Ruud <and...@chromium.org>
satisfied_requirement
unsatisfied_requirement
open
diffy

Anders Hartvoll Ruud (Gerrit)

unread,
Dec 19, 2025, 7:11:29 AM (22 hours ago) Dec 19
to David Awogbemila, Chromium LUCI CQ, Menard, Alexis, David Bokan, chromium...@chromium.org, Olga Gerchikov, apavlo...@chromium.org, blink-revie...@chromium.org, blink-re...@chromium.org, blink-revi...@chromium.org, blink-rev...@chromium.org, blink-revie...@chromium.org, blink-...@chromium.org
Attention needed from David Awogbemila

Anders Hartvoll Ruud voted and added 6 comments

Votes added by Anders Hartvoll Ruud

Code-Review+1

6 comments

Patchset-level comments
File-level comment, Patchset 1:
David Awogbemila . resolved

Hey Anders, ptal. I've tried to incorporate `PostLayoutSnapShotClient` into `TimelineTrigger` so we now get that second chance to update an element's style during the same lifecycle update where the attachment is done.

Seems to work fine when testing manually but when writing tests we seem to sometimes have style updates without lifecycle updates (unless I'm judging the situation wrong) so we sometimes need to force the lifecycle update before checking for the style change side effect in the test.

Anders Hartvoll Ruud

Seems to work fine when testing manually but when writing tests we seem to sometimes have style updates without lifecycle updates (unless I'm judging the situation wrong) so we sometimes need to force the lifecycle update before checking for the style change side effect in the test.

Yeah, I don't think we can get gCS to work consistently in all cases until we switch to the approach we discussed (off Gerrit) yesterday.

Anders Hartvoll Ruud . resolved

I don't fully get why this fixes the problem, but this looks like a step in the right direction anyway considering recent discussions.

File third_party/blink/renderer/core/animation/timeline_trigger.cc
Line 327, Patchset 5 (Latest): std::optional<State> new_state = ComputeState();
if (!new_state) {
Anders Hartvoll Ruud . resolved

Not changed in this CL, but I find it weird that `ComputeState()` returning `nullopt` means "no state change" even when we're holding a non-`nullopt` state.

Line 332, Patchset 1: return Update();
Anders Hartvoll Ruud . resolved

1. If we update the state here (and we should), we should not _also_ update the state in `UpdateAnimationTiming`.

2. Doesn't that mean we would also _trip_ the trigger here? I don't have the full picture, but deciding to start an animation may be weird as a "final action" after layout is done already? With the caveat that I don't have the full picture of how everything works, it seems more natural to do this part in `UpdateAnimationTiming` as we do currently. So basically, I think we should split update-state and perform-action into two things that can happen at two different times.

2b. By default, I think we should mark the trigger-attached animations for needs-animation-recalc, and then have `CalculateAnimationUpdate` (or similar) queue the triggers actions on the `CSSAnimationUpdate`, but that's another story.

David Awogbemila

Okay, I've split the logic up into `UpdateState` and `UpdateAnimations`.

Anders Hartvoll Ruud

Acknowledged

File third_party/blink/renderer/core/css/post_style_update_scope.cc
Line 88, Patchset 5 (Latest): !document_.View()->NeedsLayout()) {
Anders Hartvoll Ruud . unresolved

You should probably document why we have this check.

File third_party/blink/renderer/core/frame/local_frame_view.cc
Anders Hartvoll Ruud . unresolved

nit: Avoid touching this file?

Open in Gerrit

Related details

Attention is currently required from:
  • David Awogbemila
Submit Requirements:
  • requirement satisfiedCode-Coverage
  • requirement satisfiedCode-Owners
  • requirement 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: I3c94efb90e7a9338afe2173f0aa57e81016ed8d2
Gerrit-Change-Number: 7265794
Gerrit-PatchSet: 5
Gerrit-Owner: David Awogbemila <awogb...@chromium.org>
Gerrit-Reviewer: Anders Hartvoll Ruud <and...@chromium.org>
Gerrit-Reviewer: David Awogbemila <awogb...@chromium.org>
Gerrit-CC: David Bokan <bo...@chromium.org>
Gerrit-CC: Menard, Alexis <alexis...@intel.com>
Gerrit-CC: Olga Gerchikov <gerc...@microsoft.com>
Gerrit-Attention: David Awogbemila <awogb...@chromium.org>
Gerrit-Comment-Date: Fri, 19 Dec 2025 12:11:14 +0000
Gerrit-HasComments: Yes
Gerrit-Has-Labels: Yes
Comment-In-Reply-To: David Awogbemila <awogb...@chromium.org>
satisfied_requirement
unsatisfied_requirement
open
diffy

David Awogbemila (Gerrit)

unread,
Dec 19, 2025, 10:41:46 AM (18 hours ago) Dec 19
to Anders Hartvoll Ruud, Chromium LUCI CQ, Menard, Alexis, David Bokan, chromium...@chromium.org, Olga Gerchikov, apavlo...@chromium.org, blink-revie...@chromium.org, blink-re...@chromium.org, blink-revi...@chromium.org, blink-rev...@chromium.org, blink-revie...@chromium.org, blink-...@chromium.org
Attention needed from Anders Hartvoll Ruud

David Awogbemila added 2 comments

File third_party/blink/renderer/core/css/post_style_update_scope.cc
Line 88, Patchset 5: !document_.View()->NeedsLayout()) {
Anders Hartvoll Ruud . resolved

You should probably document why we have this check.

David Awogbemila

Done

File third_party/blink/renderer/core/frame/local_frame_view.cc
Anders Hartvoll Ruud . resolved

nit: Avoid touching this file?

David Awogbemila

Done

Open in Gerrit

Related details

Attention is currently required from:
  • Anders Hartvoll Ruud
Submit Requirements:
    • requirement satisfiedCode-Coverage
    • requirement 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: I3c94efb90e7a9338afe2173f0aa57e81016ed8d2
    Gerrit-Change-Number: 7265794
    Gerrit-PatchSet: 6
    Gerrit-Owner: David Awogbemila <awogb...@chromium.org>
    Gerrit-Reviewer: Anders Hartvoll Ruud <and...@chromium.org>
    Gerrit-Reviewer: David Awogbemila <awogb...@chromium.org>
    Gerrit-CC: David Bokan <bo...@chromium.org>
    Gerrit-CC: Menard, Alexis <alexis...@intel.com>
    Gerrit-CC: Olga Gerchikov <gerc...@microsoft.com>
    Gerrit-Attention: Anders Hartvoll Ruud <and...@chromium.org>
    Gerrit-Comment-Date: Fri, 19 Dec 2025 15:41:39 +0000
    Gerrit-HasComments: Yes
    Gerrit-Has-Labels: No
    satisfied_requirement
    unsatisfied_requirement
    open
    diffy
    Reply all
    Reply to author
    Forward
    0 new messages