Closed Bug 1561546 Opened 5 years ago Closed 5 years ago

prefers-color-scheme is not updated immediately after changing ui.systemUsesDarkTheme

Categories

(Core :: Widget, defect, P2)

68 Branch
defect

Tracking

()

VERIFIED FIXED
mozilla71
Tracking Status
firefox-esr68 --- wontfix
firefox67 --- wontfix
firefox68 --- wontfix
firefox69 --- wontfix
firefox70 --- wontfix
firefox71 --- verified

People

(Reporter: eight04, Assigned: agashlin)

References

Details

Attachments

(2 files, 1 obsolete file)

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

Steps to reproduce:

  1. Visit bugzilla.mozilla.org
  2. Verify the site is displayed in light theme
  3. Open a new tab about:config, set ui.systemUsesDarkTheme to 1
  4. Switch back to the bugzilla tab

Actual results:

Bugzilla is still displayed in light theme. If you resize the window, dark theme applies immediately.

Expected results:

Changing theme should not require a resize. Also, I think this issue may prevent background page from detecting changes of prefers-color-scheme.

Managed to reproduce this issue on Firefox Nightly 69.0a1, Firefox 68.0b14 and Firefox 67.0.4 on Windows 10 x 64, Mac OS X 10.14 and on Ubuntu 18.04 x64.

Status: UNCONFIRMED → NEW
Component: Untriaged → Theme
Ever confirmed: true
Component: Theme → CSS Parsing and Computation
Product: Firefox → Core
Priority: -- → P3

Widget code is what tracks these prefs. This should not be too hard to fix.

Component: CSS Parsing and Computation → Widget

The component has been changed since the backlog priority was decided, so we're resetting it.
For more information, please visit auto_nag documentation.

Priority: P3 → --

The priority flag is not set for this bug.
:jimm, could you have a look please?

For more information, please visit auto_nag documentation.

Flags: needinfo?(jmathies)

Something to poke at when you need a break from update work.

Flags: needinfo?(jmathies) → needinfo?(agashlin)
Priority: -- → P2

Mostly this just needs to run RefreshSystemMetrics(), but to ensure
that runs after the preference change has affected the LookAndFeel,
I'm calling ThemeChanged(), which should do the work after all
other preference callbacks have run.

Assignee: nobody → agashlin
Flags: needinfo?(agashlin)
Attachment #9089682 - Attachment is obsolete: true

Also causes removing a pref to take effect immediately, and prevents
losing all color pref overrides when the theme changes.

Attachment #9089947 - Flags: feedback?(emilio)

That looks good to me, thanks!

Maybe instead of the observer service we should use something like what the android code does for device changes, putting it in a common place?

Basically what that (fairly ugly) piece of code is doing is just going through all windows and call ThemeChanged on each.

In any case either way looks ok to me.

Attachment #9089947 - Flags: feedback?(emilio) → feedback+
Pushed by agashlin@mozilla.com:
https://hg.mozilla.org/integration/autoland/rev/9ef1dd77e6b2
Update theme when nsXPLookAndFeel prefs change. r=dholbert,jmathies
Backout by shindli@mozilla.com:
https://hg.mozilla.org/integration/autoland/rev/235856e26f56
Backed out changeset 9ef1dd77e6b2 for causing frequent failures in dom/animation/test/mozilla/test_restyles.html CLOSED TREE
Attachment #9089947 - Attachment description: Bug 1561546 - Update theme when nsXPLookAndFeel prefs change. → Bug 1561546 Part 2 - Update theme when nsXPLookAndFeel prefs change.
Depends on: 1582306
Pushed by agashlin@mozilla.com:
https://hg.mozilla.org/integration/autoland/rev/e452ba381a62
Part 1 - Change scrollbar pref early. r=hiro
Pushed by agashlin@mozilla.com:
https://hg.mozilla.org/integration/autoland/rev/29b8270e326c
Part 2 - Update theme when nsXPLookAndFeel prefs change. r=dholbert,jmathies
Status: NEW → RESOLVED
Closed: 5 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla71

Since the status are different for nightly and release, what's the status for beta?
For more information, please visit auto_nag documentation.

I'm assuming this can ride the trains, feel free to reset status and request uplift if not.

During my tests on Win 10 v1903 x64 (build 18362.387, Pro & Education) , both Firefox 71.0a1 (win64 exe, 2019-10-05) nightly and the firefox-71.0a1.en-US.win64.zip downloaded from https://archive.mozilla.org/pub/firefox/nightly/2019/09/2019-09-20-09-49-18-mozilla-central/ can not make extensions respond on dark theme changes.

Hello Dahan,
Did this previously work on Firefox 70? If so, please file a new regression bug, and fill in the "regressed by" field with this bug number (1561546).

If not, it is still a good idea to file a new bug, and you might leave that bug number in the "see also" field of this bug so interested parties will know to look at it.

In either case, please provide some more information about how to reproduce the bug, such as a particular extension that doesn't respond, what it was supposed to do, and what specific "dark theme changes" you mean.

(In reply to Adam Gashlin (he/him) [:agashlin] from comment #19)

Hello Dahan,
Did this previously work on Firefox 70? If so, please file a new regression bug, and fill in the "regressed by" field with this bug number (1561546).

If not, it is still a good idea to file a new bug, and you might leave that bug number in the "see also" field of this bug so interested parties will know to look at it.

In either case, please provide some more information about how to reproduce the bug, such as a particular extension that doesn't respond, what it was supposed to do, and what specific "dark theme changes" you mean.

Then it seems not a "regression bug", so I've created https://bugzilla.mozilla.org/show_bug.cgi?id=1587723 .

Flags: qe-verify+

Confirmed with 69.0a1(2019-06-26).
Verfiied fix with 71.0b5.

Status: RESOLVED → VERIFIED
Flags: qe-verify+

Bugbug thinks this bug is a regression, but please revert this change in case of error.

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

Attachment

General

Created:
Updated:
Size: