Bug 1571544 - Convert mozilla.widget.disable-native-theme to static pref. r=njn

Converts mozilla.widget.disable-native-theme varcache pref to a static pref and updates uses of its associated global variable with the pref. This also renames the pref to widget.disable-native-theme to group with other widget prefs.

Differential Revision: https://phabricator.services.mozilla.com/D40721

--HG--
extra : moz-landing-system : lando
This commit is contained in:
Kristen Wright 2019-08-07 23:05:05 +00:00
Родитель 5855268c8e
Коммит b7b95930c5
5 изменённых файлов: 11 добавлений и 21 удалений

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

@ -532,7 +532,7 @@ sandbox.compareRetainedDisplayLists = g.compareRetainedDisplayLists;
sandbox.windowsDefaultTheme = g.containingWindow.matchMedia("(-moz-windows-default-theme)").matches;
try {
sandbox.nativeThemePref = !prefs.getBoolPref("mozilla.widget.disable-native-theme");
sandbox.nativeThemePref = !prefs.getBoolPref("widget.disable-native-theme");
} catch (e) {
sandbox.nativeThemePref = true;
}

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

@ -6396,6 +6396,12 @@
# Prefs starting with "widget."
#---------------------------------------------------------------------------
# Global user preference for disabling native theme. Used in NativeWindowTheme.
- name: widget.disable-native-theme
type: bool
value: false
mirror: always
- name: widget.window-transforms.disabled
type: RelaxedAtomicBool
value: false

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

@ -43,6 +43,7 @@
#include "mozilla/PresShell.h"
#include "mozilla/layers/StackingContextHelper.h"
#include "mozilla/StaticPrefs_layout.h"
#include "mozilla/StaticPrefs_widget.h"
#include "nsWindow.h"
#ifdef MOZ_X11
@ -67,9 +68,6 @@ NS_IMPL_ISUPPORTS_INHERITED(nsNativeThemeGTK, nsNativeTheme, nsITheme,
static int gLastGdkError;
// from nsWindow.cpp
extern bool gDisableNativeTheme;
// Return scale factor of the monitor where the window is located
// by the most part or layout.css.devPixelsPerPx pref if set to > 0.
static inline gint GetMonitorScaleFactor(nsIFrame* aFrame) {
@ -2044,7 +2042,7 @@ bool nsNativeThemeGTK::WidgetAppearanceDependsOnWindowFocus(
}
already_AddRefed<nsITheme> do_GetNativeTheme() {
if (gDisableNativeTheme) {
if (StaticPrefs::widget_disable_native_theme()) {
return nullptr;
}

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

@ -116,10 +116,6 @@ using namespace mozilla::widget;
using namespace mozilla;
using base::Thread;
// Global user preference for disabling native theme. Used
// in NativeWindowTheme.
bool gDisableNativeTheme = false;
// Async pump timer during injected long touch taps
#define TOUCH_INJECT_PUMP_TIMER_MSEC 50
#define TOUCH_INJECT_LONG_TAP_DEFAULT_MSEC 1500
@ -386,14 +382,6 @@ nsBaseWidget::~nsBaseWidget() {
//
//-------------------------------------------------------------------------
void nsBaseWidget::BaseCreate(nsIWidget* aParent, nsWidgetInitData* aInitData) {
static bool gDisableNativeThemeCached = false;
if (!gDisableNativeThemeCached) {
Preferences::AddBoolVarCache(&gDisableNativeTheme,
"mozilla.widget.disable-native-theme",
gDisableNativeTheme);
gDisableNativeThemeCached = true;
}
// keep a reference to the device context
if (nullptr != aInitData) {
mWindowType = aInitData->mWindowType;

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

@ -10,6 +10,7 @@
#include "mozilla/Logging.h"
#include "mozilla/RelativeLuminanceUtils.h"
#include "mozilla/StaticPrefs_layout.h"
#include "mozilla/StaticPrefs_widget.h"
#include "mozilla/WindowsVersion.h"
#include "mozilla/gfx/Types.h" // for Color::FromABGR
#include "nsColor.h"
@ -4282,11 +4283,8 @@ nsresult nsNativeThemeWin::DrawCustomScrollbarPart(
// Creation Routine
///////////////////////////////////////////
// from nsWindow.cpp
extern bool gDisableNativeTheme;
already_AddRefed<nsITheme> do_GetNativeTheme() {
if (gDisableNativeTheme) return nullptr;
if (StaticPrefs::widget_disable_native_theme()) return nullptr;
static nsCOMPtr<nsITheme> inst;