`container-type: inline-size` in outer document prevents resize events from firing when iframe changes from `display:none` to `display:block`
Categories
(Core :: Layout, defect)
Tracking
()
People
(Reporter: dholbert, Assigned: emilio)
References
(Blocks 2 open bugs, Regression)
Details
(Keywords: regression, webcompat:platform-bug)
Attachments
(7 files)
STR:
- Load testcase.
- Open your Web Console (F12) (optional)
- Click the "Click" button in the testcase.
EXPECTED RESULTS:
- The iframe should appear with "Resize count: 1".
- console.log should show "IFRAME RESIZED" when you click the button.
ACTUAL RESULTS:
The iframe appears with "Resize count: 0"
Reporter | ||
Comment 1•2 months ago
|
||
Reporter | ||
Comment 2•2 months ago
|
||
Reporter | ||
Updated•2 months ago
|
Reporter | ||
Comment 3•2 months ago
|
||
emilio: hoping you can take a look, as this seems to be a container-queries issue (that being the only difference between the testcase & reference case).
Reporter | ||
Comment 4•2 months ago
|
||
Here's a somewhat more reduced/standalone testcase.
Reporter | ||
Comment 5•2 months ago
|
||
Assignee | ||
Updated•2 months ago
|
Reporter | ||
Comment 6•2 months ago
|
||
I just noticed in bug 1933229 that this reproduces even if the container-type
element isn't an ancestor of the iframe. Here's a testcase to demonstrate that.
(It doesn't matter whether the element comes before or after in the DOM.)
Reporter | ||
Comment 7•2 months ago
•
|
||
As noted in bug 1933229 comment 8: this is a regression from when we enabled container queries (because the bug is specific to container-type: inline-size
). That happened in this Nightly range:
Last good: 2022-11-20
First bad: 2022-11-21
https://hg.mozilla.org/mozilla-central/pushloghtml?fromchange=d2c6287383301f29964047d5c718640eb4bbcccb&tochange=a29b80b107103df84e493008e420e30aea857da1
In builds from shortly after that time period, you can avoid the bug by toggling layout.css.container-queries.enabled
to false
(just as the reference cases here avoid the bug by removing the container-type
styling).
Reporter | ||
Updated•2 months ago
|
Reporter | ||
Updated•2 months ago
|
Updated•1 month ago
|
Assignee | ||
Comment 8•15 days ago
|
||
This is rather tricky / unfortunate, but this is the low-risk fix for
now. The issue is as follows:
When we construct a subdocument frame, we try to show its viewer by
using a script runner which will call ShowViewer().
If ShowViewer() gets called before the subdoc frame gets laid out
(has the NS_FRAME_FIRST_REFLOW bit set), we pick an (arbitrary) 10x10
device pixel size, and initialize the page with that viewport.
Then, eventually, the frame gets laid out to the correct size and fires
a resize event.
If we have container queries around, we need to lay out the page while
styling, which causes the layout to happen before the script blocker
checkpoint, and thus the viewport to get initialized with the right size
to begin with.
This generally shouldn't be bad, but pages google chat seems to rely on
this resize event (and the divergence being caused by container queries
is rather unfortunate).
For now, do the low risk fix of always using the "initial" subdoc frame
size to show the viewer.
We should ideally sort this out better. Even our "good" behavior is
quite bizarre (e.g, I'd expect going from display: block to none to
trigger a resize event and the viewport to go back to 0... As you noted,
chrome's inner layout sizes do change when the frame is display: none).
But it seems worth to land this at least in the interim.
Assignee | ||
Comment 9•15 days ago
|
||
Sorry for the lag, see the commit message for diagnostic and details... This seems all rather messy, but for now I restored our no-container-query behavior...
Comment 10•15 days ago
|
||
Comment 12•15 days ago
|
||
bugherder |
Comment 14•14 days ago
|
||
The patch landed in nightly and beta is affected.
:emilio, is this bug important enough to require an uplift?
- If yes, please nominate the patch for beta approval.
- If no, please set
status-firefox135
towontfix
.
For more information, please visit BugBot documentation.
Assignee | ||
Comment 15•14 days ago
|
||
I think given Google has a workaround and this is a rather subtle area, we can let this ride the trains, but let me know if you disagree.
Reporter | ||
Comment 17•14 days ago
|
||
I just verified that this is fixed in Nightly 136.0a1 (2025-01-08) using the attached testcases, too. --> updating status.
Description
•