From 2d189fef7197c63265d8c7fec4f0453f83b862ab Mon Sep 17 00:00:00 2001 From: Rune Lillesveen Date: Tue, 16 Sep 2025 23:18:55 -0700 Subject: [PATCH] Make SVG scroll-animation tests not rely on dirty-tree snapshot An HTML PR[1] is attempting to move snapshotting of post-layout state to where the layout tree is actually clean. The test changes here makes them valid both when timelines are updated before the rendering update, and when they are only updated post-layout. [1] https://github.com/whatwg/html/pull/11613 Bug: 384523570 Change-Id: I3332e29c26171815c50fe2a0f16be56fd47276be Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/6950754 Reviewed-by: Kevin Ellis Commit-Queue: Rune Lillesveen Cr-Commit-Position: refs/heads/main@{#1516452} --- .../view-timelines/svg-graphics-element-001.html | 7 ++++--- .../view-timelines/svg-graphics-element-002.html | 7 ++++--- .../view-timelines/svg-graphics-element-003.html | 7 ++++--- 3 files changed, 12 insertions(+), 9 deletions(-) diff --git a/scroll-animations/view-timelines/svg-graphics-element-001.html b/scroll-animations/view-timelines/svg-graphics-element-001.html index 9b100a0b6420a3..b2a4a9acc064dd 100644 --- a/scroll-animations/view-timelines/svg-graphics-element-001.html +++ b/scroll-animations/view-timelines/svg-graphics-element-001.html @@ -36,9 +36,10 @@ const anim = target.getAnimations()[0]; await anim.ready; assert_equals(getComputedStyle(target).stroke, 'rgb(0, 0, 254)'); - scroller.scrollTop = - 0.5*(scroller.scrollHeight - scroller.clientHeight); - await waitForNextFrame(); + await runAndWaitForFrameUpdate(() => { + scroller.scrollTop = + 0.5*(scroller.scrollHeight - scroller.clientHeight); + }); assert_equals(getComputedStyle(target).stroke, 'rgb(0, 64, 127)'); }, 'View timeline attached to SVG graphics element'); diff --git a/scroll-animations/view-timelines/svg-graphics-element-002.html b/scroll-animations/view-timelines/svg-graphics-element-002.html index e173a649efc01b..b9cabe2838d888 100644 --- a/scroll-animations/view-timelines/svg-graphics-element-002.html +++ b/scroll-animations/view-timelines/svg-graphics-element-002.html @@ -38,9 +38,10 @@ const anim = target.getAnimations()[0]; await anim.ready; assert_equals(getComputedStyle(target).stroke, 'rgb(0, 0, 254)'); - scroller.scrollTop = - 0.5*(scroller.scrollHeight - scroller.clientHeight); - await waitForNextFrame(); + await runAndWaitForFrameUpdate(() => { + scroller.scrollTop = + 0.5*(scroller.scrollHeight - scroller.clientHeight); + }); assert_equals(getComputedStyle(target).stroke, 'rgb(0, 64, 127)'); }, 'View timeline attached to SVG graphics element'); diff --git a/scroll-animations/view-timelines/svg-graphics-element-003.html b/scroll-animations/view-timelines/svg-graphics-element-003.html index 48e238c8eddc34..9b70ba48a20d2d 100644 --- a/scroll-animations/view-timelines/svg-graphics-element-003.html +++ b/scroll-animations/view-timelines/svg-graphics-element-003.html @@ -39,9 +39,10 @@ const anim = target.getAnimations()[0]; await anim.ready; assert_equals(getComputedStyle(target).color, 'rgb(0, 0, 254)'); - scroller.scrollTop = - 0.5*(scroller.scrollHeight - scroller.clientHeight); - await waitForNextFrame(); + await runAndWaitForFrameUpdate(() => { + scroller.scrollTop = + 0.5*(scroller.scrollHeight - scroller.clientHeight); + }); assert_equals(getComputedStyle(target).color, 'rgb(0, 64, 127)'); }, 'View timeline attached to SVG graphics element');