Bug 1389094 - Increase spacing in the sidebar in touch mode.
MozReview-Commit-ID: sMbWveohuG
--- a/browser/components/places/content/sidebarUtils.js
+++ b/browser/components/places/content/sidebarUtils.js
@@ -1,13 +1,38 @@
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
Components.utils.import("resource://gre/modules/AppConstants.jsm");
+Components.utils.import("resource://gre/modules/Services.jsm");
+Components.utils.import("resource://gre/modules/XPCOMUtils.jsm");
+
+var prefBranch = Services.prefs.getBranch("browser.");
+
+function updateUIDensity() {
+ var density = prefBranch.getIntPref("uidensity");
+ var doc = document.documentElement;
+ if (density == 2) {
+ doc.setAttribute("uidensity", "touch");
+ } else {
+ doc.removeAttribute("uidensity");
+ }
+}
+
+var prefObserver = {
+ QueryInterface: XPCOMUtils.generateQI([Components.interfaces.nsIObserver,
+ Components.interfaces.nsISupportsWeakReference]),
+ observe() {
+ updateUIDensity();
+ },
+};
+prefBranch.addObserver("uidensity", prefObserver, true);
+
+updateUIDensity();
var SidebarUtils = {
handleTreeClick: function SU_handleTreeClick(aTree, aEvent, aGutterSelect) {
// right-clicks are not handled here
if (aEvent.button == 2)
return;
var tbo = aTree.treeBoxObject;
--- a/browser/themes/osx/places/places.css
+++ b/browser/themes/osx/places/places.css
@@ -14,16 +14,21 @@
.sidebar-placesTreechildren::-moz-tree-row {
padding-bottom: 1px;
margin: 0;
height: 24px;
/* Default font size is 11px on mac, so this is 12px */
font-size: 1.0909rem;
}
+:root[uidensity=touch] .sidebar-placesTree,
+:root[uidensity=touch] .sidebar-placesTreechildren::-moz-tree-row {
+ height: 32px;
+}
+
.sidebar-placesTree {
-moz-appearance: -moz-mac-source-list;
-moz-font-smoothing-background-color: -moz-mac-source-list;
}
.sidebar-placesTreechildren::-moz-tree-separator {
border-top: 1px solid #505d6d;
margin: 0 10px;