Bug 1883023 [wpt PR 44879] - Avoid forced layout when finished parsing an empty subfr...
commit2810181ce4aac7f75a39ab98064711777d0e7f9b
authorNoam Rosenthal <nrosenthal@chromium.org>
Tue, 12 Mar 2024 22:27:50 +0000 (12 22:27 +0000)
committermoz-wptsync-bot <wptsync@mozilla.com>
Thu, 14 Mar 2024 08:38:10 +0000 (14 08:38 +0000)
tree612552c58b0e23480efc08a14b3d276d3e569882
parent8ff8a2a99bc4fbd2fa8f936ab2548c19c1068cb3
Bug 1883023 [wpt PR 44879] - Avoid forced layout when finished parsing an empty subframe, a=testonly

Automatic update from web-platform-tests
Avoid forced layout when finished parsing an empty subframe

The exiting check for empty document doesn't take into account that
we force-load an empty document, which doesn't change the flag.

Added a more appropriate check, initially behind the existing
kAvoidForcedLayoutOnInitialEmptyDocumentInSubframe flag, which would
allow us to finch-test this together with the previous change.

These two changes together should prevent jank on many sites that use
empty iframes, e.g. sites that use GTM.

This forced layout was overlooked by the previous test because it
doesn't use the proper code path for forcing layout. Updated the test
to ensure that added nodes don't have their styled clean (they still need a style recalc) after adding the iframe to the DOM.

Also two existing tests rely on the current behavior to pass:
1) third_party/blink/web_tests/fast/frames/avoid-forced-layout-on-empty-subframe.html

The extra layout was masking another bug, where an extra layout is
needed to correctly layout a select box with content-visibility:hidden.
(crbug.com/327723279)

2) chrome/test/data/webui/new_tab_page/logo_test.ts
This tests that doodles in the "new tab page" respond to resize requests
by animating the width/height of an empty iframe. Added a wait of one
animation frame to ensure the initial state of the iframe is rendered
rather than rely on that coincidental forced layout.

Bug: 324572951
Change-Id: Ib3b50e330e9a72c83b29d1e47f256b7ce33ae8ad
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/5335144
Commit-Queue: Noam Rosenthal <nrosenthal@chromium.org>
Reviewed-by: Stefan Zager <szager@chromium.org>
Reviewed-by: Tibor Goldschwendt <tiborg@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1268096}

--

wpt-commits: 11c2ded178a8f34d968041a7a4a2493b57d30ed3
wpt-pr: 44879
testing/web-platform/tests/css/css-sizing/contain-intrinsic-size/contain-intrinsic-size-033.html