Skip to content

Commit

Permalink
SDA: Update start time if layout change detected during snapshot update.
Browse files Browse the repository at this point in the history
This addresses the problem where a vertical resize does not trigger
style and layout.  With this change we catch the layout inconsistency
during the snapshot update and recalculate a new start time.



(cherry picked from commit ecd07ef)

Bug: 1447321
Change-Id: I8985f66233ff96f1b359c9a0f6aeee3525082111
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/4566235
Reviewed-by: Robert Flack <flackr@chromium.org>
Commit-Queue: Kevin Ellis <kevers@chromium.org>
Cr-Original-Commit-Position: refs/heads/main@{#1149163}
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/4573505
Reviewed-by: Eugene Girard <girard@chromium.org>
Cr-Commit-Position: refs/branch-heads/5790@{#143}
Cr-Branched-From: 1d71a33-refs/heads/main@{#1148114}
  • Loading branch information
kevers-google authored and Chromium LUCI CQ committed May 30, 2023
1 parent cab5874 commit c7ad670
Showing 1 changed file with 6 additions and 5 deletions.
Expand Up @@ -158,12 +158,14 @@ void ScrollSnapshotTimeline::ScheduleNextService() {

void ScrollSnapshotTimeline::UpdateSnapshot() {
auto state = ComputeTimelineState();
bool invalidate_timing =
!state.HasConsistentLayout(timeline_state_snapshotted_);
bool layout_changed = !state.HasConsistentLayout(timeline_state_snapshotted_);
timeline_state_snapshotted_ = state;
if (invalidate_timing) {

if (layout_changed) {
// Force recalculation of an auto-aligned start time, and invalidate
// normalized timing.
for (Animation* animation : GetAnimations()) {
animation->InvalidateNormalizedTiming();
animation->OnValidateSnapshot(layout_changed);
}
}
ResolveTimelineOffsets();
Expand Down Expand Up @@ -192,7 +194,6 @@ bool ScrollSnapshotTimeline::ValidateSnapshot() {
bool is_valid = timeline_state_snapshotted_ == new_state;
bool state_changed =
!timeline_state_snapshotted_.HasConsistentLayout(new_state);

// Note that `timeline_state_snapshotted_` must be updated before
// ResolveTimelineOffsets is called.
timeline_state_snapshotted_ = new_state;
Expand Down

0 comments on commit c7ad670

Please sign in to comment.