Closed Bug 1625571 Opened 4 years ago Closed 4 years ago

Firefox background images vanish in out-of-focus browser tabs returning to focus

Categories

(Core :: Layout: Images, Video, and HTML Frames, defect, P2)

74 Branch
defect

Tracking

()

VERIFIED FIXED
mozilla76
Tracking Status
firefox-esr68 --- unaffected
firefox74 --- wontfix
firefox75 --- wontfix
firefox76 --- verified

People

(Reporter: gsutay, Assigned: emilio)

References

(Regression)

Details

(Keywords: regression)

Attachments

(2 files)

User Agent: Mozilla/5.0 (Windows NT 6.1; Win64; x64; rv:74.0) Gecko/20100101 Firefox/74.0

Steps to reproduce:

  1. Load page with background graphic
  2. Change to other open browser tabs for a few minutes or more
  3. Return to the tab with the background graphic

Actual results:

Notice that sometimes (frequently after longer visits to parallel tabs), the background image will not be showing any more in the tab. All the rest of the content still shows. Hitting refresh will again show the background image.

Expected results:

I would expect the background image to always load with page content when returning to a tab.

I can reproduce on Nightly76.0a1(20200327094805) Windows10.

Status: UNCONFIRMED → NEW
Component: Untriaged → Layout: Images, Video, and HTML Frames
Ever confirmed: true
Product: Firefox → Core

Hmm, all I need to reproduce is
<style>
body {
background: url("http://covid19responseteam.org/images/background_4_virus.png") no-repeat top center fixed;
background-size: contain;
background-position: center 108px;
}
</style>
and then goto about:memory in a new tab and click minimize memory and then return to the tab. The invalidate for the redecode of the image is getting lost maybe?

Reducing the size of my background image from 1.24MB to 900KB did not help. Having 5 tabs open to pages from my site that all leverage the background will randomly have various pages missing the background when I revisit the tab.

I also applied a background color of black to show if the background image is not available:

body {
margin: 0;
font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, "Noto Sans", sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol", "Noto Color Emoji";
font-size: .875rem;
font-weight: 400;
line-height: 1.5;
color: #23282c;
text-align: left;
background-color: #000000;
background: url("../images/background_4_virus.png") no-repeat top center fixed;
-webkit-background-size: contain;
-moz-background-size: contain;
-o-background-size: contain;
background-size: contain;
background-position: center 108px;
}

When this issue reproduces, the black color doesn't appear. This suggests that there is no issue fetching the background image (else, the black background-color would show).

Flags: needinfo?(emilio)
Regressed by: 1619245
No longer regressed by: 1615607
Has Regression Range: --- → yes

So far, I cannot reproduce this on a different computer running Firefox version: 68.6.0esr (32-bit)

Hmm, I get different results from both regression ranges here: I reproduce the problem in the 2020-02-08 nightly which is before both regression ranges.

(In reply to Timothy Nikkel (:tnikkel) from comment #8)

I get

https://hg.mozilla.org/integration/autoland/pushloghtml?fromchange=fa233e2c081b14a5589f65e72769a259e0ad4fad&tochange=e3382fdd4f543e1177ba3b0f080d90905cdeb22f

-> bug 1606628

Perhaps the fact that we stopped cloning the imgRequestProxy in that bug?

I confirmed the regression range if using keyboard(like ctrl+1) to switch tab.

That's because we are looking at the wrong frame, it's a confusion between the canvas frame and the body frame.

Not really confusion. The body frame is always associated via DidSetComputedStyle. The canvas frame relies on the display item calling Paint or CreateWebRenderCommands to get associated (this seems like a bug since we could layerize the image and hence not call either of those, but this is not the bug that is happening here). After we switch back to the tab we get two paints in a row. The first paint creates a new background image display item and paint gets called on it and the canvas frame gets associated. The second paint replaces that background image display item (it's destructor de-associates the canvas frame), the new background image display item never gets paint called on it (probably because nothing has actually changed and needs to be repainted), and so the canvas frame ends up dis-associated. And then we get the frame update notification but there is no associated frame that has an associated display item so we think the image is not visible and do nothing.

(Another thing, this setup also only works when retained display lists are turned on, otherwise display items only survive one paint. So bug 1619245 is still broken is one flips the retained display list prefs off.)

Yeah, I think I'm going to move this bit a bit further down and stop associating images to the canvas frame.

Flags: needinfo?(emilio)
Priority: -- → P2
Pushed by ealvarez@mozilla.com:
https://hg.mozilla.org/integration/autoland/rev/acb3f6f0a64e
Invalidate canvas background in ImageLoader rather than nsDisplayBackgroundImage. r=tnikkel
Status: NEW → RESOLVED
Closed: 4 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla76
Regressions: 1626332
Regressions: 1627372
No longer regressions: 1627372
Flags: qe-verify+

Crosschecking with the website linked on comment 9 and several other websites - 76.0a1 (2020-04-01) on macOS 10.15.3 was unable to replicate the reported issue.

Managed to reproduce using steps from comment 2 on Ubuntu 18.04 with
After an extended navigation round with 76.0b6 on Windows 10, macOS 10.15.3 Ubuntu 18.04 issue was not encountered.

Status: RESOLVED → VERIFIED
Flags: qe-verify+

After a day or so of experimenting with a lot of background images and radial gradients on a local static site of mine, I eventually realised this was a bug with Firefox and not my CSS. I arrived at this thread from here. Am I correct in thinking that this has been fixed in Firefox 76? If so, when is Firefox 76 expected to be released by, and is it possible to get it any earlier?

Thank you.

76 is scheduled for may 5. You can download beta or nightly. https://www.mozilla.org/en-US/firefox/channel/desktop/

You need to log in before you can comment on or make changes to this bug.

Attachment

General

Creator:
Created:
Updated:
Size: