Bug 1538789 - Don't show tooltip if not hovering a cell in the folder pane. Show full cell text when on a truncated cell. r=darktrojan a=jorgk
authoraceman <acelists@atlas.sk>
Mon, 25 Mar 2019 11:48:00 +0100
changeset 33969 922f9c9d7024
parent 33968 009e7920f860
child 33970 e4751d2e281f
push id2394
push usermozilla@jorgk.com
push dateSat, 30 Mar 2019 21:10:54 +0000
treeherdercomm-beta@a07bc5354c40 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersdarktrojan, jorgk
bugs1538789
Bug 1538789 - Don't show tooltip if not hovering a cell in the folder pane. Show full cell text when on a truncated cell. r=darktrojan a=jorgk
mail/base/content/foldersummary.js
--- a/mail/base/content/foldersummary.js
+++ b/mail/base/content/foldersummary.js
@@ -195,32 +195,45 @@ class MozFolderTooltip extends MozFolder
   /** Handle the popupshowing event. */
   folderpopupShowing(event) {
     let msgFolder = gFolderTreeView.getFolderAtCoords(event.clientX,
                                                       event.clientY);
     if (!msgFolder) {
       return false;
     }
 
+    let treeCellInfo = gFolderTreeView._tree.getCellAt(event.clientX, event.clientY);
+    if (!treeCellInfo.col) {
+      return false;
+    }
+
     let tooltipnode = event.target;
     let asyncResults = {};
     if (tooltipnode.parseFolder(msgFolder, null, asyncResults)) {
       return true;
     }
 
-    let treeCellInfo = gFolderTreeView._tree.getCellAt(event.clientX, event.clientY);
     if (treeCellInfo.col.id == "folderNameCol") {
       let cropped = gFolderTreeView._tree.isCellCropped(treeCellInfo.row, treeCellInfo.col);
       if (this._addLocationInfo(msgFolder, cropped, tooltipnode)) {
         return true;
       }
     }
 
     let counts = gFolderTreeView.getSummarizedCounts(treeCellInfo.row, treeCellInfo.col.id);
-    return this._addSummarizeExplain(counts, tooltipnode);
+    if (this._addSummarizeExplain(counts, tooltipnode)) {
+      return true;
+    }
+
+    if (gFolderTreeView._tree.isCellCropped(treeCellInfo.row, treeCellInfo.col)) {
+      let croppedText = gFolderTreeView.getCellText(treeCellInfo.row, treeCellInfo.col);
+      return this._addCroppedText(croppedText, tooltipnode);
+    }
+
+    return false;
   }
 
   /** Handle the popuphiding event. */
   folderpopupHiding(event) {
     let node = event.target;
     while (node.hasChildNodes()) {
       node.lastChild.remove();
     }
@@ -268,13 +281,20 @@ class MozFolderTooltip extends MozFolder
       }
       let expl = document.createElement("label");
       let sumString = document.getElementById("bundle_messenger")
         .getFormattedString("subfoldersExplanation", [counts[0], counts[1]], 2);
       expl.setAttribute("value", sumString);
       node.appendChild(expl);
       return true;
     }
+
+  _addCroppedText(text, node) {
+      let expl = document.createElement("label");
+      expl.setAttribute("value", text);
+      node.appendChild(expl);
+      return true;
+    }
 }
 
 customElements.define("folder-summary", MozFolderSummary);
 customElements.define("folder-tooltip", MozFolderTooltip);