Skip to content

Commit

Permalink
Bug 1694059 - Rename various nnt prefs. r=spohl,mstange
Browse files Browse the repository at this point in the history
As per feedback in D105931.

Differential Revision: https://phabricator.services.mozilla.com/D105991
  • Loading branch information
emilio committed Feb 22, 2021
1 parent 1a0e71c commit 15ff419
Show file tree
Hide file tree
Showing 16 changed files with 33 additions and 33 deletions.
4 changes: 1 addition & 3 deletions accessible/tests/mochitest/attributes.js
Original file line number Diff line number Diff line change
Expand Up @@ -295,9 +295,7 @@ const kBoldFontWeight = function equalsToBold(aWeight) {
return aWeight > 400;
};

let isNNT = SpecialPowers.getBoolPref(
"widget.disable-native-theme-for-content"
);
let isNNT = SpecialPowers.getBoolPref("widget.non-native-theme.enabled");
// The pt font size of the input element can vary by Linux distro.
const kInputFontSize =
WIN || (MAC && isNNT)
Expand Down
2 changes: 1 addition & 1 deletion dom/base/Document.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -16897,7 +16897,7 @@ void Document::AddPendingFrameStaticClone(nsFrameLoaderOwner* aElement,
}

bool Document::ShouldAvoidNativeTheme() const {
return StaticPrefs::widget_disable_native_theme_for_content() &&
return StaticPrefs::widget_non_native_theme_enabled() &&
(!IsInChromeDocShell() || XRE_IsContentProcess());
}

Expand Down
2 changes: 1 addition & 1 deletion layout/forms/test/test_bug869314.html
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@
let Ci = SpecialPowers.Ci;
let sysInfo = Cc["@mozilla.org/system-info;1"].getService(Ci.nsIPropertyBag2);
let osName = sysInfo.getProperty("name");
let isNNT = SpecialPowers.getBoolPref("widget.disable-native-theme-for-content");
let isNNT = SpecialPowers.getBoolPref("widget.non-native-theme.enabled");
if (osName == "Darwin" && !isNNT) { // Native styled macOS form controls.
// This test is for macOS with native styled form controls only. See bug for more info.
ok(document.getElementById("selectbox1").clientWidth >
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
body > button:nth-child(15) { margin: 0px; padding: 2px 4px 6px 8px; }
body > button:nth-child(16) { margin: 2px 4px 6px 8px; padding: 0px; }

@supports -moz-bool-pref("widget.disable-native-theme-for-content") {
@supports -moz-bool-pref("widget.non-native-theme.enabled") {
/* The non-native theme has different widget-supplied padding values
* for <input type="color"> and <button>, and so we must calculate
* the color swatch height explicitly. These are computed as the
Expand Down
2 changes: 1 addition & 1 deletion layout/reftests/forms/input/color/reference-style.css
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ button.input-color {
height: 23px;
}

@supports -moz-bool-pref("widget.disable-native-theme-for-content") {
@supports -moz-bool-pref("widget.non-native-theme.enabled") {
/* The non-native theme has different widget-supplied padding values
* for <input type="color"> and <button> -- `4px 4px 4px 4px` for the
* former, and `1px 4px 1px 4px` for the latter. So we size the
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
padding: 8px 1px;
}

@supports -moz-bool-pref("widget.disable-native-theme-for-content") {
@supports -moz-bool-pref("widget.non-native-theme.enabled") {
.ltr button,
.rtl button,
.ltr input[type="button"],
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
padding: 8px 1px;
}

@supports -moz-bool-pref("widget.disable-native-theme-for-content") {
@supports -moz-bool-pref("widget.non-native-theme.enabled") {
:is(.ltr, .rtl, .v-rl) input[type="color"] {
padding: 4px;
}
Expand Down
2 changes: 1 addition & 1 deletion layout/tools/reftest/manifest.jsm
Original file line number Diff line number Diff line change
Expand Up @@ -584,7 +584,7 @@ function BuildConditionSandbox(aURL) {
sandbox.windowsDefaultTheme = g.containingWindow.matchMedia("(-moz-windows-default-theme)").matches;

try {
sandbox.nativeThemePref = !prefs.getBoolPref("widget.disable-native-theme-for-content");
sandbox.nativeThemePref = !prefs.getBoolPref("widget.non-native-theme.enabled");
} catch (e) {
sandbox.nativeThemePref = true;
}
Expand Down
18 changes: 9 additions & 9 deletions modules/libpref/init/StaticPrefList.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -9695,7 +9695,7 @@
#if defined(XP_LINUX) && defined(MOZ_SANDBOX)
# Run content processes in headless mode and disallow connections to
# the X server. Experimental; breaks WebGL and Flash, and requires
# `widget.disable-native-theme-for-content` and `widget.remote-look-and-feel`.
# `widget.non-native-theme.enabled` and `widget.remote-look-and-feel`.
# Changing it requires a restart because sandbox policy information dependent
# on it is cached. See bug 1640345 for details.
- name: security.sandbox.content.headless
Expand Down Expand Up @@ -10482,7 +10482,7 @@
#
# NOTE(emilio): When changing this make sure to update the non_native_theme
# entry in python/mozbuild/mozbuild/mozinfo.py
- name: widget.disable-native-theme-for-content
- name: widget.non-native-theme.enabled
type: RelaxedAtomicBool
#if defined(XP_LINUX) && defined(NIGHTLY_BUILD) && !defined(ANDROID)
value: true
Expand All @@ -10494,38 +10494,38 @@
mirror: always

# The size in CSS pixels at full zoom of the minimum scrollbar width.
- name: widget.gtk.non-native.scrollbar.normal-size
- name: widget.non-native-theme.gtk.scrollbar.normal-size
type: uint32_t
value: 12
mirror: always

# The size in CSS pixels at full zoom of the "thin" scrollbars.
- name: widget.gtk.non-native.scrollbar.thin-size
- name: widget.non-native-theme.gtk.scrollbar.thin-size
type: uint32_t
value: 6
mirror: always

# The amount of space that the thumb should fill the scrollbar, from zero to
# one.
- name: widget.gtk.non-native.scrollbar.thumb-size
- name: widget.non-native-theme.gtk.scrollbar.thumb-size
type: float
value: 0.75
mirror: always

# The minimum size of the scroll thumb, in the scrollbar direction.
- name: widget.gtk.non-native.scrollbar.thumb-cross-size
- name: widget.non-native-theme.gtk.scrollbar.thumb-cross-size
type: uint32_t
value: 40
mirror: always

# Whether the thumb should be rounded for the non-native scrollbars.
- name: widget.gtk.non-native.round-thumb
- name: widget.non-native-theme.gtk.scrollbar.round-thumb
type: bool
value: true
mirror: always

# Whether buttons shouldn't be suppressed for non-native scrollbars.
- name: widget.gtk.non-native.scrollbar.allow-buttons
- name: widget.non-native-theme.gtk.scrollbar.allow-buttons
type: bool
value: false
mirror: always
Expand All @@ -10534,7 +10534,7 @@
#
# TODO(emilio): This should probably do the right thing in most other
# platforms, but stick to the standard colors on those.
- name: widget.non-native.use-theme-accent
- name: widget.non-native-theme.use-theme-accent
type: bool
#ifdef MOZ_WIDGET_GTK
value: true
Expand Down
2 changes: 1 addition & 1 deletion toolkit/content/tests/chrome/chrome.ini
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ support-files =
rtlchrome/rtl.manifest
prefs =
gfx.font_rendering.fallback.async=false
widget.disable-native-theme-for-content=false
widget.non-native-theme.enabled=false

[test_about_networking.html]
[test_arrowpanel.xhtml]
Expand Down
2 changes: 1 addition & 1 deletion toolkit/themes/osx/reftests/reftest.list
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# This folder is registered in the chrome manifest at layout/tools/reftest/jar.mn.
defaults pref(widget.disable-native-theme-for-content,false) # These are tests for the native theme.
defaults pref(widget.non-native-theme.enabled,false) # These are tests for the native theme.

skip-if(!cocoaWidget) == chrome://reftest/content/osx-theme/radiosize.xhtml chrome://reftest/content/osx-theme/radiosize-ref.xhtml
skip-if(!cocoaWidget) == chrome://reftest/content/osx-theme/checkboxsize.xhtml chrome://reftest/content/osx-theme/checkboxsize-ref.xhtml
Expand Down
4 changes: 2 additions & 2 deletions widget/RemoteLookAndFeel.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ RemoteLookAndFeel::RemoteLookAndFeel(FullLookAndFeel&& aData)
"Only content processes should be using a RemoteLookAndFeel");

#ifdef MOZ_WIDGET_GTK
if (!StaticPrefs::widget_disable_native_theme_for_content()) {
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());
Expand All @@ -45,7 +45,7 @@ void RemoteLookAndFeel::SetDataImpl(FullLookAndFeel&& aData) {
mTables = std::move(aData.tables());

#ifdef MOZ_WIDGET_GTK
if (!StaticPrefs::widget_disable_native_theme_for_content()) {
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());
Expand Down
13 changes: 7 additions & 6 deletions widget/gtk/nsNativeBasicThemeGTK.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ nsITheme::Transparency nsNativeBasicThemeGTK::GetWidgetTransparency(
}

bool nsNativeBasicThemeGTK::ThemeSupportsScrollbarButtons() {
return StaticPrefs::widget_gtk_non_native_scrollbar_allow_buttons();
return StaticPrefs::widget_non_native_theme_gtk_scrollbar_allow_buttons();
}

auto nsNativeBasicThemeGTK::GetScrollbarSizes(nsPresContext* aPresContext,
Expand All @@ -58,8 +58,8 @@ auto nsNativeBasicThemeGTK::GetScrollbarSizes(nsPresContext* aPresContext,
DPIRatio dpiRatio = GetDPIRatioForScrollbarPart(aPresContext);
CSSCoord size =
aWidth == StyleScrollbarWidth::Thin
? StaticPrefs::widget_gtk_non_native_scrollbar_thin_size()
: StaticPrefs::widget_gtk_non_native_scrollbar_normal_size();
? StaticPrefs::widget_non_native_theme_gtk_scrollbar_thin_size()
: StaticPrefs::widget_non_native_theme_gtk_scrollbar_normal_size();
LayoutDeviceIntCoord s = (size * dpiRatio).Truncated();
return {s, s};
}
Expand Down Expand Up @@ -109,7 +109,7 @@ nsNativeBasicThemeGTK::GetMinimumWidgetSize(nsPresContext* aPresContext,
aAppearance == StyleAppearance::ScrollbarthumbHorizontal ||
aAppearance == StyleAppearance::ScrollbarthumbVertical) {
CSSCoord thumbSize(
StaticPrefs::widget_gtk_non_native_scrollbar_thumb_cross_size());
StaticPrefs::widget_non_native_theme_gtk_scrollbar_thumb_cross_size());
const bool isVertical =
aAppearance == StyleAppearance::ScrollbarVertical ||
aAppearance == StyleAppearance::ScrollbarthumbVertical;
Expand All @@ -136,12 +136,13 @@ void nsNativeBasicThemeGTK::PaintScrollbarThumb(

{
float factor = std::max(
0.0f, 1.0f - StaticPrefs::widget_gtk_non_native_scrollbar_thumb_size());
0.0f,
1.0f - StaticPrefs::widget_non_native_theme_gtk_scrollbar_thumb_size());
thumbRect.Deflate((aHorizontal ? aRect.height : aRect.width) * factor);
}

LayoutDeviceCoord radius =
StaticPrefs::widget_gtk_non_native_round_thumb()
StaticPrefs::widget_non_native_theme_gtk_scrollbar_round_thumb()
? (aHorizontal ? thumbRect.height : thumbRect.width) / 2.0f
: 0.0f;

Expand Down
4 changes: 2 additions & 2 deletions widget/nsNativeBasicTheme.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ static LayoutDeviceIntCoord SnapBorderWidth(
}

static nscolor ThemedAccentColor(bool aBackground) {
MOZ_ASSERT(StaticPrefs::widget_non_native_use_theme_accent());
MOZ_ASSERT(StaticPrefs::widget_non_native_theme_use_theme_accent());
nscolor color = LookAndFeel::GetColor(
aBackground ? LookAndFeel::ColorID::MozAccentColor
: LookAndFeel::ColorID::MozAccentColorForeground);
Expand Down Expand Up @@ -103,7 +103,7 @@ void nsNativeBasicTheme::LookAndFeelChanged() { RecomputeAccentColors(); }
void nsNativeBasicTheme::RecomputeAccentColors() {
MOZ_RELEASE_ASSERT(NS_IsMainThread());

if (!StaticPrefs::widget_non_native_use_theme_accent()) {
if (!StaticPrefs::widget_non_native_theme_use_theme_accent()) {
sAccentColorForeground = sColorWhite;
sAccentColor =
sRGBColor::UnusualFromARGB(0xff0060df); // Luminance: 13.69346%
Expand Down
2 changes: 1 addition & 1 deletion widget/reftests/reftest.list
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,4 @@ load 664925.xhtml
pref(apz.allow_zooming,true) pref(ui.useOverlayScrollbars,0) skip-if(!cocoaWidget) != scaled-scrollbar.html about:blank

# Test that scrollbar buttons are inhibited on Linux using the non-native theme.
skip-if(!gtkWidget) pref(widget.disable-native-theme-for-content,true) test-pref(ui.scrollArrowStyle,4097) ref-pref(ui.scrollArrowStyle,0) == scrollbar-buttons.html scrollbar-buttons.html
skip-if(!gtkWidget) pref(widget.non-native-theme.enabled,true) test-pref(ui.scrollArrowStyle,4097) ref-pref(ui.scrollArrowStyle,0) == scrollbar-buttons.html scrollbar-buttons.html
3 changes: 2 additions & 1 deletion widget/tests/test_scrollbar_colors.html
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,8 @@

let canvas = snapshotRect(window, outerRect);
let stats = countPixels(canvas);
let isNNT = SpecialPowers.getBoolPref("widget.disable-native-theme-for-content");
let isNNT = SpecialPowers.getBoolPref("widget.non-native-theme.enabled");

let references;
if (navigator.platform.startsWith("Win")) {
references = isNNT ? WIN_NNT_REFERENCES : WIN_REFERENCES;
Expand Down

0 comments on commit 15ff419

Please sign in to comment.