Open Bug 1614838 Opened 4 years ago Updated 2 years ago

widget.content.gtk-theme-override is broken in Firefox 73

Categories

(Core :: Widget: Gtk, defect, P3)

73 Branch
defect

Tracking

()

UNCONFIRMED

People

(Reporter: ongun.kanat+firefox, Unassigned)

Details

Attachments

(4 files)

User Agent: Mozilla/5.0 (X11; Linux x86_64; rv:73.0) Gecko/20100101 Firefox/73.0

Steps to reproduce:

I use a dark GTK theme on my desktop. Using Firefox with dark GTK themes is a challenging decision for users like me. Firefox uses GTK widget backgrounds. Since my theme is a dark, and input backgrounds are generally darker colors which makes reading black text really difficult if not impossible for me especially when HTML form elements only set foreground text color (using color: CSS attribute) as black while leaving background color of those form elements as default. It is a known issue and it is discussed in many different places on the internet including this bug tracker [1][2][3][4][5].

I want to keep my theme as it is. I want to keep the file and print dialogs as dark so I don't want to use GTK_THEME environment variable to force Firefox to use light variants.

Fixing this problem required various hacks or settings throughout the history of Firefox. The latest method that was working until Firefox 73 was the neat setting in about:config which only modified the GTK theme for widgets rendered in page content: widget.content.gtk-theme-override

Steps to reproduce:

  • Upgrade Firefox to 73
  • Set a dark GTK theme for the desktop such as Adwaita-dark or in my case Breeze-dark but the bug is reproducible with Adwaita-dark.
  • Download Adwaita-Slim https://github.com/godlyranchdressing/Adwaita-Slim
  • Extract Adwaita-Slim into ~/.themes
  • Set widget.content.gtk-theme-override to Adwaita-Slim in about:config
  • Open a webpage that has an <input type=text> form element (e.g. https://bugs.kde.org )

[1] https://bugzilla.mozilla.org/show_bug.cgi?id=1283086
[2] https://askubuntu.com/questions/8336/how-can-one-make-firefox-ignore-my-gtk-theme-entirely
[3] https://askubuntu.com/questions/978184/firefox-57-shows-dark-input-boxes-dropdown-menus-with-dark-text-on-gnome-dark-th
[4] https://www.mkammerer.de/blog/gtk-dark-theme-and-firefox/

System Info:
Distro: Arch Linux, all packages are up-to-date
DE: KDE Plasma 5.17.5, Frameworks: 5.67
GTK: 3.24.13
Firefox: 73.0
[5] https://bugzilla.mozilla.org/show_bug.cgi?id=70315

Actual results:

The dark variant of Adwaita-Slim is rendered. For GTK themes that does not provide gtk-dark.css (e.g. Teja https://www.gnome-look.org/p/1308393/) this bug is not reproducible.

Expected results:

The light variant of Adwaita-Slim should be used to render page widgets.

Looking at the code:

https://dxr.mozilla.org/mozilla-central/rev/813768d074e3accc36dc3313d0bffb658dcc562d/widget/gtk/nsLookAndFeel.cpp#944

I wonder what can be wrong there.

May be 'gtk-application-prefer-dark-theme' set so Gtk selected dark variant of Adwaita-Slim instead of the light one?

Priority: -- → P3

Can you reset widget.content.allow-gtk-dark-theme value at about:config or set it to false?

Flags: needinfo?(ongun.kanat+firefox)

I checked widget.content.allow-gtk-dark-theme and it is false. The screenshot is KDE bug tracker with Adwaita-Slim. If I remove / move gtk-3.0/gtk-dark.css in theme folder, it works correctly.

Flags: needinfo?(ongun.kanat+firefox)

Are those LOG() statements enabled in release builds (via some environment variable etc) or do you have debug builds compatible with GTK 3.24.x?

(In reply to Ongun Kanat from comment #4)

Are those LOG() statements enabled in release builds (via some environment variable etc) or do you have debug builds compatible with GTK 3.24.x?

Yes, please run on terminal as:

MOZ_LOG="Widget:5" firefox > log.txt 2>&1

and attach the log.txt here.
Thanks.

Flags: needinfo?(ongun.kanat+firefox)
Attached file Adwaita-Slim_log.txt

Here ya go. I'll upload a second file with Adwaita as the selected theme in widget.content.gtk-theme-override

Flags: needinfo?(ongun.kanat+firefox)
Attached file Adwaita_log.txt

After I posted those I checked my GTK 3 configuration, I think I have found the reason and the solution to the problem. I missed your suggestion

May be 'gtk-application-prefer-dark-theme' set so Gtk selected dark variant of Adwaita-Slim instead of the light one?

And it is indeed related. KDE sets gtk-application-prefer-dark-theme in settings.ini and it causes Firefox to load dark theme instead of the light one.

Setting widget.content.gtk-theme-override to Adwaita-Slim:light solved it.

So you can leave it as it is or maybe an about:config option to load light variant can be added?

On a second inspection I realized that the bug isn't fixed by

Setting widget.content.gtk-theme-override to Adwaita-Slim:light solved it.

It just fell back to Adwaita theme and somehow loaded the light variant. Adwaita-Slim has gray check boxes while Adwaita uses blue background for checkboxes. So some kind of bug is still there.

Severity: normal → S3
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Creator:
Created:
Updated:
Size: