зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1349552 - Part 2 - Add an extra drag space setting to customize mode. r=nhnt11
MozReview-Commit-ID: IWxdOeRwDeu --HG-- extra : rebase_source : 953c988fdaab5a7bf64ecbdd363df846020063d9
This commit is contained in:
Родитель
f71ee4ffee
Коммит
c90a0e9e12
|
@ -5510,6 +5510,10 @@ function setToolbarVisibility(toolbar, isVisible, persist = true) {
|
|||
toolbar.dispatchEvent(event);
|
||||
|
||||
BookmarkingUI.onToolbarVisibilityChange();
|
||||
|
||||
if (toolbar.getAttribute("type") == "menubar" && CustomizationHandler.isCustomizing()) {
|
||||
gCustomizeMode._updateDragSpaceCheckbox();
|
||||
}
|
||||
}
|
||||
|
||||
function updateToggleControlLabel(control) {
|
||||
|
|
|
@ -38,6 +38,7 @@ const kPrefCustomizationState = "browser.uiCustomization.state";
|
|||
const kPrefCustomizationAutoAdd = "browser.uiCustomization.autoAdd";
|
||||
const kPrefCustomizationDebug = "browser.uiCustomization.debug";
|
||||
const kPrefDrawInTitlebar = "browser.tabs.drawInTitlebar";
|
||||
const kPrefExtraDragSpace = "browser.tabs.extraDragSpace";
|
||||
const kPrefUIDensity = "browser.uidensity";
|
||||
const kPrefAutoTouchMode = "browser.touchmode.auto";
|
||||
const kPrefAutoHideDownloadsButton = "browser.download.autohideButton";
|
||||
|
@ -153,6 +154,7 @@ var gListeners = new Set();
|
|||
var gUIStateBeforeReset = {
|
||||
uiCustomizationState: null,
|
||||
drawInTitlebar: null,
|
||||
extraDragSpace: null,
|
||||
currentTheme: null,
|
||||
uiDensity: null,
|
||||
autoTouchMode: null,
|
||||
|
@ -2625,6 +2627,7 @@ var CustomizableUIInternal = {
|
|||
_resetUIState() {
|
||||
try {
|
||||
gUIStateBeforeReset.drawInTitlebar = Services.prefs.getBoolPref(kPrefDrawInTitlebar);
|
||||
gUIStateBeforeReset.extraDragSpace = Services.prefs.getBoolPref(kPrefExtraDragSpace);
|
||||
gUIStateBeforeReset.uiCustomizationState = Services.prefs.getCharPref(kPrefCustomizationState);
|
||||
gUIStateBeforeReset.uiDensity = Services.prefs.getIntPref(kPrefUIDensity);
|
||||
gUIStateBeforeReset.autoTouchMode = Services.prefs.getBoolPref(kPrefAutoTouchMode);
|
||||
|
@ -2637,6 +2640,7 @@ var CustomizableUIInternal = {
|
|||
|
||||
Services.prefs.clearUserPref(kPrefCustomizationState);
|
||||
Services.prefs.clearUserPref(kPrefDrawInTitlebar);
|
||||
Services.prefs.clearUserPref(kPrefExtraDragSpace);
|
||||
Services.prefs.clearUserPref(kPrefUIDensity);
|
||||
Services.prefs.clearUserPref(kPrefAutoTouchMode);
|
||||
Services.prefs.clearUserPref(kPrefAutoHideDownloadsButton);
|
||||
|
@ -2710,7 +2714,7 @@ var CustomizableUIInternal = {
|
|||
|
||||
const {
|
||||
uiCustomizationState, drawInTitlebar, currentTheme, uiDensity,
|
||||
autoTouchMode, autoHideDownloadsButton,
|
||||
autoTouchMode, autoHideDownloadsButton, extraDragSpace,
|
||||
} = gUIStateBeforeReset;
|
||||
gNewElementCount = gUIStateBeforeReset.newElementCount;
|
||||
|
||||
|
@ -2720,6 +2724,7 @@ var CustomizableUIInternal = {
|
|||
|
||||
Services.prefs.setCharPref(kPrefCustomizationState, uiCustomizationState);
|
||||
Services.prefs.setBoolPref(kPrefDrawInTitlebar, drawInTitlebar);
|
||||
Services.prefs.setBoolPref(kPrefExtraDragSpace, extraDragSpace);
|
||||
Services.prefs.setIntPref(kPrefUIDensity, uiDensity);
|
||||
Services.prefs.setBoolPref(kPrefAutoTouchMode, autoTouchMode);
|
||||
Services.prefs.setBoolPref(kPrefAutoHideDownloadsButton, autoHideDownloadsButton);
|
||||
|
@ -2918,6 +2923,11 @@ var CustomizableUIInternal = {
|
|||
return false;
|
||||
}
|
||||
|
||||
if (Services.prefs.prefHasUserValue(kPrefExtraDragSpace)) {
|
||||
log.debug(kPrefExtraDragSpace + " pref is non-default");
|
||||
return false;
|
||||
}
|
||||
|
||||
if (LightweightThemeManager.currentTheme) {
|
||||
log.debug(LightweightThemeManager.currentTheme + " theme is non-default");
|
||||
return false;
|
||||
|
@ -3659,6 +3669,7 @@ this.CustomizableUI = {
|
|||
get canUndoReset() {
|
||||
return gUIStateBeforeReset.uiCustomizationState != null ||
|
||||
gUIStateBeforeReset.drawInTitlebar != null ||
|
||||
gUIStateBeforeReset.extraDragSpace != null ||
|
||||
gUIStateBeforeReset.currentTheme != null ||
|
||||
gUIStateBeforeReset.autoTouchMode != null ||
|
||||
gUIStateBeforeReset.uiDensity != null;
|
||||
|
|
|
@ -15,6 +15,7 @@ const kDragDataTypePrefix = "text/toolbarwrapper-id/";
|
|||
const kSkipSourceNodePref = "browser.uiCustomization.skipSourceNodeCheck";
|
||||
const kToolbarVisibilityBtn = "customization-toolbar-visibility-button";
|
||||
const kDrawInTitlebarPref = "browser.tabs.drawInTitlebar";
|
||||
const kExtraDragSpacePref = "browser.tabs.extraDragSpace";
|
||||
const kMaxTransitionDurationMs = 2000;
|
||||
const kKeepBroadcastAttributes = "keepbroadcastattributeswhencustomizing";
|
||||
|
||||
|
@ -117,7 +118,9 @@ function CustomizeMode(aWindow) {
|
|||
}
|
||||
if (AppConstants.CAN_DRAW_IN_TITLEBAR) {
|
||||
this._updateTitlebarCheckbox();
|
||||
this._updateDragSpaceCheckbox();
|
||||
Services.prefs.addObserver(kDrawInTitlebarPref, this);
|
||||
Services.prefs.addObserver(kExtraDragSpacePref, this);
|
||||
}
|
||||
this.window.addEventListener("unload", this);
|
||||
}
|
||||
|
@ -149,6 +152,7 @@ CustomizeMode.prototype = {
|
|||
uninit() {
|
||||
if (AppConstants.CAN_DRAW_IN_TITLEBAR) {
|
||||
Services.prefs.removeObserver(kDrawInTitlebarPref, this);
|
||||
Services.prefs.removeObserver(kExtraDragSpacePref, this);
|
||||
}
|
||||
},
|
||||
|
||||
|
@ -1537,6 +1541,7 @@ CustomizeMode.prototype = {
|
|||
this._updateUndoResetButton();
|
||||
if (AppConstants.CAN_DRAW_IN_TITLEBAR) {
|
||||
this._updateTitlebarCheckbox();
|
||||
this._updateDragSpaceCheckbox();
|
||||
}
|
||||
break;
|
||||
case "lightweight-theme-window-updated":
|
||||
|
@ -1564,12 +1569,47 @@ CustomizeMode.prototype = {
|
|||
}
|
||||
},
|
||||
|
||||
_updateDragSpaceCheckbox() {
|
||||
if (!AppConstants.CAN_DRAW_IN_TITLEBAR) {
|
||||
return;
|
||||
}
|
||||
|
||||
let extraDragSpace = Services.prefs.getBoolPref(kExtraDragSpacePref);
|
||||
let drawInTitlebar = Services.prefs.getBoolPref(kDrawInTitlebarPref, true);
|
||||
let menuBar = this.document.getElementById("toolbar-menubar");
|
||||
let menuBarEnabled = menuBar
|
||||
&& AppConstants.platform != "macosx"
|
||||
&& menuBar.getAttribute("autohide") != "true";
|
||||
|
||||
let checkbox = this.document.getElementById("customization-extra-drag-space-checkbox");
|
||||
if (extraDragSpace) {
|
||||
checkbox.setAttribute("checked", "true");
|
||||
} else {
|
||||
checkbox.removeAttribute("checked");
|
||||
}
|
||||
|
||||
if (!drawInTitlebar || menuBarEnabled) {
|
||||
checkbox.setAttribute("disabled", "true");
|
||||
} else {
|
||||
checkbox.removeAttribute("disabled");
|
||||
}
|
||||
},
|
||||
|
||||
toggleTitlebar(aShouldShowTitlebar) {
|
||||
if (!AppConstants.CAN_DRAW_IN_TITLEBAR) {
|
||||
return;
|
||||
}
|
||||
// Drawing in the titlebar means not showing the titlebar, hence the negation:
|
||||
Services.prefs.setBoolPref(kDrawInTitlebarPref, !aShouldShowTitlebar);
|
||||
this._updateDragSpaceCheckbox();
|
||||
},
|
||||
|
||||
toggleDragSpace(aShouldShowDragSpace) {
|
||||
if (!AppConstants.CAN_DRAW_IN_TITLEBAR) {
|
||||
return;
|
||||
}
|
||||
|
||||
Services.prefs.setBoolPref(kExtraDragSpacePref, aShouldShowDragSpace);
|
||||
},
|
||||
|
||||
get _dwu() {
|
||||
|
|
|
@ -39,6 +39,9 @@
|
|||
#NB: because oncommand fires after click, by the time we've fired, the checkbox binding
|
||||
# will already have switched the button's state, so this is correct:
|
||||
oncommand="gCustomizeMode.toggleTitlebar(this.checked)"/>
|
||||
<checkbox id="customization-extra-drag-space-checkbox" class="customizationmode-checkbox"
|
||||
label="&customizeMode.extraDragSpace;"
|
||||
oncommand="gCustomizeMode.toggleDragSpace(this.checked)"/>
|
||||
#endif
|
||||
<button id="customization-toolbar-visibility-button" label="&customizeMode.toolbars2;" class="customizationmode-button" type="menu">
|
||||
<menupopup id="customization-toolbar-menu" onpopupshowing="onViewToolbarsPopupShowing(event)"/>
|
||||
|
|
|
@ -836,6 +836,7 @@ you can use these alternative items. Otherwise, their values should be empty. -
|
|||
<!ENTITY customizeMode.restoreDefaults "Restore Defaults">
|
||||
<!ENTITY customizeMode.done "Done">
|
||||
<!ENTITY customizeMode.titlebar "Title Bar">
|
||||
<!ENTITY customizeMode.extraDragSpace "Drag Space">
|
||||
<!ENTITY customizeMode.toolbars2 "Toolbars">
|
||||
<!ENTITY customizeMode.lwthemes "Themes">
|
||||
<!ENTITY customizeMode.lwthemes.myThemes "My Themes">
|
||||
|
|
Загрузка…
Ссылка в новой задаче