Bug 1804657 - Remove dead code related to having native theme in content on Linux. r=stransky

Since the headless work (bug 1129492 and co) we realistically have no
way of rendering native scrollbars in any meaningful way. Remove dead
code that used to support using a different GTK theme on content.

Differential Revision: https://phabricator.services.mozilla.com/D179616
This commit is contained in:
Emilio Cobos Álvarez 2023-06-01 07:37:33 +00:00
Родитель 1a07badaf4
Коммит 20b915489a
9 изменённых файлов: 1 добавлений и 70 удалений

Просмотреть файл

@ -15405,12 +15405,6 @@
mirror: always
#endif
# Whether to allow gtk dark themes in content.
- name: widget.content.allow-gtk-dark-theme
type: RelaxedAtomicBool
value: false
mirror: always
# Whether native GTK context menus are enabled.
# Disabled because at the very least there's missing custom icon support.
- name: widget.gtk.native-context-menus

Просмотреть файл

@ -3243,7 +3243,6 @@ pref("network.tcp.keepalive.idle_time", 600); // seconds; 10 mins
pref("network.psl.onUpdate_notify", false);
#ifdef MOZ_WIDGET_GTK
pref("widget.content.gtk-theme-override", "");
pref("widget.disable-workspace-management", false);
pref("widget.titlebar-x11-use-shape-mask", false);
#endif

Просмотреть файл

@ -363,8 +363,6 @@ const DEFAULT_ENVIRONMENT_PREFS = new Map([
["signon.rememberSignons", { what: RECORD_PREF_VALUE }],
["signon.firefoxRelay.feature", { what: RECORD_PREF_VALUE }],
["toolkit.telemetry.pioneerId", { what: RECORD_PREF_STATE }],
["widget.content.allow-gtk-dark-theme", { what: RECORD_DEFAULTPREF_VALUE }],
["widget.content.gtk-theme-override", { what: RECORD_PREF_STATE }],
[
"widget.content.gtk-high-contrast.enabled",
{ what: RECORD_DEFAULTPREF_VALUE },

Просмотреть файл

@ -48,21 +48,11 @@ struct LookAndFeelTables {
bool passwordEcho;
};
struct LookAndFeelTheme {
#ifdef MOZ_WIDGET_GTK
nsCString themeName;
bool preferDarkTheme;
#endif
};
/**
* Stores the entirety of a LookAndFeel's data.
*/
struct FullLookAndFeel {
LookAndFeelTables tables;
#ifdef MOZ_WIDGET_GTK
LookAndFeelTheme theme;
#endif
};
} // namespace widget

Просмотреть файл

@ -14,7 +14,6 @@
#include "mozilla/Result.h"
#include "mozilla/ResultExtensions.h"
#include "mozilla/StaticPrefs_widget.h"
#include "nsLookAndFeel.h"
#include "nsXULAppAPI.h"
#include <limits>
@ -35,14 +34,6 @@ RemoteLookAndFeel::RemoteLookAndFeel(FullLookAndFeel&& aData)
: mTables(std::move(aData.tables())) {
MOZ_ASSERT(XRE_IsContentProcess(),
"Only content processes should be using a RemoteLookAndFeel");
#ifdef MOZ_WIDGET_GTK
if (!StaticPrefs::widget_non_native_theme_enabled()) {
// Configure the theme in this content process with the Gtk theme that was
// chosen by WithThemeConfiguredForContent in the parent process.
nsLookAndFeel::ConfigureTheme(aData.theme());
}
#endif
}
RemoteLookAndFeel::~RemoteLookAndFeel() = default;
@ -52,14 +43,6 @@ void RemoteLookAndFeel::SetDataImpl(FullLookAndFeel&& aData) {
"Only content processes should be using a RemoteLookAndFeel");
MOZ_ASSERT(NS_IsMainThread());
mTables = std::move(aData.tables());
#ifdef MOZ_WIDGET_GTK
if (!StaticPrefs::widget_non_native_theme_enabled()) {
// Configure the theme in this content process with the Gtk theme that was
// chosen by WithThemeConfiguredForContent in the parent process.
nsLookAndFeel::ConfigureTheme(aData.theme());
}
#endif
}
namespace {
@ -233,10 +216,6 @@ const FullLookAndFeel* RemoteLookAndFeel::ExtractData() {
FullLookAndFeel* lf = new FullLookAndFeel{};
nsXPLookAndFeel* impl = nsXPLookAndFeel::GetInstance();
#ifdef MOZ_WIDGET_GTK
impl->GetGtkContentTheme(lf->theme());
#endif
lf->tables().passwordChar() = impl->GetPasswordCharacterImpl();
lf->tables().passwordEcho() = impl->GetEchoPasswordImpl();

Просмотреть файл

@ -1188,14 +1188,6 @@ static bool GetThemeIsDark() {
RelativeLuminanceUtils::Compute(GDK_RGBA_TO_NS_RGBA(fg));
}
void nsLookAndFeel::ConfigureTheme(const LookAndFeelTheme& aTheme) {
MOZ_ASSERT(XRE_IsContentProcess());
GtkSettings* settings = gtk_settings_get_default();
g_object_set(settings, "gtk-theme-name", aTheme.themeName().get(),
"gtk-application-prefer-dark-theme",
aTheme.preferDarkTheme() ? TRUE : FALSE, nullptr);
}
void nsLookAndFeel::RestoreSystemTheme() {
LOGLNF("RestoreSystemTheme(%s, %d, %d)\n", mSystemTheme.mName.get(),
mSystemTheme.mPreferDarkTheme, mSystemThemeOverridden);
@ -1553,19 +1545,6 @@ void nsLookAndFeel::ConfigureFinalEffectiveTheme() {
}
}
void nsLookAndFeel::GetGtkContentTheme(LookAndFeelTheme& aTheme) {
if (NS_SUCCEEDED(Preferences::GetCString("widget.content.gtk-theme-override",
aTheme.themeName()))) {
return;
}
auto& theme = StaticPrefs::widget_content_allow_gtk_dark_theme()
? mSystemTheme
: LightTheme();
aTheme.preferDarkTheme() = theme.mPreferDarkTheme;
aTheme.themeName() = theme.mName;
}
static nscolor GetBackgroundColor(
GtkStyleContext* aStyle, nscolor aForForegroundColor,
GtkStateFlags aState = GTK_STATE_FLAG_NORMAL,

Просмотреть файл

@ -35,11 +35,8 @@ class nsLookAndFeel final : public nsXPLookAndFeel {
bool GetDefaultDrawInTitlebar() override;
void GetGtkContentTheme(LookAndFeelTheme&) override;
void GetThemeInfo(nsACString&) override;
static void ConfigureTheme(const LookAndFeelTheme& aTheme);
static const nscolor kBlack = NS_RGB(0, 0, 0);
static const nscolor kWhite = NS_RGB(255, 255, 255);
void OnColorSchemeSettingChanged();

Просмотреть файл

@ -374,11 +374,8 @@ else:
]
IPDL_SOURCES += [
"PClipboardWriteRequest.ipdl",
]
PREPROCESSED_IPDL_SOURCES += [
"LookAndFeelTypes.ipdlh",
"PClipboardWriteRequest.ipdl",
]
LOCAL_INCLUDES += [

Просмотреть файл

@ -17,7 +17,6 @@ class nsXPLookAndFeel : public mozilla::LookAndFeel {
public:
using FullLookAndFeel = mozilla::widget::FullLookAndFeel;
using LookAndFeelFont = mozilla::widget::LookAndFeelFont;
using LookAndFeelTheme = mozilla::widget::LookAndFeelTheme;
virtual ~nsXPLookAndFeel();
@ -67,7 +66,6 @@ class nsXPLookAndFeel : public mozilla::LookAndFeel {
virtual void NativeInit() = 0;
virtual void GetGtkContentTheme(LookAndFeelTheme&) {}
virtual void GetThemeInfo(nsACString&) {}
protected: