Skip to content

wpt: Wait more than a single frame for a resize event - #48939

Merged
mrobinson merged 1 commit into
servo:mainfrom
mrobinson:wpt-fix-resize-event-order
Oct 16, 2026
Merged

mrobinson merged 1 commit into
servo:mainfrom
mrobinson:wpt-fix-resize-event-order

Conversation

@mrobinson

Copy link
Copy Markdown
Member

Not all browsers can accomplish a client resize within a single
animation frame. In Servo this must first cycle through the embedder
which might involve event loop iterations. Furthermore, the
specification doesn't say this should happen either.

Testing: This change gets a WPT subtest passing.
Fixes: #41981.

@servo-wpt-sync

Copy link
Copy Markdown
Collaborator

🤖 Opened new upstream WPT pull request (web-platform-tests/wpt#63732) with upstreamable changes.

@yezhizhen yezhizhen left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nit:
We should drop async function oneRaf in the file now.

@servo-highfive servo-highfive added S-needs-code-changes Changes have not yet been made that were requested by a reviewer. and removed S-awaiting-review There is new code that needs to be reviewed. labels Oct 16, 2026
Comment on lines 22 to 26

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh, nice catch.


assert_equals(resize_events.toString(), '', 'PRECONDITION');
const oneResizeEvent = new Promise((resolve) => {
win.visualViewport.addEventListener("resize", resolve, { once: true });

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
win.visualViewport.addEventListener("resize", resolve, { once: true });
win.visualViewport.addEventListener('resize', resolve, { once: true });

Another super nit, since we always single quote in this file.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I've addressed this.

Not all browsers can accomplish a client resize within a single
animation frame. In Servo this must first cycle through the embedder
which might involve event loop iterations. Furthermore, the
specification doesn't say this should happen either.

Signed-off-by: Martin Robinson <mrobinson@abandonedwig.info>
@mrobinson
mrobinson force-pushed the wpt-fix-resize-event-order branch from c4588c1 to cf842b3 Compare October 16, 2026 07:32
@servo-highfive servo-highfive added S-awaiting-review There is new code that needs to be reviewed. and removed S-needs-code-changes Changes have not yet been made that were requested by a reviewer. labels Oct 16, 2026

@mrobinson mrobinson left a comment

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@yezhizhen Thanks for the review. Please take another look.

Comment on lines 22 to 26

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh, nice catch.


assert_equals(resize_events.toString(), '', 'PRECONDITION');
const oneResizeEvent = new Promise((resolve) => {
win.visualViewport.addEventListener("resize", resolve, { once: true });

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I've addressed this.

@servo-highfive servo-highfive removed the S-awaiting-review There is new code that needs to be reviewed. label Oct 16, 2026
@servo-wpt-sync

Copy link
Copy Markdown
Collaborator

📝 Transplanted new upstreamable changes to existing upstream WPT pull request (web-platform-tests/wpt#63732).

@mrobinson
mrobinson enabled auto-merge October 16, 2026 07:45
@mrobinson
mrobinson added this pull request to the merge queue Oct 16, 2026
@servo-highfive servo-highfive added the S-awaiting-merge The PR is in the process of compiling and running tests on the automated CI. label Oct 16, 2026
Merged via the queue into servo:main with commit c57b0a5 Oct 16, 2026
38 checks passed
@mrobinson
mrobinson deleted the wpt-fix-resize-event-order branch October 16, 2026 08:58
@servo-highfive servo-highfive removed the S-awaiting-merge The PR is in the process of compiling and running tests on the automated CI. label Oct 16, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Intermittent TIMEOUT in /visual-viewport/resize-event-order.html

4 participants