Bug 1389094 - Increase spacing in the sidebar in touch mode. draft
authorNihanth Subramanya <nhnt11@gmail.com>
Thu, 21 Sep 2017 08:18:28 +0530
changeset 668024 1ae2a8dff3de378c0d05053742ad917c040bd2c7
parent 667935 319a34bea9e4f3459886b5b9e835bd338320f1fd
child 732587 f41a6ad01ab4a2c694de56e49f88cf9be1945e3d
push id80925
push usernhnt11@gmail.com
push dateThu, 21 Sep 2017 02:55:41 +0000
bugs1389094
milestone57.0a1
Bug 1389094 - Increase spacing in the sidebar in touch mode. MozReview-Commit-ID: sMbWveohuG
browser/components/places/content/sidebarUtils.js
browser/themes/osx/places/places.css
--- 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;