Bug 1355771 - Automatically enable Firefox touch mode in Windows Tablet mode. r=dao
MozReview-Commit-ID: 1KLFdsNlib1
This commit is contained in:
@@ -240,6 +240,13 @@ pref("general.autoScroll", true);
|
||||
// UI density of the browser chrome. This mostly affects toolbarbutton
|
||||
// and urlbar spacing. The possible values are 0=normal, 1=compact, 2=touch.
|
||||
pref("browser.uidensity", 0);
|
||||
// Whether Firefox will automatically override the uidensity to "touch"
|
||||
// while the user is in a touch environment (such as Windows tablet mode).
|
||||
#ifdef MOZ_PHOTON_THEME
|
||||
pref("browser.touchmode.auto", true);
|
||||
#else
|
||||
pref("browser.touchmode.auto", false);
|
||||
#endif
|
||||
|
||||
// At startup, check if we're the default browser and prompt user if not.
|
||||
pref("browser.shell.checkDefaultBrowser", true);
|
||||
|
||||
@@ -5407,6 +5407,7 @@ var TabletModeUpdater = {
|
||||
document.documentElement.removeAttribute("tabletmode");
|
||||
}
|
||||
if (wasInTabletMode != isInTabletMode) {
|
||||
gUIDensity.update();
|
||||
TabsInTitlebar.updateAppearance(true);
|
||||
}
|
||||
},
|
||||
@@ -5446,7 +5447,10 @@ function displaySecurityInfo() {
|
||||
|
||||
// Updates the UI density (for touch and compact mode) based on the uidensity pref.
|
||||
var gUIDensity = {
|
||||
MODE_COMPACT: 1,
|
||||
MODE_TOUCH: 2,
|
||||
prefDomain: "browser.uidensity",
|
||||
|
||||
observe(aSubject, aTopic, aPrefName) {
|
||||
if (aTopic != "nsPref:changed" || aPrefName != this.prefDomain)
|
||||
return;
|
||||
@@ -5455,12 +5459,22 @@ var gUIDensity = {
|
||||
},
|
||||
|
||||
update() {
|
||||
let mode;
|
||||
// Automatically override the uidensity to touch in Windows tablet mode.
|
||||
if (AppConstants.isPlatformAndVersionAtLeast("win", "10") &&
|
||||
WindowsUIUtils.inTabletMode &&
|
||||
gPrefService.getBoolPref("browser.touchmode.auto")) {
|
||||
mode = this.MODE_TOUCH;
|
||||
} else {
|
||||
mode = gPrefService.getIntPref(this.prefDomain);
|
||||
}
|
||||
|
||||
let doc = document.documentElement;
|
||||
switch (gPrefService.getIntPref(this.prefDomain)) {
|
||||
case 1:
|
||||
switch (mode) {
|
||||
case this.MODE_COMPACT:
|
||||
doc.setAttribute("uidensity", "compact");
|
||||
break;
|
||||
case 2:
|
||||
case this.MODE_TOUCH:
|
||||
doc.setAttribute("uidensity", "touch");
|
||||
break;
|
||||
default:
|
||||
|
||||
Reference in New Issue
Block a user