Bug 1848899 - Remove widget.non-native-theme.enabled. r=desktop-theme-reviewers,dao,dholbert

Differential Revision: https://phabricator.services.mozilla.com/D209537
This commit is contained in:
Emilio Cobos Álvarez 2024-05-07 08:32:14 +00:00
parent d5b72c530b
commit 8bb4e85b36
21 changed files with 17 additions and 286 deletions

View File

@ -295,13 +295,10 @@ const kBoldFontWeight = function equalsToBold(aWeight) {
return aWeight > 400;
};
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)
WIN || MAC
? "10pt"
: MAC
? "8pt"
: function () {
return true;
};

View File

@ -18938,8 +18938,7 @@ void Document::AddPendingFrameStaticClone(nsFrameLoaderOwner* aElement,
}
bool Document::ShouldAvoidNativeTheme() const {
return StaticPrefs::widget_non_native_theme_enabled() &&
(!IsInChromeDocShell() || XRE_IsContentProcess());
return !IsInChromeDocShell() || XRE_IsContentProcess();
}
bool Document::UseRegularPrincipal() const {

View File

@ -2635,9 +2635,7 @@ bool ContentParent::BeginSubprocessLaunch(ProcessPriority aPriority) {
#ifdef MOZ_WIDGET_GTK
// This is X11-only pending a solution for WebGL in Wayland mode.
if (StaticPrefs::dom_ipc_avoid_gtk() &&
StaticPrefs::widget_non_native_theme_enabled() &&
widget::GdkIsX11Display()) {
if (StaticPrefs::dom_ipc_avoid_gtk() && widget::GdkIsX11Display()) {
mSubprocess->SetEnv("MOZ_HEADLESS", "1");
}
#endif

View File

@ -75,8 +75,6 @@ skip-if = ["os == 'android'"] # Bug 1635771
["test_bug717878_input_scroll.html"]
["test_bug869314.html"]
["test_bug903715.html"]
skip-if = ["true"]

View File

@ -1,55 +0,0 @@
<!DOCTYPE HTML>
<html>
<!--
https://bugzilla.mozilla.org/show_bug.cgi?id=869314
-->
<head>
<meta charset="utf-8">
<title>Test for Bug 869314</title>
<script src="/tests/SimpleTest/SimpleTest.js"></script>
<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/>
<style type="text/css">
.selectbox {
background-color: #00FF00;
}
</style>
</head>
<body>
<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=869314">Mozilla Bug 869314</a>
<p id="display"></p>
<div id="content">
<select id="selectbox1" name="non-native selectbox" class="selectbox">
<option value="item">test item</option>
</select>
<select id="selectbox2" name="native selectbox">
<option value="item">test item</option>
</select>
<script type="application/javascript">
let Cc = SpecialPowers.Cc;
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.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 >
document.getElementById("selectbox2").clientWidth,
"Non-native styled combobox does not have enough space for a " +
"dropmarker!");
} else {
// We need to call at least one test function to make the test harness
// happy.
ok(true, "Test wasn't ignored but should have been.");
}
</script>
</div>
<pre id="test">
</pre>
</body>
</html>

View File

@ -361,9 +361,6 @@ include text-svgglyphs/reftest.list
# text-transform/
include text-transform/reftest.list
# theme (osx)
include ../../toolkit/themes/osx/reftests/reftest.list
include ../../toolkit/content/tests/reftests/reftest.list
# transform/

View File

@ -25,7 +25,6 @@ reftest.jar:
content/xul (../../reftests/xul/*)
content/xul/reftest (../../xul/reftest/*)
content/toolkit/reftests (../../../toolkit/content/tests/reftests/*)
content/osx-theme (../../../toolkit/themes/osx/reftests/*)
content/reftest.xhtml (reftest.xhtml)
# Crash tests

View File

@ -14615,7 +14615,6 @@
# Run content processes in headless mode and disallow
# connections to the X server. Requires:
# * `webgl.out-of-process` (or else WebGL breaks)
# * `widget.non-native-theme.enabled` (scrollbars & form controls)
# Changing it requires a restart because sandbox policy information
# dependent on it is cached. See bug 1640345 for details.
- name: security.sandbox.content.headless
@ -16115,15 +16114,6 @@
# Prefs starting with "widget."
#---------------------------------------------------------------------------
# Global user preference for disabling native theme in content processes.
#
# NOTE(emilio): When changing this make sure to update the non_native_theme
# entry in python/mozbuild/mozbuild/mozinfo.py and test_fission_autostart.py
- name: widget.non-native-theme.enabled
type: RelaxedAtomicBool
value: true
mirror: always
# Whether the non-native theme should always use system colors. Useful mostly
# for testing forced colors mode.
- name: widget.non-native-theme.always-high-contrast

View File

@ -866,10 +866,7 @@ void SandboxBroker::SetSecurityLevelForContentProcess(int32_t aSandboxLevel,
}
if (aSandboxLevel > 4) {
// Alternate winstation breaks native theming.
bool useAlternateWinstation =
StaticPrefs::widget_non_native_theme_enabled();
result = mPolicy->SetAlternateDesktop(useAlternateWinstation);
result = mPolicy->SetAlternateDesktop(true);
if (NS_WARN_IF(result != sandbox::SBOX_ALL_OK)) {
LOG_W("SetAlternateDesktop failed, result: %i, last error: %lx", result,
::GetLastError());

View File

@ -51,7 +51,6 @@ support-files = [
]
prefs = [
"gfx.font_rendering.fallback.async=false",
"widget.non-native-theme.enabled=false",
]
["test_about_networking.html"]

View File

@ -1,21 +0,0 @@
<?xml version="1.0"?>
<?xml-stylesheet href="chrome://global/skin" type="text/css"?>
<?xml-stylesheet href="data:text/css,
vbox { height: 50px; }
box {
-moz-appearance: button;
}
" type="text/css"?>
<window title="Reference for mini, small and regular button sizes"
xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul">
<vbox>
<hbox><box width="79" height="16"/></hbox>
</vbox>
<vbox>
<hbox><box width="79" height="19"/></hbox>
</vbox>
<vbox>
<hbox><box width="79" height="22"/></hbox>
</vbox>
</window>

View File

@ -1,33 +0,0 @@
<?xml version="1.0"?>
<?xml-stylesheet href="chrome://global/skin" type="text/css"?>
<window title="Reference for mini, small and regular checkbox sizes"
xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul">
<style xmlns="http://www.w3.org/1999/xhtml">
vbox { height: 50px; }
box {
appearance: auto;
-moz-default-appearance: checkbox;
margin-left: 2px;
margin-top: 1px;
}
</style>
<vbox>
<hbox><box style="width: 11px; height: 11px"/></hbox>
</vbox>
<vbox>
<hbox><box style="width: 13px; height: 13px"/></hbox>
</vbox>
<vbox>
<hbox><box style="width: 16px; height: 16px"/></hbox>
</vbox>
<vbox>
<hbox checked="true"><box style="width: 11px; height: 11px"/></hbox>
</vbox>
<vbox>
<hbox checked="true"><box style="width: 13px; height: 13px"/></hbox>
</vbox>
<vbox>
<hbox checked="true"><box style="width: 16px; height: 16px"/></hbox>
</vbox>
</window>

View File

@ -1,31 +0,0 @@
<?xml version="1.0"?>
<?xml-stylesheet href="chrome://global/skin" type="text/css"?>
<?xml-stylesheet href="data:text/css,
vbox { height: 50px; }
checkbox {
color: transparent;
margin: 0;
}
" type="text/css"?>
<window title="Checkboxes with mini, small and regular control font"
xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul">
<vbox style="font-size: 9px">
<hbox><checkbox native="true" label="Mini"/></hbox>
</vbox>
<vbox style="font: message-box">
<hbox><checkbox native="true" label="Small"/></hbox>
</vbox>
<vbox style="font: menu">
<hbox><checkbox native="true" label="Regular"/></hbox>
</vbox>
<vbox style="font-size: 9px">
<hbox><checkbox native="true" label="Mini" checked="true"/></hbox>
</vbox>
<vbox style="font: message-box">
<hbox><checkbox native="true" label="Small" checked="true"/></hbox>
</vbox>
<vbox style="font: menu">
<hbox><checkbox native="true" label="Regular" checked="true"/></hbox>
</vbox>
</window>

View File

@ -1,33 +0,0 @@
<?xml version="1.0"?>
<?xml-stylesheet href="chrome://global/skin" type="text/css"?>
<window title="Reference for mini, small and regular radio button sizes"
xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul">
<style xmlns="http://www.w3.org/1999/xhtml">
vbox { height: 50px; }
box {
appearance: auto;
-moz-default-appearance: radio;
margin-left: 2px;
margin-top: 1px;
}
</style>
<vbox>
<hbox><box style="width: 11px; height: 11px;"/></hbox>
</vbox>
<vbox>
<hbox><box style="width: 13px; height: 13px;"/></hbox>
</vbox>
<vbox>
<hbox><box style="width: 16px; height: 16px;"/></hbox>
</vbox>
<vbox>
<hbox selected="true"><box style="width: 11px; height: 11px"/></hbox>
</vbox>
<vbox>
<hbox selected="true"><box style="width: 13px; height: 13px"/></hbox>
</vbox>
<vbox>
<hbox selected="true"><box style="width: 16px; height: 16px"/></hbox>
</vbox>
</window>

View File

@ -1,31 +0,0 @@
<?xml version="1.0"?>
<?xml-stylesheet href="chrome://global/skin" type="text/css"?>
<?xml-stylesheet href="data:text/css,
vbox { height: 50px; }
radio {
color: transparent;
margin: 0;
}
" type="text/css"?>
<window title="Radio buttons with mini, small and regular control font"
xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul">
<vbox style="font-size: 9px">
<hbox><radio label="Mini"/></hbox>
</vbox>
<vbox style="font: message-box">
<hbox><radio label="Small"/></hbox>
</vbox>
<vbox style="font: menu">
<hbox><radio label="Regular"/></hbox>
</vbox>
<vbox style="font-size: 9px">
<hbox><radio label="Mini" selected="true"/></hbox>
</vbox>
<vbox style="font: message-box">
<hbox><radio label="Small" selected="true"/></hbox>
</vbox>
<vbox style="font: menu">
<hbox><radio label="Regular" selected="true"/></hbox>
</vbox>
</window>

View File

@ -1,5 +0,0 @@
# This folder is registered in the chrome manifest at layout/tools/reftest/jar.mn.
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

View File

@ -784,11 +784,6 @@ nsIXULRuntime::ContentWin32kLockdownState GetLiveWin32kLockdownState() {
}
}
// Non-native theming is required as well
if (!StaticPrefs::widget_non_native_theme_enabled()) {
return nsIXULRuntime::ContentWin32kLockdownState::MissingNonNativeTheming;
}
// Win32k Lockdown requires Remote WebGL, but it may be disabled on
// certain hardware or virtual machines.
if (!gfx::gfxVars::AllowWebglOop() || !StaticPrefs::webgl_out_of_process()) {

View File

@ -116,10 +116,7 @@ bool ScrollbarDrawingGTK::PaintScrollbarThumb(
}
bool ScrollbarDrawingGTK::ShouldDrawScrollbarButtons() {
if (StaticPrefs::widget_non_native_theme_enabled()) {
return StaticPrefs::widget_non_native_theme_gtk_scrollbar_allow_buttons();
}
return true;
return StaticPrefs::widget_non_native_theme_gtk_scrollbar_allow_buttons();
}
void ScrollbarDrawingGTK::RecomputeScrollbarParams() {

View File

@ -1233,8 +1233,7 @@ void LookAndFeel::DoHandleGlobalThemeChange() {
//
// We can use the *DoNotUseDirectly functions directly here, because we want
// to notify all possible themes in a given process (but just once).
if (XRE_IsParentProcess() ||
!StaticPrefs::widget_non_native_theme_enabled()) {
if (XRE_IsParentProcess()) {
if (nsCOMPtr<nsITheme> theme = do_GetNativeThemeDoNotUseDirectly()) {
theme->ThemeChanged();
}

View File

@ -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.non-native-theme.enabled,true) test-pref(ui.scrollArrowStyle,4097) ref-pref(ui.scrollArrowStyle,0) == scrollbar-buttons.html scrollbar-buttons.html
skip-if(!gtkWidget) test-pref(ui.scrollArrowStyle,4097) ref-pref(ui.scrollArrowStyle,0) == scrollbar-buttons.html scrollbar-buttons.html

View File

@ -27,15 +27,6 @@ add_task(async () => {
// == Native theme ==
const WIN_REFERENCES = [
// Yellow background
["255,255,0", 6889],
// Blue scrollbar face
["0,0,255", 540],
// Cyan scrollbar track
["0,255,255", 2487],
];
const MAC_REFERENCES = [
// Yellow background
["255,255,0", 7225],
@ -45,19 +36,9 @@ add_task(async () => {
["0,255,255", 1760],
];
// Values have been updated from 8100, 720, 1180 for linux1804
const LINUX_REFERENCES = [
// Yellow background
["255,255,0", 7744],
// Blue scrollbar face
["0,0,255", 1104],
// Cyan scrollbar track
["0,255,255", 1152],
];
// == Non-native theme ==
const WIN10_NNT_REFERENCES = [
const WIN10_REFERENCES = [
// Yellow background
["255,255,0", 6889],
// Blue scrollbar face
@ -66,7 +47,7 @@ add_task(async () => {
["0,255,255", 2355],
];
const WIN11_NNT_REFERENCES = [
const WIN11_REFERENCES = [
// Yellow background
["255,255,0", 6889],
// Blue scrollbar face
@ -75,9 +56,7 @@ add_task(async () => {
["0,255,255", 2787],
];
const MAC_NNT_REFERENCES = MAC_REFERENCES;
const LINUX_NNT_REFERENCES = [
const LINUX_REFERENCES = [
// Yellow background
["255,255,0", 7744],
// Blue scrollbar face
@ -116,23 +95,19 @@ add_task(async () => {
let canvas = snapshotRect(content.window, outerRect);
let stats = countPixels(canvas);
let isNNT = SpecialPowers.getBoolPref("widget.non-native-theme.enabled");
let references;
if (content.navigator.platform.startsWith("Win")) {
if (!isNNT) {
references = WIN_REFERENCES;
} else if (WindowsVersionInfo.get().buildNumber >= 22000) {
// Windows 11 NNT
references = WIN11_NNT_REFERENCES;
if (WindowsVersionInfo.get().buildNumber >= 22000) {
// Windows 11
references = WIN11_REFERENCES;
} else {
// Windows 10 NNT
references = WIN10_NNT_REFERENCES;
// Windows 10
references = WIN10_REFERENCES;
}
} else if (content.navigator.platform.startsWith("Mac")) {
references = isNNT ? MAC_NNT_REFERENCES : MAC_REFERENCES;
references = MAC_REFERENCES;
} else if (content.navigator.platform.startsWith("Linux")) {
references = isNNT ? LINUX_NNT_REFERENCES : LINUX_REFERENCES;
references = LINUX_REFERENCES;
} else {
ok(false, "Unsupported platform");
}