Javascript image change cause stretching glitch before CSS is honored
Categories
(Core :: Layout: Images, Video, and HTML Frames, defect, P2)
Tracking
()
Tracking | Status | |
---|---|---|
firefox-esr60 | --- | unaffected |
firefox-esr68 | --- | wontfix |
firefox67 | --- | unaffected |
firefox68 | --- | wontfix |
firefox69 | --- | wontfix |
firefox70 | --- | wontfix |
firefox71 | --- | wontfix |
firefox72 | --- | verified |
firefox73 | --- | verified |
People
(Reporter: vdeconinck, Assigned: emilio)
References
(Regressed 1 open bug, Regression)
Details
(Keywords: regression)
Attachments
(2 files)
User Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:69.0) Gecko/20100101 Firefox/69.0
Steps to reproduce:
Open sample page at http://vdeconinck.synology.me/ffx_bug/ and wait for the slideshow to switch images.
Actual results:
There is a visible glitch when an image is first shown : it is resized to fit the frame of the previous image (even if it has a different aspect ratio) before CSS is honored and image is shown with its original image aspect ratio.
Expected results:
New image should immediately be displayed with the CSS applied.
NB: Chrome behaviour is ok.
Reporter | ||
Comment 1•6 years ago
|
||
Note : the symptoms are similar to bug 953364 but this one is obviously not fixed. Feel free to mark this as a dupe and reopen the original one if the root cause is identical...
Assignee | ||
Comment 2•6 years ago
|
||
Thanks for filing!
I wonder if it's a regression...
Comment 3•6 years ago
|
||
Bugbug thinks this bug is a regression, but please revert this change in case of error.
Comment 5•6 years ago
|
||
Here's a somewhat reduced testcase based on the Reporter's testcase.
Comment 6•6 years ago
|
||
Fwiw, the flicker also occurs with display: flex
instead of display: grid
.
Assignee | ||
Comment 7•6 years ago
|
||
I see it also with display: block
, I'm moderately sure this shouldn't be grid/flex-related.
So I think I know what happens, and I'm ~sure this was regressed by bug 1395964 (though it'd be good to confirm).
What is going on is, I think:
src
changes.- We get enough metadata about the new image to figure out the right aspect-ratio / size of the image, but haven't decoded it yet.
- We do layout with the new image's dimensions.
- We go to paint, try to decode the image, but it's not fully ready yet, so in order to prevent flashing, we paint the previous image.
- Normally this is fine since the images have similar aspect ratios, but in this case it's bad.
As far as I understand, other browsers sync-decode by default.
So, options in this case, I think, could be something like, if we have both mImage
and mPrevImage
, and their ratios are quite different (how much, though?), and the image is sized intrinsically (the frame size is dependent on the image intrinsic size / ratio), either:
- Sync-decode, to prevent flashing, or...
- Don't paint
mPrevImage
(we'd flash white).
Tim, thougts / better ideas? Maybe I'm completely off? :)
![]() |
||
Comment 8•6 years ago
|
||
I confirmed the regression range on Windows10 using the Testcase #1
mozregression:
https://hg.mozilla.org/integration/autoland/pushloghtml?fromchange=94682e23ba118dcfab3843a3280618b2e1686ecb&tochange=fdc7b66d76a4ded62d0292bef4de0ffb090d9587
![]() |
||
Updated•6 years ago
|
Assignee | ||
Comment 9•6 years ago
|
||
Thanks so much Alice :)
Comment 10•6 years ago
|
||
(In reply to Emilio Cobos Álvarez (:emilio) from comment #7)
So, options in this case, I think, could be something like, if we have both
mImage
andmPrevImage
, and their ratios are quite different (how much, though?), and the image is sized intrinsically (the frame size is dependent on the image intrinsic size / ratio), either:
- Sync-decode, to prevent flashing, or...
- Don't paint
mPrevImage
(we'd flash white).Tim, thougts / better ideas? Maybe I'm completely off? :)
Thanks for this explanation.
I would be fine with sync-decoding if the image size or ratio changed at all (even by a small amount) and the frame size was dependent on that.
Comment 11•6 years ago
|
||
I confirm the regression range found in comment 8. Also, I've set the flags and platform.
Assignee | ||
Comment 12•6 years ago
|
||
Alright, will give that a shot, when I get to it.
Updated•6 years ago
|
Assignee | ||
Comment 13•6 years ago
|
||
This seems to fix it for me, and it's pretty straight-forward, but I think
we'd still paint the old image if the image is huge and it's loading, which
may be counter-productive. Maybe we should guard the whole "paint mOldImage"
with and if (!oldImageIsDifferent), wdyt?
Assignee | ||
Updated•6 years ago
|
Comment 14•6 years ago
|
||
Change the status for beta to have the same as nightly and release.
For more information, please visit auto_nag documentation.
Updated•6 years ago
|
Comment 15•6 years ago
|
||
Updated•6 years ago
|
Comment 16•6 years ago
|
||
bugherder |
Comment 17•6 years ago
|
||
Regression in Firefox 54 and not a P1, this can ride the 72 train, wontfix 71.
Updated•6 years ago
|
Updated•6 years ago
|
Comment 18•6 years ago
|
||
I have verified this fix on Nightly v73.0a1 and Beta v72.0b67 on Windows 10 and Mac OS 10.13.6 after reproducing it in Firefox v71.0.
Updated•4 years ago
|
Description
•