Bug 1736518 - Make browser.tabs.drawInTitlebar a tri-state. r=stransky,Gijs
To more properly support Linux having a different default at runtime. Expose the resolved value in appinfo for convenience, and use it in the front-end as needed. Differential Revision: https://phabricator.services.mozilla.com/D129004
This commit is contained in:
@@ -629,11 +629,6 @@ pref("browser.tabs.tabMinWidth", 76);
|
|||||||
// secondary text on tabs hidden due to size constraints and readability
|
// secondary text on tabs hidden due to size constraints and readability
|
||||||
// of the text at small font sizes.
|
// of the text at small font sizes.
|
||||||
pref("browser.tabs.secondaryTextUnsupportedLocales", "ar,bn,bo,ckb,fa,gu,he,hi,ja,km,kn,ko,lo,mr,my,ne,pa,si,ta,te,th,ur,zh");
|
pref("browser.tabs.secondaryTextUnsupportedLocales", "ar,bn,bo,ckb,fa,gu,he,hi,ja,km,kn,ko,lo,mr,my,ne,pa,si,ta,te,th,ur,zh");
|
||||||
// Initial titlebar state is managed by -moz-gtk-csd-hide-titlebar-by-default
|
|
||||||
// on Linux.
|
|
||||||
#ifndef UNIX_BUT_NOT_MAC
|
|
||||||
pref("browser.tabs.drawInTitlebar", true);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
//Control the visibility of Tab Manager Menu.
|
//Control the visibility of Tab Manager Menu.
|
||||||
pref("browser.tabs.tabmanager.enabled", false);
|
pref("browser.tabs.tabmanager.enabled", false);
|
||||||
|
|||||||
@@ -54,10 +54,7 @@ var TabsInTitlebar = {
|
|||||||
_prefName: "browser.tabs.drawInTitlebar",
|
_prefName: "browser.tabs.drawInTitlebar",
|
||||||
|
|
||||||
_readPref() {
|
_readPref() {
|
||||||
let hiddenTitlebar = Services.prefs.getBoolPref(
|
let hiddenTitlebar = Services.appinfo.drawInTitlebar;
|
||||||
"browser.tabs.drawInTitlebar",
|
|
||||||
window.matchMedia("(-moz-gtk-csd-hide-titlebar-by-default)").matches
|
|
||||||
);
|
|
||||||
this.allowedBy("pref", hiddenTitlebar);
|
this.allowedBy("pref", hiddenTitlebar);
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|||||||
@@ -61,8 +61,8 @@ add_task(async function titlebar_buttons_visibility() {
|
|||||||
Services.prefs.setIntPref("browser.link.open_newwindow", 2);
|
Services.prefs.setIntPref("browser.link.open_newwindow", 2);
|
||||||
|
|
||||||
const drawInTitlebarValues = [
|
const drawInTitlebarValues = [
|
||||||
[true, BUTTONS_MAY_VISIBLE],
|
[1, BUTTONS_MAY_VISIBLE],
|
||||||
[false, BUTTONS_NEVER_VISIBLE],
|
[0, BUTTONS_NEVER_VISIBLE],
|
||||||
];
|
];
|
||||||
const windowFeaturesValues = [
|
const windowFeaturesValues = [
|
||||||
// Opens a popup
|
// Opens a popup
|
||||||
@@ -77,7 +77,7 @@ add_task(async function titlebar_buttons_visibility() {
|
|||||||
const menuBarShownValues = [true, false];
|
const menuBarShownValues = [true, false];
|
||||||
|
|
||||||
for (const [drawInTitlebar, drawInTitlebarButtons] of drawInTitlebarValues) {
|
for (const [drawInTitlebar, drawInTitlebarButtons] of drawInTitlebarValues) {
|
||||||
Services.prefs.setBoolPref("browser.tabs.drawInTitlebar", drawInTitlebar);
|
Services.prefs.setIntPref("browser.tabs.drawInTitlebar", drawInTitlebar);
|
||||||
|
|
||||||
for (const [
|
for (const [
|
||||||
windowFeatures,
|
windowFeatures,
|
||||||
|
|||||||
@@ -71,7 +71,7 @@ add_task(async function testWritesEnabledOnPrefChange() {
|
|||||||
is(enabled, 0, "Pre-XUL skeleton UI is disabled in the Windows registry");
|
is(enabled, 0, "Pre-XUL skeleton UI is disabled in the Windows registry");
|
||||||
|
|
||||||
Services.prefs.setBoolPref("browser.startup.preXulSkeletonUI", true);
|
Services.prefs.setBoolPref("browser.startup.preXulSkeletonUI", true);
|
||||||
Services.prefs.setBoolPref("browser.tabs.drawInTitlebar", false);
|
Services.prefs.setIntPref("browser.tabs.drawInTitlebar", 0);
|
||||||
enabled = WindowsRegistry.readRegKey(
|
enabled = WindowsRegistry.readRegKey(
|
||||||
Ci.nsIWindowsRegKey.ROOT_KEY_CURRENT_USER,
|
Ci.nsIWindowsRegKey.ROOT_KEY_CURRENT_USER,
|
||||||
"Software\\Mozilla\\Firefox\\PreXULSkeletonUISettings",
|
"Software\\Mozilla\\Firefox\\PreXULSkeletonUISettings",
|
||||||
|
|||||||
@@ -800,10 +800,7 @@ let JSWINDOWACTORS = {
|
|||||||
);
|
);
|
||||||
|
|
||||||
// Hide the titlebar if the actual browser window will draw in it.
|
// Hide the titlebar if the actual browser window will draw in it.
|
||||||
let hiddenTitlebar = Services.prefs.getBoolPref(
|
let hiddenTitlebar = Services.appinfo.drawInTitlebar;
|
||||||
"browser.tabs.drawInTitlebar",
|
|
||||||
win.matchMedia("(-moz-gtk-csd-hide-titlebar-by-default)").matches
|
|
||||||
);
|
|
||||||
if (hiddenTitlebar) {
|
if (hiddenTitlebar) {
|
||||||
win.windowUtils.setChromeMargin(0, 2, 2, 2);
|
win.windowUtils.setChromeMargin(0, 2, 2, 2);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -3151,12 +3151,8 @@ var CustomizableUIInternal = {
|
|||||||
|
|
||||||
_resetUIState() {
|
_resetUIState() {
|
||||||
try {
|
try {
|
||||||
// kPrefDrawInTitlebar may not be defined on Linux/Gtk+ which throws an exception
|
gUIStateBeforeReset.drawInTitlebar = Services.prefs.getIntPref(
|
||||||
// and leads to whole test failure. Let's set a fallback default value to avoid that,
|
kPrefDrawInTitlebar
|
||||||
// both titlebar states are tested anyway and it's not important which state is tested first.
|
|
||||||
gUIStateBeforeReset.drawInTitlebar = Services.prefs.getBoolPref(
|
|
||||||
kPrefDrawInTitlebar,
|
|
||||||
false
|
|
||||||
);
|
);
|
||||||
gUIStateBeforeReset.uiCustomizationState = Services.prefs.getCharPref(
|
gUIStateBeforeReset.uiCustomizationState = Services.prefs.getCharPref(
|
||||||
kPrefCustomizationState
|
kPrefCustomizationState
|
||||||
@@ -3246,7 +3242,7 @@ var CustomizableUIInternal = {
|
|||||||
this._clearPreviousUIState();
|
this._clearPreviousUIState();
|
||||||
|
|
||||||
Services.prefs.setCharPref(kPrefCustomizationState, uiCustomizationState);
|
Services.prefs.setCharPref(kPrefCustomizationState, uiCustomizationState);
|
||||||
Services.prefs.setBoolPref(kPrefDrawInTitlebar, drawInTitlebar);
|
Services.prefs.setIntPref(kPrefDrawInTitlebar, drawInTitlebar);
|
||||||
Services.prefs.setIntPref(kPrefUIDensity, uiDensity);
|
Services.prefs.setIntPref(kPrefUIDensity, uiDensity);
|
||||||
Services.prefs.setBoolPref(kPrefAutoTouchMode, autoTouchMode);
|
Services.prefs.setBoolPref(kPrefAutoTouchMode, autoTouchMode);
|
||||||
Services.prefs.setBoolPref(
|
Services.prefs.setBoolPref(
|
||||||
|
|||||||
@@ -1715,10 +1715,7 @@ CustomizeMode.prototype = {
|
|||||||
},
|
},
|
||||||
|
|
||||||
_updateTitlebarCheckbox() {
|
_updateTitlebarCheckbox() {
|
||||||
let drawInTitlebar = Services.prefs.getBoolPref(
|
let drawInTitlebar = Services.appinfo.drawInTitlebar;
|
||||||
kDrawInTitlebarPref,
|
|
||||||
this.window.matchMedia("(-moz-gtk-csd-hide-titlebar-by-default)").matches
|
|
||||||
);
|
|
||||||
let checkbox = this.$("customization-titlebar-visibility-checkbox");
|
let checkbox = this.$("customization-titlebar-visibility-checkbox");
|
||||||
// Drawing in the titlebar means 'hiding' the titlebar.
|
// Drawing in the titlebar means 'hiding' the titlebar.
|
||||||
// We use the attribute rather than a property because if we're not in
|
// We use the attribute rather than a property because if we're not in
|
||||||
@@ -1732,7 +1729,7 @@ CustomizeMode.prototype = {
|
|||||||
|
|
||||||
toggleTitlebar(aShouldShowTitlebar) {
|
toggleTitlebar(aShouldShowTitlebar) {
|
||||||
// Drawing in the titlebar means not showing the titlebar, hence the negation:
|
// Drawing in the titlebar means not showing the titlebar, hence the negation:
|
||||||
Services.prefs.setBoolPref(kDrawInTitlebarPref, !aShouldShowTitlebar);
|
Services.prefs.setIntPref(kDrawInTitlebarPref, !aShouldShowTitlebar);
|
||||||
},
|
},
|
||||||
|
|
||||||
_getBoundsWithoutFlushing(element) {
|
_getBoundsWithoutFlushing(element) {
|
||||||
|
|||||||
@@ -142,11 +142,16 @@ add_task(async function() {
|
|||||||
|
|
||||||
// Bug 971626 - Restore Defaults should collapse the Title Bar
|
// Bug 971626 - Restore Defaults should collapse the Title Bar
|
||||||
add_task(async function() {
|
add_task(async function() {
|
||||||
if (Services.appinfo.OS != "WINNT" && Services.appinfo.OS != "Darwin") {
|
{
|
||||||
return;
|
const supported = TabsInTitlebar.systemSupported;
|
||||||
|
is(typeof supported, "boolean");
|
||||||
|
info("TabsInTitlebar support: " + supported);
|
||||||
|
if (!supported) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
let prefName = "browser.tabs.drawInTitlebar";
|
|
||||||
let defaultValue = Services.prefs.getBoolPref(prefName);
|
const kDefaultValue = Services.appinfo.drawInTitlebar;
|
||||||
let restoreDefaultsButton = document.getElementById(
|
let restoreDefaultsButton = document.getElementById(
|
||||||
"customization-reset-button"
|
"customization-reset-button"
|
||||||
);
|
);
|
||||||
@@ -166,7 +171,7 @@ add_task(async function() {
|
|||||||
);
|
);
|
||||||
is(
|
is(
|
||||||
titlebarCheckbox.hasAttribute("checked"),
|
titlebarCheckbox.hasAttribute("checked"),
|
||||||
!defaultValue,
|
!kDefaultValue,
|
||||||
"Title bar checkbox should reflect pref value"
|
"Title bar checkbox should reflect pref value"
|
||||||
);
|
);
|
||||||
is(
|
is(
|
||||||
@@ -175,14 +180,20 @@ add_task(async function() {
|
|||||||
"Undo reset button should be hidden at start of test"
|
"Undo reset button should be hidden at start of test"
|
||||||
);
|
);
|
||||||
|
|
||||||
Services.prefs.setBoolPref(prefName, !defaultValue);
|
let prefName = "browser.tabs.drawInTitlebar";
|
||||||
|
Services.prefs.setIntPref(prefName, !kDefaultValue);
|
||||||
ok(
|
ok(
|
||||||
!restoreDefaultsButton.disabled,
|
!restoreDefaultsButton.disabled,
|
||||||
"Restore defaults button should be enabled when pref changed"
|
"Restore defaults button should be enabled when pref changed"
|
||||||
);
|
);
|
||||||
|
is(
|
||||||
|
Services.appinfo.drawInTitlebar,
|
||||||
|
!kDefaultValue,
|
||||||
|
"Title bar checkbox should reflect changed pref value"
|
||||||
|
);
|
||||||
is(
|
is(
|
||||||
titlebarCheckbox.hasAttribute("checked"),
|
titlebarCheckbox.hasAttribute("checked"),
|
||||||
defaultValue,
|
kDefaultValue,
|
||||||
"Title bar checkbox should reflect changed pref value"
|
"Title bar checkbox should reflect changed pref value"
|
||||||
);
|
);
|
||||||
ok(
|
ok(
|
||||||
@@ -202,14 +213,19 @@ add_task(async function() {
|
|||||||
);
|
);
|
||||||
is(
|
is(
|
||||||
titlebarCheckbox.hasAttribute("checked"),
|
titlebarCheckbox.hasAttribute("checked"),
|
||||||
!defaultValue,
|
!kDefaultValue,
|
||||||
"Title bar checkbox should reflect default value after reset"
|
"Title bar checkbox should reflect default value after reset"
|
||||||
);
|
);
|
||||||
is(
|
is(
|
||||||
Services.prefs.getBoolPref(prefName),
|
Services.prefs.getIntPref(prefName),
|
||||||
defaultValue,
|
2,
|
||||||
"Reset should reset drawInTitlebar"
|
"Reset should reset drawInTitlebar"
|
||||||
);
|
);
|
||||||
|
is(
|
||||||
|
Services.appinfo.drawInTitlebar,
|
||||||
|
kDefaultValue,
|
||||||
|
"Default state should be restored"
|
||||||
|
);
|
||||||
ok(CustomizableUI.inDefaultState, "In default state after titlebar reset");
|
ok(CustomizableUI.inDefaultState, "In default state after titlebar reset");
|
||||||
is(
|
is(
|
||||||
undoResetButton.hidden,
|
undoResetButton.hidden,
|
||||||
@@ -228,13 +244,13 @@ add_task(async function() {
|
|||||||
);
|
);
|
||||||
is(
|
is(
|
||||||
titlebarCheckbox.hasAttribute("checked"),
|
titlebarCheckbox.hasAttribute("checked"),
|
||||||
defaultValue,
|
kDefaultValue,
|
||||||
"Title bar checkbox should reflect undo-reset value"
|
"Title bar checkbox should reflect undo-reset value"
|
||||||
);
|
);
|
||||||
ok(!CustomizableUI.inDefaultState, "No longer in default state after undo");
|
ok(!CustomizableUI.inDefaultState, "No longer in default state after undo");
|
||||||
is(
|
is(
|
||||||
Services.prefs.getBoolPref(prefName),
|
Services.prefs.getIntPref(prefName),
|
||||||
!defaultValue,
|
kDefaultValue ? 0 : 1,
|
||||||
"Undo-reset goes back to previous pref value"
|
"Undo-reset goes back to previous pref value"
|
||||||
);
|
);
|
||||||
is(
|
is(
|
||||||
|
|||||||
@@ -497,9 +497,7 @@ let BrowserUsageTelemetry = {
|
|||||||
case "browser.tabs.drawInTitlebar":
|
case "browser.tabs.drawInTitlebar":
|
||||||
this._recordWidgetChange(
|
this._recordWidgetChange(
|
||||||
"titlebar",
|
"titlebar",
|
||||||
Services.prefs.getBoolPref("browser.tabs.drawInTitlebar")
|
Services.appinfo.drawInTitlebar ? "off" : "on",
|
||||||
? "off"
|
|
||||||
: "on",
|
|
||||||
"pref"
|
"pref"
|
||||||
);
|
);
|
||||||
break;
|
break;
|
||||||
@@ -601,12 +599,7 @@ let BrowserUsageTelemetry = {
|
|||||||
widgetMap.set("menu-toolbar", menuBarHidden ? "off" : "on");
|
widgetMap.set("menu-toolbar", menuBarHidden ? "off" : "on");
|
||||||
|
|
||||||
// Drawing in the titlebar means not showing the titlebar, hence the negation.
|
// Drawing in the titlebar means not showing the titlebar, hence the negation.
|
||||||
widgetMap.set(
|
widgetMap.set("titlebar", Services.appinfo.drawInTitlebar ? "off" : "on");
|
||||||
"titlebar",
|
|
||||||
Services.prefs.getBoolPref("browser.tabs.drawInTitlebar", true)
|
|
||||||
? "off"
|
|
||||||
: "on"
|
|
||||||
);
|
|
||||||
|
|
||||||
for (let area of CustomizableUI.areas) {
|
for (let area of CustomizableUI.areas) {
|
||||||
if (!(area in BROWSER_UI_CONTAINER_IDS)) {
|
if (!(area in BROWSER_UI_CONTAINER_IDS)) {
|
||||||
|
|||||||
@@ -111,7 +111,7 @@ function organizeToolbars(state = {}) {
|
|||||||
targetState.personalToolbarVisible
|
targetState.personalToolbarVisible
|
||||||
);
|
);
|
||||||
|
|
||||||
Services.prefs.setBoolPref(
|
Services.prefs.setIntPref(
|
||||||
"browser.tabs.drawInTitlebar",
|
"browser.tabs.drawInTitlebar",
|
||||||
!targetState.titlebarVisible
|
!targetState.titlebarVisible
|
||||||
);
|
);
|
||||||
|
|||||||
@@ -17,10 +17,7 @@ var TabsInTitlebar = {
|
|||||||
tabsInTitlebar: {
|
tabsInTitlebar: {
|
||||||
selectors: ["#navigator-toolbox"],
|
selectors: ["#navigator-toolbox"],
|
||||||
async applyConfig() {
|
async applyConfig() {
|
||||||
if (Services.appinfo.OS == "Linux") {
|
Services.prefs.setIntPref(PREF_TABS_IN_TITLEBAR, 1);
|
||||||
return "TabsInTitlebar isn't supported on Linux";
|
|
||||||
}
|
|
||||||
Services.prefs.setBoolPref(PREF_TABS_IN_TITLEBAR, true);
|
|
||||||
return undefined;
|
return undefined;
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
@@ -30,7 +27,7 @@ var TabsInTitlebar = {
|
|||||||
Services.appinfo.OS == "Linux" ? [] : ["#titlebar"]
|
Services.appinfo.OS == "Linux" ? [] : ["#titlebar"]
|
||||||
),
|
),
|
||||||
async applyConfig() {
|
async applyConfig() {
|
||||||
Services.prefs.setBoolPref(PREF_TABS_IN_TITLEBAR, false);
|
Services.prefs.setIntPref(PREF_TABS_IN_TITLEBAR, 0);
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -61,7 +61,6 @@ var suppressed_toggles = [
|
|||||||
"-moz-windows-default-theme",
|
"-moz-windows-default-theme",
|
||||||
"-moz-windows-glass",
|
"-moz-windows-glass",
|
||||||
"-moz-gtk-csd-available",
|
"-moz-gtk-csd-available",
|
||||||
"-moz-gtk-csd-hide-titlebar-by-default",
|
|
||||||
"-moz-gtk-csd-minimize-button",
|
"-moz-gtk-csd-minimize-button",
|
||||||
"-moz-gtk-csd-maximize-button",
|
"-moz-gtk-csd-maximize-button",
|
||||||
"-moz-gtk-csd-close-button",
|
"-moz-gtk-csd-close-button",
|
||||||
|
|||||||
@@ -21,7 +21,6 @@ const CHROME_ONLY_TOGGLES = [
|
|||||||
"-moz-windows-non-native-menus",
|
"-moz-windows-non-native-menus",
|
||||||
"-moz-swipe-animation-enabled",
|
"-moz-swipe-animation-enabled",
|
||||||
"-moz-gtk-csd-available",
|
"-moz-gtk-csd-available",
|
||||||
"-moz-gtk-csd-hide-titlebar-by-default",
|
|
||||||
"-moz-gtk-csd-minimize-button",
|
"-moz-gtk-csd-minimize-button",
|
||||||
"-moz-gtk-csd-maximize-button",
|
"-moz-gtk-csd-maximize-button",
|
||||||
"-moz-gtk-csd-close-button",
|
"-moz-gtk-csd-close-button",
|
||||||
|
|||||||
@@ -1300,6 +1300,14 @@
|
|||||||
value: false
|
value: false
|
||||||
mirror: always
|
mirror: always
|
||||||
|
|
||||||
|
# Whether we should draw the tabs on top of the titlebar.
|
||||||
|
#
|
||||||
|
# no (0), yes (1), or default (2), which is true everywhere except Linux.
|
||||||
|
- name: browser.tabs.drawInTitlebar
|
||||||
|
type: int32_t
|
||||||
|
value: 2
|
||||||
|
mirror: always
|
||||||
|
|
||||||
# If set, use DocumentChannel to directly initiate loads entirely
|
# If set, use DocumentChannel to directly initiate loads entirely
|
||||||
# from parent-process BrowsingContexts
|
# from parent-process BrowsingContexts
|
||||||
- name: browser.tabs.documentchannel.parent-controlled
|
- name: browser.tabs.documentchannel.parent-controlled
|
||||||
|
|||||||
@@ -651,7 +651,7 @@ macro_rules! bool_pref_feature {
|
|||||||
/// to support new types in these entries and (2) ensuring that either
|
/// to support new types in these entries and (2) ensuring that either
|
||||||
/// nsPresContext::MediaFeatureValuesChanged is called when the value that
|
/// nsPresContext::MediaFeatureValuesChanged is called when the value that
|
||||||
/// would be returned by the evaluator function could change.
|
/// would be returned by the evaluator function could change.
|
||||||
pub static MEDIA_FEATURES: [MediaFeatureDescription; 59] = [
|
pub static MEDIA_FEATURES: [MediaFeatureDescription; 58] = [
|
||||||
feature!(
|
feature!(
|
||||||
atom!("width"),
|
atom!("width"),
|
||||||
AllowsRanges::Yes,
|
AllowsRanges::Yes,
|
||||||
@@ -890,7 +890,6 @@ pub static MEDIA_FEATURES: [MediaFeatureDescription; 59] = [
|
|||||||
lnf_int_feature!(atom!("-moz-windows-glass"), WindowsGlass),
|
lnf_int_feature!(atom!("-moz-windows-glass"), WindowsGlass),
|
||||||
lnf_int_feature!(atom!("-moz-swipe-animation-enabled"), SwipeAnimationEnabled),
|
lnf_int_feature!(atom!("-moz-swipe-animation-enabled"), SwipeAnimationEnabled),
|
||||||
lnf_int_feature!(atom!("-moz-gtk-csd-available"), GTKCSDAvailable),
|
lnf_int_feature!(atom!("-moz-gtk-csd-available"), GTKCSDAvailable),
|
||||||
lnf_int_feature!(atom!("-moz-gtk-csd-hide-titlebar-by-default"), GTKCSDHideTitlebarByDefault),
|
|
||||||
lnf_int_feature!(atom!("-moz-gtk-csd-minimize-button"), GTKCSDMinimizeButton),
|
lnf_int_feature!(atom!("-moz-gtk-csd-minimize-button"), GTKCSDMinimizeButton),
|
||||||
lnf_int_feature!(atom!("-moz-gtk-csd-maximize-button"), GTKCSDMaximizeButton),
|
lnf_int_feature!(atom!("-moz-gtk-csd-maximize-button"), GTKCSDMaximizeButton),
|
||||||
lnf_int_feature!(atom!("-moz-gtk-csd-close-button"), GTKCSDCloseButton),
|
lnf_int_feature!(atom!("-moz-gtk-csd-close-button"), GTKCSDCloseButton),
|
||||||
|
|||||||
@@ -23,6 +23,7 @@
|
|||||||
#include "mozilla/Printf.h"
|
#include "mozilla/Printf.h"
|
||||||
#include "mozilla/ResultExtensions.h"
|
#include "mozilla/ResultExtensions.h"
|
||||||
#include "mozilla/ScopeExit.h"
|
#include "mozilla/ScopeExit.h"
|
||||||
|
#include "mozilla/StaticPrefs_browser.h"
|
||||||
#include "mozilla/StaticPrefs_fission.h"
|
#include "mozilla/StaticPrefs_fission.h"
|
||||||
#include "mozilla/Telemetry.h"
|
#include "mozilla/Telemetry.h"
|
||||||
#include "mozilla/Utf8.h"
|
#include "mozilla/Utf8.h"
|
||||||
@@ -276,7 +277,6 @@ static const char kPrefThemeId[] = "extensions.activeThemeID";
|
|||||||
static const char kPrefBrowserStartupBlankWindow[] =
|
static const char kPrefBrowserStartupBlankWindow[] =
|
||||||
"browser.startup.blankWindow";
|
"browser.startup.blankWindow";
|
||||||
static const char kPrefPreXulSkeletonUI[] = "browser.startup.preXulSkeletonUI";
|
static const char kPrefPreXulSkeletonUI[] = "browser.startup.preXulSkeletonUI";
|
||||||
static const char kPrefDrawTabsInTitlebar[] = "browser.tabs.drawInTitlebar";
|
|
||||||
#endif // defined(XP_WIN)
|
#endif // defined(XP_WIN)
|
||||||
|
|
||||||
int gArgc;
|
int gArgc;
|
||||||
@@ -1331,6 +1331,12 @@ nsXULAppInfo::GetChromeColorSchemeIsDark(bool* aResult) {
|
|||||||
return NS_OK;
|
return NS_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
NS_IMETHODIMP
|
||||||
|
nsXULAppInfo::GetDrawInTitlebar(bool* aResult) {
|
||||||
|
*aResult = LookAndFeel::DrawInTitlebar();
|
||||||
|
return NS_OK;
|
||||||
|
}
|
||||||
|
|
||||||
NS_IMETHODIMP
|
NS_IMETHODIMP
|
||||||
nsXULAppInfo::GetProcessStartupShortcut(nsAString& aShortcut) {
|
nsXULAppInfo::GetProcessStartupShortcut(nsAString& aShortcut) {
|
||||||
#if defined(XP_WIN)
|
#if defined(XP_WIN)
|
||||||
@@ -1996,7 +2002,7 @@ static void ReflectSkeletonUIPrefToRegistry(const char* aPref, void* aData) {
|
|||||||
bool shouldBeEnabled =
|
bool shouldBeEnabled =
|
||||||
Preferences::GetBool(kPrefPreXulSkeletonUI, false) &&
|
Preferences::GetBool(kPrefPreXulSkeletonUI, false) &&
|
||||||
Preferences::GetBool(kPrefBrowserStartupBlankWindow, false) &&
|
Preferences::GetBool(kPrefBrowserStartupBlankWindow, false) &&
|
||||||
Preferences::GetBool(kPrefDrawTabsInTitlebar, false);
|
LookAndFeel::DrawInTitlebar();
|
||||||
if (shouldBeEnabled && Preferences::HasUserValue(kPrefThemeId)) {
|
if (shouldBeEnabled && Preferences::HasUserValue(kPrefThemeId)) {
|
||||||
nsCString themeId;
|
nsCString themeId;
|
||||||
Preferences::GetCString(kPrefThemeId, themeId);
|
Preferences::GetCString(kPrefThemeId, themeId);
|
||||||
@@ -2025,8 +2031,9 @@ static void SetupSkeletonUIPrefs() {
|
|||||||
Preferences::RegisterCallback(&ReflectSkeletonUIPrefToRegistry,
|
Preferences::RegisterCallback(&ReflectSkeletonUIPrefToRegistry,
|
||||||
kPrefBrowserStartupBlankWindow);
|
kPrefBrowserStartupBlankWindow);
|
||||||
Preferences::RegisterCallback(&ReflectSkeletonUIPrefToRegistry, kPrefThemeId);
|
Preferences::RegisterCallback(&ReflectSkeletonUIPrefToRegistry, kPrefThemeId);
|
||||||
Preferences::RegisterCallback(&ReflectSkeletonUIPrefToRegistry,
|
Preferences::RegisterCallback(
|
||||||
kPrefDrawTabsInTitlebar);
|
&ReflectSkeletonUIPrefToRegistry,
|
||||||
|
nsDependentCString(StaticPrefs::GetPrefName_browser_tabs_drawInTitlebar()));
|
||||||
}
|
}
|
||||||
|
|
||||||
# if defined(MOZ_LAUNCHER_PROCESS)
|
# if defined(MOZ_LAUNCHER_PROCESS)
|
||||||
|
|||||||
@@ -246,12 +246,6 @@ class LookAndFeel {
|
|||||||
*/
|
*/
|
||||||
GTKCSDAvailable,
|
GTKCSDAvailable,
|
||||||
|
|
||||||
/*
|
|
||||||
* A boolean value indicating whether GTK+ system titlebar should be
|
|
||||||
* disabled by default.
|
|
||||||
*/
|
|
||||||
GTKCSDHideTitlebarByDefault,
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* A boolean value indicating whether client-side decorations should
|
* A boolean value indicating whether client-side decorations should
|
||||||
* contain a minimize button.
|
* contain a minimize button.
|
||||||
@@ -509,6 +503,11 @@ class LookAndFeel {
|
|||||||
*/
|
*/
|
||||||
static bool GetEchoPassword();
|
static bool GetEchoPassword();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Whether we should be drawing in the titlebar by default.
|
||||||
|
*/
|
||||||
|
static bool DrawInTitlebar();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The millisecond to mask password value.
|
* The millisecond to mask password value.
|
||||||
* This value is only valid when GetEchoPassword() returns true.
|
* This value is only valid when GetEchoPassword() returns true.
|
||||||
|
|||||||
@@ -789,10 +789,6 @@ nsresult nsLookAndFeel::NativeGetInt(IntID aID, int32_t& aResult) {
|
|||||||
EnsureInit();
|
EnsureInit();
|
||||||
aResult = mCSDAvailable;
|
aResult = mCSDAvailable;
|
||||||
break;
|
break;
|
||||||
case IntID::GTKCSDHideTitlebarByDefault:
|
|
||||||
EnsureInit();
|
|
||||||
aResult = mCSDHideTitlebarByDefault;
|
|
||||||
break;
|
|
||||||
case IntID::GTKCSDMaximizeButton:
|
case IntID::GTKCSDMaximizeButton:
|
||||||
EnsureInit();
|
EnsureInit();
|
||||||
aResult = mCSDMaximizeButton;
|
aResult = mCSDMaximizeButton;
|
||||||
@@ -1246,7 +1242,6 @@ void nsLookAndFeel::EnsureInit() {
|
|||||||
|
|
||||||
mCSDAvailable =
|
mCSDAvailable =
|
||||||
nsWindow::GtkWindowDecoration() != nsWindow::GTK_DECORATION_NONE;
|
nsWindow::GtkWindowDecoration() != nsWindow::GTK_DECORATION_NONE;
|
||||||
mCSDHideTitlebarByDefault = nsWindow::HideTitlebarByDefault();
|
|
||||||
|
|
||||||
mSystemTheme.Init();
|
mSystemTheme.Init();
|
||||||
|
|
||||||
@@ -1840,6 +1835,29 @@ char16_t nsLookAndFeel::GetPasswordCharacterImpl() {
|
|||||||
|
|
||||||
bool nsLookAndFeel::GetEchoPasswordImpl() { return false; }
|
bool nsLookAndFeel::GetEchoPasswordImpl() { return false; }
|
||||||
|
|
||||||
|
bool nsLookAndFeel::GetDefaultDrawInTitlebar() {
|
||||||
|
static bool drawInTitlebar = []() {
|
||||||
|
// When user defined widget.default-hidden-titlebar don't do any
|
||||||
|
// heuristics and just follow it.
|
||||||
|
if (Preferences::HasUserValue("widget.default-hidden-titlebar")) {
|
||||||
|
return Preferences::GetBool("widget.default-hidden-titlebar", false);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Don't hide titlebar when it's disabled on current desktop.
|
||||||
|
const char* currentDesktop = getenv("XDG_CURRENT_DESKTOP");
|
||||||
|
if (!currentDesktop || nsWindow::GetSystemGtkWindowDecoration() ==
|
||||||
|
nsWindow::GTK_DECORATION_NONE) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
// We hide system titlebar on Gnome/ElementaryOS without any restriction.
|
||||||
|
return strstr(currentDesktop, "GNOME-Flashback:GNOME") ||
|
||||||
|
strstr(currentDesktop, "GNOME") ||
|
||||||
|
strstr(currentDesktop, "Pantheon");
|
||||||
|
}();
|
||||||
|
return drawInTitlebar;
|
||||||
|
}
|
||||||
|
|
||||||
void nsLookAndFeel::GetThemeInfo(nsACString& aInfo) {
|
void nsLookAndFeel::GetThemeInfo(nsACString& aInfo) {
|
||||||
aInfo.Append(mSystemTheme.mName);
|
aInfo.Append(mSystemTheme.mName);
|
||||||
aInfo.Append(" / ");
|
aInfo.Append(" / ");
|
||||||
|
|||||||
@@ -32,6 +32,8 @@ class nsLookAndFeel final : public nsXPLookAndFeel {
|
|||||||
char16_t GetPasswordCharacterImpl() override;
|
char16_t GetPasswordCharacterImpl() override;
|
||||||
bool GetEchoPasswordImpl() override;
|
bool GetEchoPasswordImpl() override;
|
||||||
|
|
||||||
|
bool GetDefaultDrawInTitlebar() override;
|
||||||
|
|
||||||
template <typename Callback>
|
template <typename Callback>
|
||||||
void WithAltThemeConfigured(const Callback&);
|
void WithAltThemeConfigured(const Callback&);
|
||||||
|
|
||||||
@@ -155,7 +157,6 @@ class nsLookAndFeel final : public nsXPLookAndFeel {
|
|||||||
int32_t mCaretBlinkTime = 0;
|
int32_t mCaretBlinkTime = 0;
|
||||||
int32_t mCaretBlinkCount = -1;
|
int32_t mCaretBlinkCount = -1;
|
||||||
bool mCSDAvailable = false;
|
bool mCSDAvailable = false;
|
||||||
bool mCSDHideTitlebarByDefault = false;
|
|
||||||
bool mCSDMaximizeButton = false;
|
bool mCSDMaximizeButton = false;
|
||||||
bool mCSDMinimizeButton = false;
|
bool mCSDMinimizeButton = false;
|
||||||
bool mCSDCloseButton = false;
|
bool mCSDCloseButton = false;
|
||||||
|
|||||||
@@ -8720,29 +8720,6 @@ bool nsWindow::TitlebarUseShapeMask() {
|
|||||||
return useShapeMask;
|
return useShapeMask;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool nsWindow::HideTitlebarByDefault() {
|
|
||||||
static int hideTitlebar = []() {
|
|
||||||
// When user defined widget.default-hidden-titlebar don't do any
|
|
||||||
// heuristics and just follow it.
|
|
||||||
if (Preferences::HasUserValue("widget.default-hidden-titlebar")) {
|
|
||||||
return Preferences::GetBool("widget.default-hidden-titlebar", false);
|
|
||||||
}
|
|
||||||
|
|
||||||
// Don't hide titlebar when it's disabled on current desktop.
|
|
||||||
const char* currentDesktop = getenv("XDG_CURRENT_DESKTOP");
|
|
||||||
if (!currentDesktop ||
|
|
||||||
GetSystemGtkWindowDecoration() == GTK_DECORATION_NONE) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
// We hide system titlebar on Gnome/ElementaryOS without any restriction.
|
|
||||||
return ((strstr(currentDesktop, "GNOME-Flashback:GNOME") != nullptr ||
|
|
||||||
strstr(currentDesktop, "GNOME") != nullptr ||
|
|
||||||
strstr(currentDesktop, "Pantheon") != nullptr));
|
|
||||||
}();
|
|
||||||
return hideTitlebar;
|
|
||||||
}
|
|
||||||
|
|
||||||
int32_t nsWindow::RoundsWidgetCoordinatesTo() { return GdkCeiledScaleFactor(); }
|
int32_t nsWindow::RoundsWidgetCoordinatesTo() { return GdkCeiledScaleFactor(); }
|
||||||
|
|
||||||
void nsWindow::GetCompositorWidgetInitData(
|
void nsWindow::GetCompositorWidgetInitData(
|
||||||
|
|||||||
@@ -367,7 +367,6 @@ class nsWindow final : public nsBaseWidget {
|
|||||||
*/
|
*/
|
||||||
static GtkWindowDecoration GetSystemGtkWindowDecoration();
|
static GtkWindowDecoration GetSystemGtkWindowDecoration();
|
||||||
|
|
||||||
static bool HideTitlebarByDefault();
|
|
||||||
static bool GetTopLevelWindowActiveState(nsIFrame* aFrame);
|
static bool GetTopLevelWindowActiveState(nsIFrame* aFrame);
|
||||||
static bool TitlebarUseShapeMask();
|
static bool TitlebarUseShapeMask();
|
||||||
bool IsRemoteContent() { return HasRemoteContent(); }
|
bool IsRemoteContent() { return HasRemoteContent(); }
|
||||||
|
|||||||
@@ -256,7 +256,6 @@ nsresult HeadlessLookAndFeel::NativeGetInt(IntID aID, int32_t& aResult) {
|
|||||||
aResult = 1;
|
aResult = 1;
|
||||||
break;
|
break;
|
||||||
case IntID::GTKCSDAvailable:
|
case IntID::GTKCSDAvailable:
|
||||||
case IntID::GTKCSDHideTitlebarByDefault:
|
|
||||||
aResult = 0;
|
aResult = 0;
|
||||||
break;
|
break;
|
||||||
case IntID::GTKCSDMinimizeButton:
|
case IntID::GTKCSDMinimizeButton:
|
||||||
|
|||||||
@@ -160,7 +160,6 @@ static const char sIntPrefs[][43] = {
|
|||||||
"ui.contextMenuOffsetVertical",
|
"ui.contextMenuOffsetVertical",
|
||||||
"ui.contextMenuOffsetHorizontal",
|
"ui.contextMenuOffsetHorizontal",
|
||||||
"ui.GtkCSDAvailable",
|
"ui.GtkCSDAvailable",
|
||||||
"ui.GtkCSDHideTitlebarByDefault",
|
|
||||||
"ui.GtkCSDMinimizeButton",
|
"ui.GtkCSDMinimizeButton",
|
||||||
"ui.GtkCSDMaximizeButton",
|
"ui.GtkCSDMaximizeButton",
|
||||||
"ui.GtkCSDCloseButton",
|
"ui.GtkCSDCloseButton",
|
||||||
@@ -1266,6 +1265,18 @@ uint32_t LookAndFeel::GetPasswordMaskDelay() {
|
|||||||
return delay;
|
return delay;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool LookAndFeel::DrawInTitlebar() {
|
||||||
|
switch (StaticPrefs::browser_tabs_drawInTitlebar()) {
|
||||||
|
case 0:
|
||||||
|
return false;
|
||||||
|
case 1:
|
||||||
|
return true;
|
||||||
|
default:
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
return nsLookAndFeel::GetInstance()->GetDefaultDrawInTitlebar();
|
||||||
|
}
|
||||||
|
|
||||||
void LookAndFeel::GetThemeInfo(nsACString& aOut) {
|
void LookAndFeel::GetThemeInfo(nsACString& aOut) {
|
||||||
nsLookAndFeel::GetInstance()->GetThemeInfo(aOut);
|
nsLookAndFeel::GetInstance()->GetThemeInfo(aOut);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -56,6 +56,8 @@ class nsXPLookAndFeel : public mozilla::LookAndFeel {
|
|||||||
|
|
||||||
virtual uint32_t GetPasswordMaskDelayImpl() { return 600; }
|
virtual uint32_t GetPasswordMaskDelayImpl() { return 600; }
|
||||||
|
|
||||||
|
virtual bool GetDefaultDrawInTitlebar() { return true; }
|
||||||
|
|
||||||
static bool LookAndFeelFontToStyle(const LookAndFeelFont&, nsString& aName,
|
static bool LookAndFeelFontToStyle(const LookAndFeelFont&, nsString& aName,
|
||||||
gfxFontStyle&);
|
gfxFontStyle&);
|
||||||
static LookAndFeelFont StyleToLookAndFeelFont(const nsAString& aName,
|
static LookAndFeelFont StyleToLookAndFeelFont(const nsAString& aName,
|
||||||
|
|||||||
@@ -2225,7 +2225,6 @@ STATIC_ATOMS = [
|
|||||||
Atom("_moz_is_resource_document", "-moz-is-resource-document"),
|
Atom("_moz_is_resource_document", "-moz-is-resource-document"),
|
||||||
Atom("_moz_swipe_animation_enabled", "-moz-swipe-animation-enabled"),
|
Atom("_moz_swipe_animation_enabled", "-moz-swipe-animation-enabled"),
|
||||||
Atom("_moz_gtk_csd_available", "-moz-gtk-csd-available"),
|
Atom("_moz_gtk_csd_available", "-moz-gtk-csd-available"),
|
||||||
Atom("_moz_gtk_csd_hide_titlebar_by_default", "-moz-gtk-csd-hide-titlebar-by-default"),
|
|
||||||
Atom("_moz_gtk_csd_titlebar_radius", "-moz-gtk-csd-titlebar-radius"),
|
Atom("_moz_gtk_csd_titlebar_radius", "-moz-gtk-csd-titlebar-radius"),
|
||||||
Atom("_moz_gtk_csd_minimize_button", "-moz-gtk-csd-minimize-button"),
|
Atom("_moz_gtk_csd_minimize_button", "-moz-gtk-csd-minimize-button"),
|
||||||
Atom("_moz_gtk_csd_maximize_button", "-moz-gtk-csd-maximize-button"),
|
Atom("_moz_gtk_csd_maximize_button", "-moz-gtk-csd-maximize-button"),
|
||||||
|
|||||||
@@ -319,6 +319,9 @@ interface nsIXULRuntime : nsISupports
|
|||||||
/** Whether the chrome color-scheme is dark */
|
/** Whether the chrome color-scheme is dark */
|
||||||
readonly attribute boolean chromeColorSchemeIsDark;
|
readonly attribute boolean chromeColorSchemeIsDark;
|
||||||
|
|
||||||
|
/** Whether we should draw over the titlebar */
|
||||||
|
readonly attribute boolean drawInTitlebar;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The path of the shortcut used to start the current process, or "" if none.
|
* The path of the shortcut used to start the current process, or "" if none.
|
||||||
*
|
*
|
||||||
|
|||||||
Reference in New Issue
Block a user