To elaborate on the second point, the value of the `ntp_background` theme API property is not delivered in time for the first paint of about:home, so the default background value of white or black is drawn instead. `ntp_background` is delivered moments later, causing flashing. We need to speed up setting `--newtab-background-color` in the about:home process so no flashing occurs. The current way `ntp_background` is delivered is: 1. When the parent process reads the current theme, its content-specific values are [loaded into a shared data store](https://searchfox.org/mozilla-central/rev/25002b534963ad95ff0c1a3dd0f906ba023ddc8e/toolkit/modules/LightweightThemeConsumer.jsm#319). 2. [When](https://searchfox.org/mozilla-central/source/browser/actors/LightweightThemeChild.jsm#49-50,53,57,61) DOMContentLoaded fires in the content process or this shared data store is opened, we dispatch a `LightwightTheme:Set` [event in the content process](https://searchfox.org/mozilla-central/source/browser/actors/LightweightThemeChild.jsm#81-83). 3. The content process [recieves the event](https://searchfox.org/mozilla-central/source/browser/base/content/contentTheme.js#141,146) containing the theme's color values and [updates :root](https://searchfox.org/mozilla-central/source/browser/base/content/contentTheme.js#187). I recorded a profile where I set the newtab's default background color to red to make the order of events more obvious. I also set the tabpanel background equal to `--newtab-background-color`, so you'll see the new window uses the correct background color; we flash when we start to load about:home: https://share.firefox.dev/3AbfPcm. One can also see the `LightweightTheme:Set` event occurs after the red paint.
Bug 1730562 Comment 4 Edit History
Note: The actual edited comment in the bug view page will always show the original commenter’s name and original timestamp.
To elaborate on the second point, the value of the `ntp_background` theme API property is not delivered in time for the first paint of about:home, so the default background value of white or black is drawn instead. `ntp_background` is delivered moments later, causing flashing. We need to speed up setting `--newtab-background-color` in the about:home process so no flashing occurs. The current way `ntp_background` is delivered is: 1. When the parent process reads the current theme, its content-specific values are [loaded into a shared data store](https://searchfox.org/mozilla-central/rev/25002b534963ad95ff0c1a3dd0f906ba023ddc8e/toolkit/modules/LightweightThemeConsumer.jsm#319). 2. [When](https://searchfox.org/mozilla-central/source/browser/actors/LightweightThemeChild.jsm#49-50,53,57,61) DOMContentLoaded fires in the content process or this shared data store is changed, we dispatch a `LightwightTheme:Set` [event in the content process](https://searchfox.org/mozilla-central/source/browser/actors/LightweightThemeChild.jsm#81-83). 3. The content process [recieves the event](https://searchfox.org/mozilla-central/source/browser/base/content/contentTheme.js#141,146) containing the theme's color values and [updates :root](https://searchfox.org/mozilla-central/source/browser/base/content/contentTheme.js#187). I recorded a profile where I set the newtab's default background color to red to make the order of events more obvious. I also set the tabpanel background equal to `--newtab-background-color`, so you'll see the new window uses the correct background color; we flash when we start to load about:home: https://share.firefox.dev/3AbfPcm. One can also see the `LightweightTheme:Set` event occurs after the red paint.